no

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

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.

Related

java 6161860918593475629

Post a Comment

item