How to display shortcuts in Eclipse menu bar for a menuitem? - eclipse

Using extension points I have created a new menu item in menubar. My requirement is to display the shortcut name along with the menu name. For example, in Help Menu I have added a menuitem as "Tutorial". But I want to display it along with the shortcut say Ctrl+Alt+T. Shortcut is working but need to display the same in the menubar.
How can I achieve this?

High level todo list. In your e4xmi file (model):
add a binding context (BC)
add a binding table (BT) for the Binding context
link your menuitem to a command
in the BT, add a Keybinding (eg M1 +T for Ctrl T), link it to the command
link the BC to your main window (add the BC to the list of Binding context in the Trimmed Window attributes ) (or the artefact where the menu bar is attached)
As the keybinding is linked to a command, everywhere you use the command (menu, toolbar etc.) the shortcut will be displayed

Related

ti 89 copy on custom menu

I have a TI-89 program that creates a custom menu. I want my custom menu to include Copy, Cut, Paste, and Clear Home options, just like you can use in the Home menu under the F1 tools tab. How can these functions be implemented?
menu()
Prgm
setFold(myMenu)
Custom
Title "Tools"
Item "Copy"
Item "Cut"
Item "Paste"
Item "Clear Home"
EndCustm
EndPrgm
There's no supported way to do this. According to the TI-89/92 manual, on page 303:
Note: When the user selects a menu item, the text defined by that Item command is pasted to the current cursor location.
There's no way to create a custom menu which invokes other actions, short of modifying the TI CAS or installing a patch.

Eclipse e4: add commands to context menu

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");

Eclipse, shortcut to create new Java class

Is it possible to assign a shortcut to go automatically on New Java Class Dialog? At the very beginning of a project when I am creating a lot of classes, it's quite annoying have to go through the 'New..' wizard.
Here's the image of the dialog I want to reach.
Select Window -> Preferences -> General -> Keys and search for New (Class). Click on Binding, press the keyboard shortcut you want, and click OK to configure the shortcut.
Press alt+shift+n it will give you a context menu from where you can select new class,package,interface
Ctrl+n will launch new wizard, there you can select the class/any to create new document.
There's an icon (C icon) in the header toolbar for creating class! Its available by default Just click it!
hit alt+shift+N and then click the respective first character for creating
the respective file. For example, let's suppose you want to create a new java class:
Hit alt+shift+N.
Hit c (stands for creating java class).
j (it will highlight the java package).
like this you can use shortcut keys as well as first character of the word what you want to create.
Hope this might help.
You could use Ctrl+3 to open the "Quick Access" Wizard and type in "java class"
on Mac alt(option)+command+N > displays a menu, scroll using arrow keys for appropriate selection and hit Enter.
You can use the New Java Class wizard to create a Java class. It can be invoked in different ways:
By clicking on the File menu and selecting New → Class.
By right clicking in the package explorer and selecting New → Class.
By clicking on the class drop down button and selecting class.
The shortcuts for basic Eclipse file management actions are different between Mac and Windows/Linux environment.
Check it out:
Visit for more Eclipse shortcuts.
First press
ctrl + n and then press c
then press Enter
press ctrl + n
press c (for selecting the class)
press Enter (for creating a class name)
and then class will easily created.

Eclipse shortcut: next item in Content Assist pop-up menu of choices

Is it possible to bind a keyboard shortcut to the action of selecting the next item in a Content Assist pop-up menu of choices?
Desired configuration:
press OPTION / to invoke the Content Assist pop-up menu
press CONTROL N to navigate down the Content Assist pop-up menu items until I highlight the one I want
I know this is possible as I know somebody who can do just that in his Eclipse.. I used it and it worked.
Here's one solution:
In "Preference" - "Keys", find your combination of keys to move cursor one line up/down (search command "Line up"/"Line down"), and set its scope to "In Dialog/Window" to make it work in Content Assist prompt.
Note that this configuration doesn't make it work in all windows. At least, not in "Open Source..." (Ctrl + Shift + R).

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