Eclipse e4: add commands to context menu - eclipse

I defined several commands in my Application Model, say like openCommand, saveCommand. And I can add them to the menu bar or tool bar easily. Now I want them to also appear in the context menu of the edit part, how can this be done?
To be short, I want a menu item in main menu, a tool bar item in tool bar and another menu item in context menu. All these three items have the same function and thus should be mapped to the same command. I can do the first two but have no idea about the third.
Any help would be appreciated! Thanks a lot!

You define the context menu for a Part in the Menu section of the Part Descriptor in the application model. Add a 'Popup Menu' and give it a unique id. Add menu items to the popup menu in the normal way.
Tell Eclipse the menu is the context menu for a control using the EMenuService:
#Inject
private EMenuService menuService;
...
menuService.registerContextMenu(control, "menu id");

Related

Different menu item types in Eclipse 4

When I right click on a menu and select Add child, I am presented with several options:
Handled Menu Item
Menu
Direct Menu Item
Dynamic Menu Contribution
VisibleWhen Core Expression
What is the difference between each of these choices?
Handled Menu Item
This is a menu item that uses a command id (and therefore one or more handlers).
Direct Menu Item
This is a menu item where you specify the class to handle the item directly without using a command id.
Menu
This adds a new sub-menu.
Dynamic Menu Contribution
This lets you specify a class that can add multiple menu items dynamically. See here
VisibleWhen Core Expression
This lets you add a 'core expression' to the current menu item to control when it is visible. See the Eclipse help for details of core expressions. Eclipse Oxygen also now supports Imperative Expressions where you can specify a Java class to control the menu visibility.

Eclipse plugin: how to modify the tab context menu

When developing Eclipse RCP application, on the view part, right click on the tab, you can see a context menu with "detached, restore, move, size, minimize, maximize" actions. I was wondering how to add a new action to that tab context menu? What's the correct keyword for this?
Most of results I found is about the general context menu, which is the one you get when right click anywhere in the viewpart. Where what I am looking for is the context menu from the tab.
Or what I should do is set some properties which make the context menu only showing when right click on the tab area.
What I am trying to do is add an option "Duplicate Tab" to context menu.

What menu is called by Alt-Shift-S in Eclipse?

What menu is called by Alt+Shift+S combination in Eclipse? How to call it from main menu? It is mostly resembles Source menu but has some differences.
Source menu
Source menu looks same but not exactly:
It is Source menu. If you do a right click in java editor you can see key combination for it and if you hover over Source you can see it is the same.
About the visual difference: If it is invoked from the main menu, disabled menu items stay visible (but grayed), because you would be very confused if the vertical position of the same menu item changed all the time (depending on how many other menu items above are disabled).
Context menus on the other hand are invoked at arbitrary places of your screen, so you don't notice a certain menu item offset "jumping" relative to the complete context menu. That's why many menu items are not just disabled in the context menu, but set to invisible.
That's the Source menu, Alt + Uppercase S

Joomla!: What do to add links in footer?

I wanted to add some (internal) links to the footer in a custom template,
how should I do this?
I'm very new to Joomla! and I don't know how to do this best.
I couldn't/don't want install plugins, it should simple work with built-in possibilities.
If I understand the question correctly, all you need to so is add a new menu.
Log in to Joomla and select Menu Manager from the Menu menu
Create a new menu
Select the new menu in the Menu menu
Add menu items - internal links or what ever you want
Select Module Manager from Extensions meni
Create new Menu module, select the new menu and the footer position
You should be able to then style the menu accordingly with CSS.

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.