How can I get a list of already define contextIds for the extension point org.eclipse.ui.bindings? - eclipse

I'd like to bind a new keyboard shortcut to an existing context in my plugin.xml. How can I get a list of all known contextIds?
Specifically, I'm looking for a context ID that will bind the shortcut to the Project Explorer.

If you create a key binding in the plugin.xml editor there is a Browse button on the contextId line that will show you a list of know context ids.

Related

CTRL+N Not invoking new on a DetailsFormTransactions Page

I need CTRL+N to invoke the default behavior, that is to create a new record without invoking my NewButton.
NewRecordAction property is not filled out, the shortcut does nothing, seems to be disabled.
The DataSource on the form allows create, I can create through my NewButton MenuItemButton.
I seem to have lost it's default behavior somehow, what could cause that?
Ctrl-N does not do anything, because the NewRecordAction is not filled out and because there is not a command button with New in the Command property.
I assume you have used "Create form from template" or have copied from the SysBPStyle_TransactionDetails form (same thing). This form contains a botton NewButton which is ment to call a creation form, like the SalesCreateOrder form.
You have two options:
Fill out the NewRecordAction with the control name of your create menu item. This should be mandatory in list pages.
Delete the NewButton, then create a new command button with New in the Command property. Also remember to assign a value to the DataSource property on the control or a containing node.
I personally prefer the second option (maybe combined with a setFocus call) because a create form is then not needed and there is only one form for you to maintain and the user to learn.

Custom content assist for default java editor in Eclipse

I'm currently trying to develop an Eclipse Plugin to support code replacement, like what the default content assist in Eclipse do. What I want to implement is something like "insert argument names automatically on method completion with visualized box around the argument" and I can "use the Tab key to navigate between the inserted names" and "while navigating, list of optional variables for current argument can be displayed and be chosen".
In short, it comes to two questions:
How to add the visualized box around the already existed variable or even Java keywords that need replacement? And at the meanwhile I can use Tab key to switch between these boxes.
How to display a list of candidates to select from when I trigger on the box?
By now I only figure out the extension point : org.eclipse.jdt.ui.javaCompletionProposalComputer may be useful, but I have no idea where to start at? Thanks in advance.
Oh, finally I've solved it myself...
For the 'box', it should be the LinkedModeModel, this class should work with LinkedPositionGroup and LinkedPosition to add mutiple boxes. And we should use LinkedModeUI to set it up.
For the content assistant, there's no need to use the extension point. There is a ProposalPosition class which extends LinkedPosition for you to add your proposals for the 'box' in its constructor. And we can simply use the CompletionProposal to construct a ICompletionProposal array as the argument of ProposalPosition's constructor.

contexts for copy and paste in eclipse for own plugin

I want to use copy and paste within my own view. Therefore I defined commands with a special context and activated it during the creation of the view.
The problem I'm now facing is that copy and paste is workin within my view but no longer within the normal eclipse world.
The context has a parent id into org.eclipse.ui.window.
Any hints how to seperate these contexs right so corresponding action is called at the right time.
I also turned on the key bind tracing within the debug options of org.eclipse.ui.
basic idea: How to override an existing key binding?
http://rcpexperiments.blogspot.de/2009/07/commands-key-bindings-and-contexts-in.html
key tracing: http://eclipsesource.com/blogs/2009/07/08/tip-tracing-keybindings-in-rcp/
You shouldn't need to use a context. You just provide an action handler for the global copy / paste actions:
IActionBars actionBars = getViewSite().getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction);

transfer netbeans made component to lwuit's "Resource Editor"

I tried to use "table" Component in a Form with "Resource Editor" in lwuit, but I could not add/edit the rows items. so I end up with this question:
Is it possible to create/edit the table component in the generated "StateMachine" class in Netbeans and see the result in "Resource Editor"?
And if it's not possible, how can I hack the .res file in order to make the "table" as it should be?
There is support for live embedding in the resource editor but its deprecated and obtuse.
I suggest you just add a label where you want the custom component to be, give it a unique name and override the method createComponentInstance which is invoked internally with the name of the label (name it something unique).
You can then just return the instance of your custom made component and it will appear where the label is in the GUI builder.

