I work with Eclipse and PyDev plugin.
I want to develop a plugin which adds to the main menu (where File is located), an item "my own custom menu" which contains in it another menu items.
According to some examples, I eventually implemented it by using the extension point of org.eclipse.ui.actionSets.
My goal is when item of "my custom menu" is clicked, it should invoke Eclipse functionality.
for example:
"my custom menu" has menu item called "open new pyDev project".
When "open new pyDev project" is clicked, I want to open the pyDev project creation window that manually is opened by clicking the following Eclipse menu items: File->new->other->PyDev->PyDev Project.
I searched quite a lot and couldn't find the way to do it.
Does someone know how to achieve my goal?
What you want to do is implement a workbench wizard that will add them to the set of workbench wizards; then you can add a perspective extension to add it the the corresponding menu generically.
You have to look up the perspective ID you are using with PyDev, but this is the recommended way to add new wizard items to the corresponding menu.
Related
Currently I'm using Eclipse's Project Explorer view into my RCP Application by writing the following line of command into my "Perspective.java" file...
layout.addView(IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.LEFT, 0.30f, editorArea);
It is currently giving me all the default right click options that eclipse's project explorer view gives..
i.e. cut, copy, paste, delete, refresh, etc.
I want to add my own custom right click options into these default options. Does anyone know how to do it? Or will have to build my own project explorer view??
Is there anyway from where i can get the code that eclipse used for building the project explorer view?
would like to know what can be done in this situation or any other solution for this??
Thankyou !!
While my comment covers your question, the follow up questions need some more space:
a) how to look at eclipse sources:
*File -> Import ... ->Plug-in Development -> Plug-ins and Fragments -> Next*
Chose *Import as -> Binary Projects* (you can read the source code but not change it. This saces time, because the code doesn't get compiled) ->Next
Chose plugins to import -> Finish
You can find the sources in the projects in "referenced libraries"
b) you need the path to the menu entry and the plugin you want to add to. This can be done with the Plugin spy (Alt+Shift+F1 -> click on the view of which you want to get the id) or or Menu-Spy (Alt+Shift+F2 -> click on the menu entry that you want to add to)in Eclipse.
c) To add a menu entry to the popup, see the How to add items in popup menu? (the one I mentioned in my comment).
My eclipse rcp application depends on a set of eclipse plugins, after I add them as dependency, the "Run" and "Search" menu appear in the main menu bar.
Which plugin contains these two menu contribution ?
How Can I hide the menu, while I still need the plugin which contribute the menu ?
You could try to use activities and contexts, as described in the Eclipse Help
Which plugin contains these two menu contribution ?
You can use Shift-Alt-F2 and then click the menu (inside your IDE, not your RCP app) to find out the menu id and thereby get a good idea of which plugin contributes it.
I am not so familiar with Eclipse plugin. I have one question on viewing/editing source code of a wizard dialog in Eclipse.
For example: In Eclipse, click File ->New->Class, the "New Java Class" wizard dialog appears.
My question is:
How to view the source code of this wizard dialog?
Can I modify the style of this wizard dialog? For example, the default value for "Superclass" is java.lang.Object, can I change the default value to another class(e.g. com.myown.myaction)?
Thank you!
To quickly view a source of a UI element use Plug-in Selection Spy tool (press Alt+Shift+F1 on a selected UI element). Then if you know the class and plug-in it originate from you can import it into your workspace and browse.
I want to add my menu in eclipse through eclipse plug-in development but not through plugin.xml. I want to use java code, as we can do the same by using IWorkBenchWindowPullDown interface for adding pulldown menu.
So what is the way to add menu in menuBar.
As above, you can use org.eclipse.ui.menus and add a menuContribution that includes a dynamic element. Then you can return whatever IContributionItems you would like from your implementation of CompoundContributionItem. See http://wiki.eclipse.org/Menu_Contributions
See the documentation of MenuManager. You could get the MenuManager via WorkbenchWindow.getMenuManager()
Check this out Menu Contributions. Scroll down for Menus API.
I am pretty new to eclipse. I notice that depending on the Perspective I am in, the new submenu lists different items in it. Is there a way to pick the items it lists (modifying the perspective) just using the eclipse interface? or am I needing to do a plugin of some sort to enable this.
Go to Window >> Customize Perspective
You should be on the Shortcuts tab and should see a dropdown called Submenus:
Make sure you have the "New" submenu selected and from there you can add New shortcuts.