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
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.
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.


Post a Comment