Tech-Today
Eclipse-rcp shows a blank perspective when adding view dynamically and overriding the ApplicationWorkbenchAdvisor's initialize method
How to recreate the problem:
1.) create a new Hello World plugin project in eclipse rcp
2.) add extension org.eclipse.ui.views in plugin.xml->Extensions
3.) right click the extension and select New->view
4.) enter an id and a class name
5.) right click the class link to generate the class
6.) in your newly create view class add a unique-value variable named ID
public static final String ID = "package.YouViewClass";
7.) in the Perspective.java createInitialLayout method add the following code
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible(false);
layout.addStandaloneView(YourViewClass.ID, false, IPageLayout.TOP, IPageLayout.RATIO_MAX, editorArea);
}
8.) override the initialize method of ApplicationWorkbenchAdvisor's class
@Override
public void initialize(IWorkbenchConfigurer configurer) {
configurer.setSaveAndRestore(true);
}
I think what happens here is that eclipse is restoring a supposed to be saved state of the view. But this time we've just created our view so it will not find anything.
Solution is to remove the configurer.setSaveAndRestore(true); or if you really want that piece of code. Then you just have to clear your workspace. By:
1.) Run->Run Configurations->Eclipse Applications->Your Application, make sure "Clear" is checked.
-
How To Open A View Using The Eclipse-rcp's Plugin.xml's Extension Tab. Passing The View Id As A Command Parameter.
1.) Create a new HelloWorld RCP project 2.) Open the plugin.xml file and click the Extension tab 3.) Add the extension org.eclipse.ui.commands a.) right click and select New->command b.) set the command's id to command.showView c.) set the defaultHandler...
-
How To Show Dynamic Command Based On Perspective In Eclipse-rcp, Does Not Work On Toolbar And Main Menu
1.) Using the HelloWorld project template, add org.eclipse.core.expressions in your application's plugin.xml's Dependencies tab. 2.) In the extension tab do the following: a.) add org.eclipse.core.expressions.definition, set its id to onValidationPerspective...
-
Open A View In The Eclipse-rcp's Extension Tab Using The Showviewhandler Class
Let's do this quick. 1.) Create a new HelloWorld Plug-in Project and name it CommandParameter. 2.) Open the plugin.xml and click the Extensions tab. 3.) In the All Extensions tab click the Add button and under the Extension Point Filter: search "view"....
-
Updating The Status Message Dynamically Of An Eclipse Rcp Application By Using A Worker Thread
Objective: -To create an eclipse application that will dynamically update the action bar's status message from a worker thread. Updating a part of the screen in another thread is a good practice, since it will not make your screen blink, also the...
-
Remove Or Customize The Close/minimize/maximize Button In An Eclipse-rcp's Application's Window
There are times when you just want your eclipse rcp in the middle of the screen. To do that you have to set the style bits for the window's shell to customize the look of your window. The API is accessible here: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/index.html,...
Tech-Today