Closing the part in the @PostConstruct method is probably confusing Eclipse. Try using UISynchronize.asyncExec to run the code after the @PostConstruct has finished running. Something like: @Inject private UISynchronize uiSynch; ... @PostConstruct public void postConstruct() { .... other code uiSynch.asyncExec(() -> { ... hide the part }); } ...
The IWorkbenchPage has the methods to control views: IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IViewPart viewPart = page.showView("view id"); The part createPartControl will be called when the view is created, on subsequent calls to showView it is not called. The viewPart will be an instance of your view class so you can...
You need both MToolItem and MMenuItem before the first execution. You can find MToolItem via EModelService in a @PostConstruct method. private MMenuItem menuItem; private MToolItem toolItem; @PostConstruct protected void initControls(MApplication app) { setToolItem((MToolItem) modelService.find("tool.item.id", app)); } As for menu item, it cannot be found in such a way via EModelService...
You can use the EPartService addPartListener method to add a listener that is notified about all part activation (and other) events.
it alerted that 'org.eclipse .core .internal.File cannot be cast to org.eclipse.core.resource.IProject'. Because: Corrected last 3 lines of your code. if(selection1.getFirstElement() instanceof IFile) { IFile file = (IFile) selection1.getFirstElement(); String real_file_path = file.getLocation().toString(); System.out.println(real_file_path); } ...
When you add the 'Handler Tool Item' to the Toolbar in the Application.e4xmi you can specify the 'Type' as 'Check' to get the pressed / not pressed behavior. In your Handler for the item you can inject the 'MToolItem' so that you can test the checked state: @Execute public void...
Use the active leaf context: IEclipseContext activeContext = application.getContext().getActiveLeaf(); EPartService partService = activeContext.get(EPartService.class); I don't think the model and part service actually change so just using application.getContext() should also be OK. The application object does not change....
Probably the earliest you can get the workbench is by subscribing to the application startup complete event UIEvents.UILifeCycle.APP_STARTUP_COMPLETE with the event broker. However this does not fire until just after the UI is displayed. Update: The event handler would be something like: private static final class AppStartupCompleteEventHandler implements EventHandler {...
Eclipse 4 (e4) applications are completely different from traditional Eclipse 3.x style applications. In an e4 application you cannot use a lot of things that are used in a Eclipse 3.x application - so you need to check which style the example you are using is based on. The e4...
You can do this by setting the label on the top level MWindow of your app: @Inject MApplication application; @Inject EModelService modelService; .... MWindow window = (MWindow)modelService.find("id of your top window", application); window.setLabel("new label"); ...
Here the workaround/solution: public class page extends PreferencePage { public page(String title) { super(title); } ...
java,eclipse-rcp,preferences,rcp
Wait until performOk or performApply is called before checking for restart. The preference values are stored in the preference store. You can get them with: IPreferenceStore store = getPreferenceStore(); String dir = store.getString(WORKSPACE_DIR); String url = store.getString(SERVER_URL); ...
The menu items you add to the application model will be persisted, so you need to check if they already exist in the menu. The contains check you currently have does not do this. You need to check for a match of the label (or the contribution URI, or the...
Given a table named "t_object" ... object_id object_name --------- ----------- 1 alpha 2 bravo 3 charlie 4 delta 5 echo ... where "object_id" is the primary key, you could delete specific rows like so: // test data ArrayList<Integer> enabledComponentsIds = new ArrayList<>(); enabledComponentsIds.add(2); enabledComponentsIds.add(3); String dbFileSpec = "C:/Users/Public/jackcessTest.mdb"; try (Database...
Just adding a jar to the Java Build Path is not correct for an Eclipse plugin. The swtchart jar is an Eclipse plugin so for an RCP you should add the swtchart plugin to your Target Platform and make your plugin depend on the swtchart plugin. You should then include...
org.eclipse.core.internal.net.ProxyManager is in an internal package and is therefore not part of the official Eclipse API - you should not be using it (Eclipse API Rules of Engagement). Some of the functions of the proxy manager are available through the org.eclipse.core.net.proxy.IProxyService OSGi service which is part of the official API....
Everything in an RCP must be included in one of the plugins. You need to build a jar file from your simple Java project and put that jar in one of the plugins included in the RCP....
If you want your RCP to start in its original state each time it is started specify the -clearPersistedState option. You can specify this in your .product file on the 'Launching' tab in 'Program Arguments' section. Note: This option is for Eclipse 4.x...
java,eclipse,swt,rcp,eclipse-rap
To custom-align images, you have two choices in RAP: Markup After preparing the table accordingly, you can use a subset of HTML with the table items's text. Table table = new Table( parent, SWT.NONE ); table.setData( RWT.MARKUP_ENABLED, Boolean.TRUE ); table.setData( RWT.CUSTOM_ITEM_HEIGHT, Integer.valueOf( 80 ) ); TableItem item = new TableItem(...
The order in which you declare the views is important in getting the view to stretch across the whole window. Declare the console view first: <view id="org.eclipse.ui.console.ConsoleView" minimized="false" ratio="0.75" relationship="bottom" relative="org.eclipse.ui.editorss" visible="true"> </view> <view id="AvgPowerTool.SettingsView" minimized="false" ratio="0.85" relationship="right" relative="org.eclipse.ui.editorss" visible="true"> </view> <view id="org.eclipse.ui.navigator.ProjectExplorer"...
Core expressions are not working for toolbar items, for example. You can use the following workaround in command handlers: public class SomeHandler { protected MToolItem toolItem; @CanExecute @Inject public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional ISelection selection) { boolean canExecute = ... setToolItemVisible(canExecute); ... } private void setToolItemVisible(final boolean visible) { if (toolItem...
Looks like you're missing xerces library, try including them in your classpath
eclipse,eclipse-plugin,eclipse-rcp,rcp,activator
You can have an activator in any or all of your plugins. For your UI plugin the activator can extend AbstractUIPlugin which has an getImageRegistry() method. The ImageRegistry can be used to manage images. The activator for your logic plugin should probably extend Plugin so that it does not have...
java,eclipse-plugin,eclipse-rcp,executable-jar,rcp
Ok I Solved my problem. The actual scenario was that I had a third part jar which was included in the wrapper plugin project and is required by other plugins to compile successfully. During the compilation (exporting the product) these other plugins uses the jar located in the wrapper plugin...
java,eclipse-plugin,eclipse-rcp,rcp
It means for example : Plugin A has a dependency to plugin B and Plugin B has a dependency to plugin A You need to refactor your code so that you don't have this problem anymore. Try to determine which code/plugin is overused, and optimize the distribution, even if that...
If you're really troubleshooting a connection to the service in question, you should use Fiddler to capture the request from the client to the server. If you then wish to play around with modifications to that request, drag/drop the Session from the Web Sessions list to the Composer tab and...
The applicationXMI property value should include the plugin id: <property name="applicationXMI" value="plugin-id/something.e4xmi"> </property> ...
According to Eclipse bug 401309 and various comments in the Eclipse forums XText editors are not compatible with a pure e4 RCP because they rely on lots of code from the 3.x compatibility layer. You can still create an Eclipse 3.x style RCP, as described in your second reference....
There is a preference for the minimum widths of view tabs: IWorkbenchPreferenceConstants.VIEW_MINIMUM_CHARACTERS You can set the value in a preference initializer or in a plugin_customization.ini file like this: org.eclipse.ui/VIEW_MINIMUM_CHARACTERS = -1 (-1 disables any shortening of the tabs)...
org.eclipse.ui.internal.PartSite is in an internal package and you should not be trying to use it. MultiPageEditorSite is not based on PartSite so you cannot cast from one to the other. You can get the IEclipseContext for the part using: IEclipseContext context = (IEclipseContext)getSite().getService(IEclipseContext.class) ...
java,file,eclipse-plugin,swt,rcp
Read this link. http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/resInt_linked.htm. Explained clearly on how to create Link files programmatically. If in case I understood your question wrongly, let me know. Updated based on comments received Snippet from the Link which explains how Link files shall be created programatically. IProject project = workspace.getProject("Project");//assume this exists IFolder link...
java,dependency-injection,swt,rcp,e4
When you use @UIEventTopic Eclipse has to remember the method so that it can call it whenever an event occurs. Eclipse continues to remember and call this method until you run ContextInjectionFactory.uninject on the class instance. This has nothing to do with disposing of SWT controls - that just releases...
Even in WBWRenderer I think you will struggle to get anything above the menu. The code calls Shell.setMenuBar to set the menu, this has a lot of platform specific code for the menu. You are going to have to study (and probably duplicate) a lot of the source of WBWRenderer...
java,eclipse-plugin,eclipse-rcp,rcp,jobs
Normally jobs show a progress indicator in the progress view and in the status line at the bottom of the main window. If you call setUser(true) before schedule() then the job will show a pop-up progress dialog if the job runs for more than a few seconds. To show job...
No you cannot nest tree viewers. You must use a data model for the tree that represents the whole tree. Suppose you have a class TopLevelElement representing one of the top level elements in the tree, and classes Level1Element and Level2Element for the first and second level children. Then your...
If you are asking how to define launch parameters when starting up your RCP application you have two options. Define them in the Run Configuration (configurable via Project > Run Configurations) Define them at startup by passing them in with the executable from the console (e.g., ./myrcp -application myrcp). For...
It doesn't make sense to use versions for what you are trying to achieve. With versions, there is always an older and a newer version, with the new version meant to eventually replace the old version. So but if you wanted all your users to use the newer version of...
When running an RCP using 'Run > Eclipse Application' you need to make sure that all the required plugins are checked in the 'Run Configuration' for the application (on the Plugins tab). If you subsequently build the RCP using an xxx.product file you must list all the required plugins (or...
Add FORCE_TEXT to the Tags (on the Supplementary tab) for the HandledToolItem in the e4xmi file.
You need to use two 'Toolbar' entries with a 'Tool Control' between them: so something like: In the Tags for the Tool Control add the word stretch this will make the trim bar manager stretch out the control to use all available space pushing everything after it to the right:...
java,swt,jface,rcp,tableviewer
That is how ComboBoxCellEditor is designed to work. The internal method applyEditorValueAndDeactivate is only called on Tab, Enter, and focus lost. None of this behavior looks easy to modify other than by writing your own version of the class (which is not large)....
I found what was wrong. The shell creation was wrong because I was using APPLICATION_MODAL bit: shell = new Shell(Display.getCurrent(), SWT.TITLE | SWT.CLOSE | SWT.MAX | SWT.SHELL_TRIM | SWT.APPLICATION_MODAL | SWT.YES | SWT.NO); It had to be PRIMARY_MODAL: shell = new Shell(Display.getCurrent(), SWT.TITLE | SWT.CLOSE | SWT.MAX | SWT.SHELL_TRIM |...
Use a IWindowListener to listen for workbench windows being activated: IWorkbench workbench = PlatformUI.getWorkbench(); workbench.addWindowListener(windowListener); In the windowActivated method of the listener use the window part service to add a part listener for the window: public void windowActivated(IWorkbenchWindow window) { window.getPartService().addPartListener(partListener); } As an example see org.eclipse.jdt.internal.debug.ui.actions.ActionDelegateHelper...
MarkerSupportView is in the org.eclipse.ui.ide plugin. To find classes in the Eclipse plugins go to Preferences > Plug-in Development and check the Include all plug-ins from target in Java search. Once this is set the Navigate > Open Type... dialog will search all the plugins in your target platform for...
You can't, internal classes are out of bounds - Eclipse API Rules of Engagement. The method restoreState does not even exist in the Eclipse 4.3 version of Workbench....
You can use the addPartListener method of EPartService to add a listener for changes to the state of parts: @Inject EPartService partService; ... partService.addPartListener(IPartListener instance); Be sure to import the correct IPartListener - org.eclipse.e4.ui.workbench.modeling.IPartListener...
Specify the -clearPersistedState option in the Run Configuration for the application to stop it loading the saved e4xmi file. You might also want to use -clean to make sure plugin changes are also picked up.
java,eclipse,eclipse-rcp,rcp,e4
In Eclipse e4 the main tool bars are called the 'TrimBars'. In the Application.e4xmi editor you can choose to have TrimBars at the top (below the menu), left, right or bottom of a Trimmed Window.
eclipse,maven,svn,rcp,subclipse
Question: I do not understand why this happens General Answer: http://www.ihateeclipse.com/ (I may share this opinions and dont think Eclipse should be called a IDE but that wont fix your problem - hence lets proceed with possible workarounds). Possible Workarounds: 1.) Starting eclipse in clean mode How to run eclipse...
e4 does not currently run headless so there isn't really an equivalent. For access to the Display you can use Display.getDefault() everywhere. If you have a class derived from SWT Control available you can also use Control.getDisplay() If you want to use the asyncExec or syncExec methods of Display you...
PopupDialog extends the JFace Window class so you can call: setBlockOnOpen(true); to ask for blocking. Do this before calling the open() method....
You probably have source.lib/commons-beanutils.jar in a build.properties that is syntaxically incorrect. Search for that string in your workspace and check every build.properties
PlatformUI is not available in an e4 application, do not try and use it. @PostConstruct is too early to do anything in the LifeCycle class. The first point you should try and do anything is the @PostContextCreate method. You can inject org.eclipse.e4.ui.workbench.IWorkbench and call the close method to shutdown the...
java,eclipse-plugin,eclipse-rcp,rcp
Make sure org.eclipse.rcptt.tesla.swt is in the deployed product
EPartService.saveAll just calls any method annotated with @Persist in the parts. This will be done automatically when the workspace is shutdown anyway. Note: The part must be marked as dirty for the @Persist method to be called. So to save any details in your part you need a method: @Persist...
Found a way for the rcp testing tool: https://www.eclipse.org/rcptt/documentation/faq/pass-value/ Add the parameter you want to include in your test to the aut vm arguments like -DpropertyName=propertyValue Use ecl function get-java-property "propertyName" to get the value of the passed property ...
Finally, I found the problem. I ran the application using the Run button on Eclipse's toolbar. The run command was initially created when the application was started in the product definition editor. The plugin was added after the first run, and it did not get updated to the run command...
eclipse,rcp,treeviewer,treepath
Looking at the source code the Eclipse 'search references' says that nothing calls the TreePath version of filter. Your ITreeContentProvider has a getParent(object) method which you can use to traverse the tree....