In Eclipse, how can I view which ui class is active? - eclipse

I know that there is a feature in Eclipse that shows the class name of the active element of the eclipse interface (for example, the class of the element selected with mouse). It is used to debug client plugin extensions, but I don't remember how to call it..
How can I get this feature? Which key combination I can use?
Thanks,
Michele.

You are probably thinking of the Plug-in Spy plug-in. Press Alt+Shift+F1 to see to details about the current selection. Alt+Shift+F2 lets to find out information about menu items.

Related

How do I show all perspectives in my rcp project eclipse perspective bar (coolbar) upon startup?

Upon startup I only have the Open Perspective button and the default perspective that I set in method getInitialWindowPerspectiveId on its right. I want to show all my other perspectives on that coolbar.
Until now i tried:
config.ini file with org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS=id1,id2,id3
plugin_customization.ini with org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS=id1,id2,id3
in class ApplicationWorkbenchAdvisor in the initialize method someone said to do this:
PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.PERSPECTIVE_BAR_EXTRAS,"id1,id2,id3");
PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.PERSPECTIVE_BAR_EXTRAS,"id1,id2,id3");
Nothing worked.
However i found a workaround:
in class ApplicationWorkbenchWindowAdvisor in the postWindowOpen i manually show all my perspectives. This leaves them opened in the coolbar. However this is not the optimum way and maybe someone knows the proper way to show all my perspective shortcuts on the coolbar.
PlatformUI.getWorkbench().showPerspective("id1", getWindowConfigurer().getWindow());
PlatformUI.getWorkbench().showPerspective("id2", getWindowConfigurer().getWindow());
PlatformUI.getWorkbench().showPerspective("id3", getWindowConfigurer().getWindow());
Thanks
The 'plugin_customization.ini' method should work
The 'plugin_customization.ini' file must be in your RCP plugin
The 'plugin_customization.ini' must be included in the build in the 'build.properties' file.

Key binding to popup menu item in eclipse Helios?

In our project at work, they have written one plug-in for eclipse helios. They have used the
objectContribution for adding the popups and written respective action classes for them.
I am trying to add the shortcut key for one of the popup menu item in project explorer.
But I read here http://www.eclipse.org/forums/index.php/mv/tree/172398/#page_top that there is no way to call key bindings from objectContribution and need to migrate it to handlers/commands.
Is there any other way to bind keys to popups instead of migrate them to handlers?
Thanks in advance!!
No, objectContributions cannot accept keybindings. From legacy action extension points, only actionSets accept keybindings correctly.
The other option available (as mentioned) is to provide a handler for the command you want. The handler won't interfere with the objectContribution behaviour (the objectContribution action delegate class will still be called directly from the menu item, the handler would be called when using a keybinding).
PW

Activate the activator class

I am using eclipse 3.6. I created one sample plugin application. It is neither a eclipse rcp nor workbench. Now when I run the eclipse I want that plugin also to be loaded. But I dont want to use IStartUp. Because what I have found out is
IStartup will be called after the workbench is loaded. I want to refresh some menu. So Is there any way to activate my plugin while the eclipse loaded?
I tried to use Bundle Activation policy. But that is also not activating my Activator class. I just put one System.out. println("Inside start()"). So that is not called. Now can I make it activate my activator?
EDIT:
what my exact requirement is, I have created one workbench application.It is not eclipse rcp application. Now I want to remove the following menu and menu items from the eclipse before the eclipe is loaded.
1. File Menu
2.) Search Menu
3.)Run Menu
4.)Help->search,Dynamic Help,Key assist,Tips and trick,Report Bug,Cheat Sheet.
These menus are inbuilt menu of eclipse. So that is the reason I have to do in this way.
So I already implemented by using startup extension point. But the early startup is called after the eclipse is started.So I need to do some refreshment on the workbench.Then only the menu item will get removed.So I thought I need startup extension point will not satisfy my requirement as it doesnot refresh the workbench.I need to activate the my plugin and refresh the workbench before it is loaded.
Thanks
Bhanu
You can set the needed start level for your plugin using touch point instruction.
You are just a plugin that expects to run in the Eclipse IDE?
Then the answer is, you cannot do what you want.
If you start before the workbench has finished initializing, most of the services that could be used won't work: The workbench itself, menu service, command service, etc.
For most plugins in eclipse, the plugin.xml should be used to add menus, views, editors, etc to eclipse. When necessary, the framework will instantiate them.
org.eclipse.ui.IStartup is available and as you mentioned it will be called after the workbench has been initialized, but before any windows have been shown. It's not to be used lightly, and not by plugins contributing to the UI as it allows all extension from that plugin to be loaded.
EDIT:
If you are an RCP app, you control the main menu. As an RCP app, you have access to the ActionBarAdvisor, WorkbenchAdvisor, WorkbenchWindowAdvisor, which all have lifecycle methods.
If you are an an eclipse plugin, you can add to the main menu ... you cannot easily remove from the main menu. This is by design. Start levels and org.eclipse.ui.startup are 2 mechanisms that won't do what you want.
You still need to answer these questions:
There might still be a way. The crux of your problem is: "I want to refresh some menu"
What kind of menu (popup, main menu,
compound list of menu items in a
menu, etc)?
Where is the menu contribution coming from?
Which specific menu item is it?
Please edit your question (do not comment) and include the information from the above 3 questions, please.