Add menu item to Windows context menu only for specific filetype

I've developed an application that load an image using the context menu of window (right click on the file) and for the moment is working, but the reg key is on
HKEY_CLASSES_ROOT\*
and it works with all files.
I want that the menu item on the context menu should be displayed only with .jpg files.
How can I do that? Which registry keys should I use?
Identify the file type (ProgID) for .jpg files
This can be done by checking the default value of HKEY_CLASSES_ROOT\.jpg. It could be anything based on what you've installed, but for the purposes of this example, we'll call it jpegfile, a common default.
Set the context menu item (verb) properties for that file type
You can set per-user context menu items in HKEY_CURRENT_USER\Software\Classes\jpegfile\shell. This key has a list of verbs for the file type. There is a similar key in HKEY_LOCAL_MACHINE\Software\Classes\jpegfile\shell, and these are the system defaults for the file type. You can put a verb key there too, but if the same key exists in HKCU, it will be overridden, so be advised.
Set the command value
The bare minimum key value that needs to be set to get it to work is the default value of the command subkey. You need to set that with the path to your application, like so: HKEY_CURRENT_USER\Software\Classes\jpegfile\shell\open_with_myapp\command would be set to "c:\path\to\myapp.exe" "%1". Now a context menu for .jpg files will have a "open_with_myapp" item which will launch your app when clicked, and pass the file name of the selected file as a parameter. Of course, how your application processes parameters is up to you, so you'd need to set the parameter string to something your app can process.
Set other verb properties
I'd imagine you're probably going to want the context menu item to read something a little more friendly than the key name. You can have the context menu display whatever label you want for your item by setting the default value of that key (open_with_myapp).
That's your basic overview. Definitely check out my answer to this question about associating a file, which has a similar answer:
Create registry entry to associate file extension with application in C++
There's another key on the registry that works independently of user's default programs: HKEY_CLASSES_ROOT\SystemFileAssociations. Since nobody mentioned it on this question... No need to check ProgID before adding the context menu item. Example:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SystemFileAssociations\.mkv\shell\subtitle]
#="Search subtitles..."
[HKEY_CLASSES_ROOT\SystemFileAssociations\.mkv\shell\subtitle\command]
#="\"D:\\Tools\\subsearch.exe\" \"%1\""
Reference: https://learn.microsoft.com/en-us/windows/desktop/shell/app-registration#registering-verbs-and-other-file-association-information
Additional Considerations:
The HKEY_CLASSES_ROOT subtree can be written to but in general is a view formed by merging
HKEY_CURRENT_USER\Software\Classes
file type registration visible to the current user only
HKEY_LOCAL_MACHINE\Software\Classes
globally register a file type on a particular computer
You can register to those classes instead/aswell
The (ProgID) defined verbs have priority over the same ones defined in ...\SystemFileAssociations\ , but are dependent on that particular Application, When that application uninstalls, it would normally delete its registry entry, along with what modifications/additions you may have done under that key. Or if the default (ProgID) is changed, your modifications will no longer be in effect.
The ...\SystemFileAssociations\ registrations are stable even when users change/uninstall the default programs.
Will publish my working solution derived from the previous answer (and one of its author's other answer).
It also adds an icon. I used it for all file types and didn't have administrator's privileges. The subitem * didn't exist in my registry, I created it myself.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\*]
[HKEY_CURRENT_USER\Software\Classes\*\shell]
[HKEY_CURRENT_USER\Software\Classes\*\shell\open_with_notepad_pp]
#="Open with Notepad++"
"icon"="C:\\portable\\npp.7.9\\notepad++.exe"
[HKEY_CURRENT_USER\Software\Classes\*\shell\open_with_notepad_pp\command]
#="\"C:\\portable\\npp.7.9\\notepad++.exe\" \"%1\""
UPDATE
Replace * with something like .svg and only for this extension the menu item will be shown.