Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Modify list of perspectives when RCP application starts?
Modify list of perspectives when RCP application starts? [message #740312] Tue, 18 October 2011 11:26
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
I have created a RCP application and have created 2 perspectives 'base.perspective.per1' and 'base.perspective.per2' in the plugin.xml and have created corresponding classes that implements the IPerspectiveFactory.

When I run the application I can select between the two perspectives just fine (like I can switch between multiple perspectives in eclipse).

Now to my problem. When I start my application I would like to filter the entries in the perspectives list (based on some condition) so each time the application start the perspectives that can be enabled might be different.

Here is what I do in the ApplicationWorkbenchWindowAdvisor:

  @Override
  public void preWindowOpen() {
    final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
    configurer.setInitialSize(new Point(1200, 1000));
    configurer.setShowCoolBar(true);
    configurer.setShowStatusLine(true);
    configurer.setShowProgressIndicator(true);
    configurer.setShowMenuBar(true);
    configurer.setShowPerspectiveBar(true);

    IPerspectiveRegistry perspectiveRegistry = PlatformUI.getWorkbench()
        .getPerspectiveRegistry();
    IPerspectiveDescriptor[] perspectives = perspectiveRegistry
        .getPerspectives();
    for (IPerspectiveDescriptor iPerspectiveDescriptor : perspectives) {
      if (iPerspectiveDescriptor.getId().equals(
          "base.perspective.per1")) {
        perspectiveRegistry.deletePerspective(iPerspectiveDescriptor);
      }
    }
  }



The problem with using the deletePerspective method is:

"Deletes a perspective. Has no effect if the perspective is defined in an extension."

So since my perspectives are defined in the plugin.xml this does not work.

Is it only possible to dynamically modify the perspectives list for non-extension perspectives, or is there another approach to what I need?
Previous Topic:common navigator framework: adding popup menu entry under New Submenu
Next Topic:Add Server Admin panel in own RCP Application (Extremely sorry for Last incomplete Post )
Goto Forum:
  


Current Time: Tue Apr 16 14:18:53 GMT 2024

Powered by FUDForum. Page generated in 2.08480 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top