"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"
Eclipse views allow users to see a graphical representation of project metadata. For example the project navigator view presents a graphical representation of the folders and files associated with a project and properties view presents a graphical representation of an element selected in another view or editor.
To view the project explorer, click on Window menu then, click on Show View and select Project Explorer. There is simpler way to open project explorer, when you are in the editor press alt + shift + w and select project explorer.
The menu items related to building a project can be found on the Project menu. The menu items on the Run menu allow you to start a program in the run mode or debug mode.
Parts of an Eclipse Window An eclipse window can have multiple perspectives open in it but only one perspective can be active at any point of time. A user can switch between open perspectives or open a new perspective. A perspective controls what appears in some menus and tool bars.
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
You can also read the "Perspective Article" on eclipse:
In the example below you can see how
createInitialLayout
is implemented in theTestPerspective
class. For clarity the algorithm has been split into two parts which define the actions and layout:defineActions
anddefineLayout
.
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 theFile > New
,Show View
, orPerspective > Open
menus of the window.
You can also add complete action sets to the menu or toolbar of the window. In this example a fewFile > New
andShow View
items are added.
public void defineActions(IPageLayout layout) {
// Add "show views".
layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With