how to access package explorer element in eclipse plugin

i am making an eclipse plugin which make a ui on right clicking a project in eclipse workspce . the ui contains text fields , package explorer for the current project and directory explorer for current project.
i have successfully made a ui which appears on clicking a menu item on right clicking the project but it seems i can't make any jface or swt ui since they are not visible when we are using eclipse command hadlers .so in order to overcome it i made dialog pages but they have limited dialog like directorty dialog and file dialog and that too for entire window directory..... but i want package explorer and directory explorer for the project i just chose like it happens when u try making a new class in a project the browse buttons just show packages and directory struture w.r.t to current selection
am i doin things wrong or is there a way out please suggest .....
It seems a bit unclear to me, what the 'UI' is about. If you plan to embed the package and directory views inside a dialog next to each other, then I think you have to build similar lists on your own, since they are views with their own event logic. But if you plan to use them via the browse buttons as describes, take a look at this page. It gives a good overview of the available selection dialogs in eclipse.
It is also always a good practice to search for code in eclipse that does nearly the same you want to do.
As an example, take a look at the new class wizard from the jdt.ui plug-in (This is the wizard you mentioned in your question): Press Cmd-Shift-T and begin typing 'newclass' and open NewClassWizardPage from org.eclipse.jdt.ui.wizards. This works as expected if you imported all jdt plug-ins as (binary) projects.
Take a look at the createControl method and dive into the createXXXControls methods via F3 and try to find out how JDT is doing the job.
As an alternative, open the desired selection dialog class (again with Cmd-Shift-T) and open the call hierarchy of that class...

Open Implementation (type hierarchy) functionality in NetBeans?

When I have Java code like this:
someInterface.someMethod();
how do I get Netbeans to show me which classes have implementations of someMethod() (not the interface).
In Eclipse this is done with Ctrl+T, but pressing Ctrl+T on the method did nothing in Netbeans 6.5 and I can't where the type hierarchy functionality is in Netbeans 6.5.
Thanks.
I find that Ctrl+Alt+B works perfectly. :)
This functionality already exists in Netbeans: Alt+F7, check 'Find All Subtypes', and click OK. Thanks to tkellerer for pointing this out on the Netbeans forums
http://forums.netbeans.org/viewtopic.php?p=49638#49638
This is widely overlooked functionality in Netbeans, perhaps because there is no key binding for it, so I've changed my enhancement request to add a key binding for the sequence "Alt+F7, check 'Find All Subtypes', and click OK"?
To get a hierarchy similar to the type hierarchy in Eclipse, right click on the class name, select Navigate, and then Inspect Hierarchy. The keyboard shortcut for this is ALT+SHIFT+F12. By default, it shows you parents of the selected class or interface. However, you can view descendants by using the Filters at the bottom left side. I believe the Show Subtype Hierarchy filter (also toggled by using CTRL+B) is what you want.
This is accurate in NetBeans 6.7.1. I'm going to assume it is similar in 6.5.
It turns out that there is no comparable functionality in Netbeans. You can read about it here:
http://forums.netbeans.org/viewtopic.php?p=49355#49355
I've also filed an enhancement request here, which you can vote for:
http://www.netbeans.org/issues/show_bug.cgi?id=172830
If you want to see this added to Netbeans please vote for it.
Hey, someone has implemented a module to do this, and it works in Netbeans 6.5.1 - perfect for you. I'm hanging out to see an equivalent for 6.7.1. Maybe they should add it to 6.8!
http://wiki.netbeans.org/JavaGoToImplementation
Go To Implementation is built in for recent versions of NetBeans. Look in the Navigate context menu.