Eclipse 4 RCP: What is the difference between Handled ToolItem/Direct ToolItem/Toolcontrol? - eclipse-rcp

When adding a new item to a toolbar, you are given the option to choose Handled ToolItem, Direct ToolItem and Toolcontrol:
What is the difference between these three choices? I can't find the documentation for these anywhere.

'Handled' items are used when you have defined a command id and one or more handlers for the command. In the HandledToolItem you specify the id of the command that is to be executed.
'Direct' items are used when you just want to specify a Java class to be executed without using a command id and separate handler.
Toolcontrol is used when you want to write you own code for the control in the tool bar (something like a Combo for example).

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.

Change content of button on waterfall display

In buildbot's waterfall page, the buttons show the status of each build step. If the step runs, it simply shows 'Ran'. I want to edit this to give better info to the user. Where can I add this change from?
From the documentation of buidlbot 8.12, the keyword parameters of all buildsteps
include:-
description
This will be used to describe the command (on the Waterfall display) while the command is still running. It should be a single imperfect-tense verb, like compiling or testing. The preferred form is a list of short strings, which allows the HTML displays to create narrower columns by emitting a tag between each word. You may also provide a single string.
descriptionDone
This will be used to describe the command once it has finished. A simple noun like compile or tests should be used. Like description, this may either be a list of short strings or a single string.
In the python definitions of your buildsteps, you should set the descriptionDone
keyword parameter to an appropriate description for the completion of each buildstep.

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.

How to handle delete action with a command handler?

I've implemented org.eclipse.ui.edit.delete command handler and I want to invoke it with Edit/Delete main menu item.
As "delete" action is a retargetable action invoking another defined in the context of each edit, editor is usually configured with IActionBars.setGlobalAction(String id, IAction action) where id = "delete" and action is a custom action to be invoked by a retargetable one.
I can see following options:
Create an action that would delegate its execution and state change monitoring to a command
convert convert existing command into an argument for setGlobalAction, probably copying org.eclipse.ui.internal.actions.CommandAction approach.
Remove an existing action from the main menu and insert command contribution item instead
Both ways look too complex/dirty. Am I missing something? Can I use a command instead of action?
EDIT:
It seems that main menu is implemented not with IAction, but with CommandContributionItem. The default command handler invokes CommandAction which in turn queries RetargetAction. "Better" handler for the command can override this behavior.
While I can provide a handler for delete command now, the question is still actual as calling a command from GUI (for example by clicking on a button) is useful and custom commands are not so easy to call (they have no default key bindings or retargetable actions).

Eclipse PDT: show every call of function

Is there an option in Eclipse PDT to show every call of chosen function.
I now if you select some kind of function and hit F3 key you will see a definition of selected function.
Open the Search Menu, Choose 'Search...', and navigate to the PHP tab, then
Enter the method name in the search string text box;
Select Method in the Search for group;
Select References in the Limit to group.
Find method usages http://img217.imageshack.us/img217/83/eclipsepdtfindmethodusa.png
We have a plugin for that... nWire for PHP. It's a comprehensive PHP code analyzer which represents all your code associations, invocations included in one quick and easy to use view. It can also represent the associations graphically.