Question

"I have created an Eclipse plugin which creates a view in Eclipse. Currently it is displayed in the Eclipse menu as : 'Window->Show View->Others'.

I want to show it in 'Window -> Show View' and not under the submenu 'Others'.

I have tried it giving the 'Category' of the view in the plugin.xml file as 'org.eclipse.ui' but it is still showing the view in 'Others' submenu.

Is there any other way to do so? Any suggestions are helpful in this regard.

Thanks in advance, Abhinav"

Was it helpful?

Solution

I think you can do that with a customized perspective.

In your plugin.xml, add an extension point for "org.eclipse.ui.perspectives", and create a new class implementing IPerspectiveFactory.

This class has a method "createInitialLayout( IPageLayout layout )", and on that layout you can call "layout.addShowViewShortcut( < ID of your view > )"

You can also add shortcuts for wizards etc. there.

Hope that helps, Andreas

OTHER TIPS

You can also read the "Perspective Article" on eclipse:

In the example below you can see how createInitialLayout is implemented in the TestPerspective class. For clarity the algorithm has been split into two parts which define the actions and layout: defineActions and defineLayout.

public void createInitialLayout(IPageLayout layout) {
    defineActions(layout);
    defineLayout(layout);
}

In defineActions a number of items and action sets are added to the window. A perspective may add items to the File > New, Show View, or Perspective > Open menus of the window.
You can also add complete action sets to the menu or toolbar of the window. In this example a few File > New and Show View items are added.

public void defineActions(IPageLayout layout) {

    // Add "show views".
    layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
    ...
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top