Can an eclipse view contribute to the application menu? - eclipse

I'm creating a simple eclipse application which will contain only views. I've chosen to use only views so users can arrange and stack their views however they like (since editors and views cannot be stacked together). There also isn't any need for a traditional "editor" and I don't want the editor space always showing. But, enough about my decision to use only views.
I was wondering if there is a way for a view to contribute to the main menu for the application? For example, can switching views cause the main application menu to change?

You can use the org.eclipse.ui.menus extension point and set your command to only be visible when the view is active.

Related

How to create different NSMenu for same application, according to different windows?

As the main menu is same in an application, the same menu appears in every case. How can we have different menus depending on which window is active?

Eclipse: Separate window for Console and Outline, which don't come up when main Window gets Focus

I'm using Eclipse Indigo Service Release 1 on two screens. I have the main window with editor and navigator on the main screen, while outline and console are in two separate windows on the second screen.
When I focus the main window, the two separate also come up. And this is the point: I want to focus the two separate windows manually, when I need them.
Is there a way to do this?
You can't do it with simple "detached" views like you're describing. But you can use Window > New Window to open a second Eclipse Workbench window, drag that to your second monitor, then configure it with whatever Views as you please. The two windows are focused independently (at least on OS X they are, I don't have Windows or Linux to test with).
No. Those are dependent palette windows, their focus is tied to the main window.
What you can do: Copy your perspective, close the two views in the copy and switch between the perspectives when you need or want to hide the separate views.
That's how I do it. Two perspectives, one compact when I need the second screen completely, one verbose when I concentrate on the code alone.

Eclipse toolbar with multiple rows

In my RCP app, I contribute several items to the main toolbar. The easy question now is: How do I make Eclipse lay them out so that they appear in a second row, just under the normal toolbar? Or can I add an additional toolbar that appears just under the main bar? Right now, they just appear somewhere between the other items contributed by other plugins. I tried a lot of stuff and searched a long time, couldn't find any answer though.
I'm afraid the main eclipse toolbar is beyond programatic control, it is entirely up to the user how he arranges the items. I've tried similar to arrange perspective buttons with no success.

How to open an eclipse view to Right Side Only

I have an eclipse view and whenever I open that view, I want it to default open in Right Side of the eclipse.
How to make this possible
while being in an eclipse perspective place the views in the locations you want. After exiting and reopening eclipse the views will remain in the positions you placed them in the respective perspective.
If you want to programatically position your view, right away when it is opened for the first time, you can create your own perspective, adn in that perspective you either include the view in the desired location, or you include a placeholder to define where the view should appear as soon as it's opened. See API for org.eclipse.ui.IPageLayout, method addPlaceholder.
If you don't create your own perspective, you may not be able to influence where your view is initially positioned. You can only manually position the view after it had been opened, and Eclipse will then remember this location in the workspace.

Remove view name from Eclipse menu Window -> Show View

I need to remove the name/shortcut of the view which I have created from the Window->Show View menu and add them as a separate menu.
Is there any way to hide/remove its entry from Window->Show View menu.
You can add/remove any view from the "Show View" menu from the Customize Perspective / Menu Visibility tab:
To do the same thing programmatically would imply to follow the same course of action than the class org.eclipse.ui.internal.dialogs.CustomizePerspectiveDialog, and look into the method okPressed() for instance:
perspective.setShowViewActionIds(menu.getCheckedItemIds());
Vlad Ilie mentions in the comments:
as I only needed for the View to be completely inaccessible via usual GUI, activities were enough for me as per this blog post "eEclipse Activities – Hide / Display certain UI elements":
This would mean that programmatically the WorkbenchActivitySupport.setEnabledActivityIds(String[]) method can be used to enable or disable views after they've been introduced into an activity.
I would suggest you to go to window->Preferences or customize perspective. I think this is place from where we can controls the menu's to be displayed.