Eclipse Plug-in - Capture the paste event from mouse popup menu - eclipse-plugin

Recently I have developed a plugin for education purpose. The main functionality of this plug-in is capture the copy & paste action in the editor.
I have used ICommandService class to capture the copy & paste event. It is working successfully in Keyboard shortcuts ( Cntl+V) and eclipse main menu ( Edit--> Paste)
But same is not working while using Mouse Right Click -> Popup Menu -> Paste.
Is there any way to capture the Mouse Popup Menu Selection.
I am using following code to capture the Paste event.
ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command defaultCopyCommand = commandService.getCommand(org.eclipse.ui.IWorkbenchCommandConstants.EDIT_COPY);
Command defaultPasteCommand = commandService.getCommand(org.eclipse.ui.IWorkbenchCommandConstants.EDIT_PASTE);
defaultCopyCommand.addExecutionListener(iel);
defaultPasteCommand.addExecutionListener(iel);
Thanks in Advance.
Updated!!!!
Hi #greg-449, Thanks for your input. Finally used Plugin-Spy to capture the details. Following details are showing when paste operation is called through the Mouse Menu Paste Action Image. I can see the definition identifies is same & it was fire in both Key shortcuts and eclipse main menu option. Also I have noticed that Current active part of editor is "ComplilationUnitEditor" & active menu contributions is #CompilationUnitEdiorContext. Is there any way to capture the CompilationUnitEdiorContext changed event in current workbench window?

Related

Navigating project files in intellij idea

I want to jump through files in the project window using the up / down buttons. Now I press the down button, then press the enter button and the focus goes to the code editor window. But I do not want the focus to go away, I want to continue jumping through the files, pressing the down button and enter when I want to open the file. I can do this using this combination: down arrow, enter, F12, down arrow, down arrow, enter, F12 ...
Is there any way to tweak this to avoid using F12?
I'm using Intellij idea 2020.3
I'd suggest reassigning shortcut combination Main Menu | Window | Active Tool Window | Jump to Last Tool Window to anything more suitable for you, e.g. ESC and be sure that you don't use the same shortcut for other actions and operations.

How to add a Stop icon to NetBeans 8.2

On mac in NetBeans 8.2 I have a panel with a run button.
It's a bit strange to me after Visual Studio that there is no Stop button there. Is there a simple way to add it?
It should do the same as Shift+command+fn+delete or Stop Build/Run
It's a bit tricky to restart it every time to test my changes.
I don't think it is possible to easily do what you want.
The only place the Stop icon/button appears in NetBeans is in the Output window, and that is not available for reuse elsewhere, so NetBean's View > Toolbars > Customize functionality won't be of any use.
However....it is trivial to specify a shortcut key for the action associated with the Run > Stop Build/Run menu entry:
In NetBeans select Tools > Options
Click the Keymap icon. All the actions will be listed, along with their shortcuts.
Type Stop in the Search field to locate the Stop Build/Run action.
For the listed action named Stop Build/Run click the ellipsis and select Edit... from the popup menu.
The cursor will move to the Shortcut field. You can now select any available shortcut. For example, in the screen shot below I pressed the ALT key, and then selected ALT+T from the drop menu of available shortcuts.
Then, you can just submit ALT-T from the keyboard to terminate a running application, instead clicking the Stop button in the Output window, or selecting Run > Stop Build / Run.
I know that you were asking for a toolbar solution, but in the absence of one perhaps a keyboard shortcut is a viable alternative.

Is it possible to view one file in a new window in intellij-idea?

What I actually want to do is to view different files in a some project on different screens.
If they are in different windows, I can easily drag one window to another screen.
It's fine if there are other ways can do this. I'm using windows7.
You can drag the editor tab to another screen and it will open in a separate window. See the Detaching Editor Tabs help section for details.
Shift+F4 does the same:
The shortcut can be changed here:
You have to add a new keyboard shortcut in your keymap.
The action is called Open In New Editor Window
Then when searching for a class using Ctrl + n (go to Class...) or Ctrl + e (recent files)
instead of opening the Class in the same window by pressing Enter
you can open it in a new window using your own keyboard shortcut (Shift + Enter in my case).
Right-click on tab.
Select Move Tab to New Window option.

How to trigger Eclipse-like cmd+click in IntelliJ?

How do i trigger the cmd + click behaviour (Go to Class, go to declaration etc) in IntelliJ when my current keymap uses Eclipse (MacOS)?
I'm currently switching from Eclipse/STS to IntelliJ. So far, i've changed the keymap to use Eclipse (MacOS), so most of the familiar keyboard shortcuts i use still works.
control + click does the functionality that i want using Eclipse (MacOS) keymap but this also triggers system behaviour of right click, so menu pops out the same time that the go to class/variable triggers. Is there a way i can set or use cmd + click to trigger the desired behavior?
Go to Preferences > Keymap.
You have to copy the Eclipse (MacOS) keymap to a new name, in order to make changes: select the Eclipse (MacOS) keymap, press the Copy button and give it a new name, e.g. Eclipse (MacOS) 2.
Then click into the filter field, enter declaration, then in the tree area do right-click on the Main menu > Navigate > Declaration line in order to activate the context menu. The result should look like this:
Select Add Mouse Shortcut from the context menu, a dialog opens. Perform into this dialog the key + click combination you wish to add, in your case cmd + click:
Confirm the new Mouse shortcut with Ok, then close the Preferences dialog also with Ok or Apply. Done.
Note: you can delete the ctrl + click mouse shortcut, if you wish to not use it by mistake, by selecting Remove ^Button1 Click in the context menu.

IntelliJ IDEA - detach editor window

I have recently removed tabs from my IntelliJ setup, because with all the features available to navigate between files, who needs them?
The issue is, the normal way of detaching an editor window would be to drag the tab onto another screen (or area). There doesn't appear to be anything in the key mappings for detaching an editor window. Is there a way of doing this via the keyboard?
The keyboard shortcut your are looking for is SHIFT+F4 (the action assigned to this shortcut is called Open Source in New Window. When you invoke this action the currently opened tab (file) will be opened in new editor window. However the file will remain opened in the main window too, but I believe that this is as close as you can get to the functionality you describe, at least for now.
Option 2
Open the "Open class" dialog using CTRL+N search for a class you want to open in detached window and hit CTRL+SHIFT+ENTER. That will open the class in a new editor window.
Unfortunately this seems to work only for Java classes and not for other files (CTRL+SHIFT+N dialog). I created a bug report for the last problem, so if you think it might be useful, feel free to vote for it.