What determines the order of UI decorators in Eclipse? - eclipse-rcp

I have two string decorators (org.eclipse.ui.decorators extension), both of them are suffixes and I want them to be displayed in a specific order.
I.e. a package should be displayed in the navigator like this:
com.mycorp.mypackage - [READONLY][mysource.xml]
And not so:
com.mycorp.mypackage - [mysource.xml][READONLY]
How can I define their order? Moving them up and down in the Extensions list did not help.

Related

Seperate error messages for required TextFields and DropDownChoices

I'm currently working on a Wicket 6.20 project which already has dozens of pages with TextFields and DropDownChoices. Now the requirement came up to change the default '${label}' is required. message to something more specific, depending on whether a TextField or a DropDownChoice doesn't have a value.
I know I can put Required=My Text in a properties file of the application, but that changes the message for all FormComponents. And specifying the full component path to either the TextFields or the DropDownChoices in the form of myform.mycontainer.mydropdownchoice.Required=My Text isn't feasible, since of course the structure of the Forms can differ on each page.
Ideally I'd like to put something like
org.apache.wicket.markup.html.form.DropDownChoice.Required=Please select a value for '${label}'
org.apache.wicket.markup.html.form.TextField.Required=Please enter a value in '${label}'
in my application's property file, either with or without FQCN.
Is there a way to achieve this with any of the default IStringResourceLoader that come with Wicket?
It is not necessary to provide the complete path to the components. It could be a path with just few parents:
mycontainer.mydropdownchoice.Required=My Text
mydropdownchoice.Required=My Text
If this still is not an option then you can override org.apache.wicket.markup.html.form.FormComponent#reportRequiredError() for any instance or type (e.g. MyDropDownChoice).

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.

Is there a TinyMCE plugin to remove classes from elements?

I want to be able to remove classes from an element within the WYSIWYG editor provided by TinyMCE. I've spent some time looking around for something and haven't had any success. I've already written 4 or 5 plugins to handle different needs, but this seems to be such a basic utility, it must exist and would prefer not to have to write another plugin.
A sample use would be a paragraph that has been assigned a class using the dropdown class selector. I can continue to add classes to the paragraph element, but I can't replace them or remove them. I would like to be able to select an element in the editor and click a button to remove all assigned classes - and I want to be able to confine the function to that element node, not the entire contents (as the Remove Formatting plugin does).
<h4>Here is my headline</h4>
I use the Styles dropdown to add the class .all-caps
<h4 class="all-caps">Here is my headline</h4>
I decide I want that to use the .inverse class instead, so I select from the dropdown and end up with this:
<h4 class="all-caps inverse">Here is my headline</h4>
What I want is this:
<h4 class="inverse">Here is my headline</h4>
A plugin that will either allow me to reassign or remove classes from elements is what I need. Does anyone know of one out there?

Can you use Chosen with dynamically created form elements?

I've created a simple form containing two selectbox elements. I also have a button which dynamically adds these selectboxes at the user's discretion. The selectbox options will be quite long, so I've applied the jQuery Chosen plugin to be more useful.
Everything works fine until a new element is dynamically added using jQuery clone. I am unable to select any options in my new element selectboxes, and they also carry the prior results.
In searching the forum, others have 'reset' Chosen after a selection, by calling: $("#form_field").trigger("liszt:updated"); . I tried this as well, but it will just clear all the selections (which I don't want) and continue to freeze the dropdown action.
Anyone have experience with using Chosen (or any other autocomplete-type selectbox enhancement) with dynamic elements?
Found a solution that works - albeit without using the Chosen plugin.
I changed my dynamically created form elements by replacing the selectboxes with input fields tied to a basic jQueryUI autocomplete plugin. Here is a link to their implementation : http://jqueryui.com/autocomplete/#default.
The main difference is that the select "options" in this case, were listed as the source from which the box would look for autocomplete options. My list was 70 items long, so the initial setup took some time.
The jQuery text was generically as follows:
$("input#search").autocomplete({
source: [item1, item2, item3, item 4, ... item5]);

Listing annotations in a TreeViewer

I have an eclipse plug-in with a search-like function.
The search-like function identifies statements, which fullfill
some conditions and I want to annotate these statements
and show this annotations in a TreeViewer, just like the
SearchView of eclipse.
(How) can I add this annotations to the Model, in order
to show them in the TreeViewer? I want the annotations
to apear in the TreeViewer under the corresponding JavaElement
You do this in your ContentProvider associated with the TreeViewer, you can set the content to anything you like. You can provide the appropriate styled text (instead of plain text) though the content provider.