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.
Related
From the SiteAdmin view, the "Websites" tab in the left-hand navigation pane displays the "Title" attribute from nodes, but sorts according to the "name" attribute. Which file(s) would need to be edited to output the "name" value in that pane instead of "title"?
The script responsible for rendering siteadmin is - /libs/cq/ui/widgets/source/widgets/wcm/SiteAdmin.js
If you look at line number 340, it has configuration like -
The call /bin/wcm/siteadmin/tree.json is handled by SiteAdminTreeServlet which generates the JSON used in rendering the tree (and sorting it). You could overlay this to use your own Servlet that gives the result in the sorted order of field you need (not recommended unless you know the nitty–gritty of this servlet).
If you still want to proceed with the changes you need to do two things -
Add configurations to disable SiteAdminTreeServlet, use OSGI component disable logic to achieve this or you could refer to AEM ACS Commons here
Provide your own implementation as Servlet to handle the requests to the path /bin/wcm/siteadmin/tree and handle json extension explicitly (path based servlet will ignore extensions).
You can try invoking this servlet as http://localhost:4502/bin/wcm/siteadmin/tree.json?path=/content
In CQ/AEM /libs/cq/ui/widgets/source/ext/override/widgets/tree/TreeNodeUI.js script renders the left hand side of siteadmin. You can directly make a minor change in this script to display page name instead of page title in the CQ siteadmin.
Click here to look at the code
CQ.shared.XSS.getXSSValue(n.text.replace(/</g, "<")) should be changed to CQ.shared.XSS.getXSSValue(n.attributes.name.replace(/</g, "<")) at line number 71 in /libs/cq/ui/widgets/source/ext/override/widgets/tree/TreeNodeUI.js and it works great
I've got a Composite inside an Eclipse E4 application, and I'd like it to have the same background color as a default MPart does, according to the theme (which I don't want to be controlling, I just want to consume).
The Composite in question in contained within another Composite with a different background color, so the color cannot be directly inherited.
How can I (programmatically or declaratively) retrieve the CSS background-color styling that applies to an MPart, in order to apply it to my Composite?
The cleanest way to do this is to assign a CSS class to the Composite and style it in the CSS.
Assign the class using:
Composite composite = ....
WidgetElement.setCSSClass(composite, "MyComposite");
You will need to add dependencies on the org.eclipse.e4.ui.css.swt and
org.eclipse.e4.ui.css.core plugins to use WidgetElement. It is also marked as restricted but it is OK to use.
In your CSS you can style it the same as the MPart using:
.MPart,
.MyComposite
{
background-colour: xxxxx;
}
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.
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.
I have to create a table in my wizard page and I want to create it using TableViewer. I'm using WindowBuilderPro for designing my wizard page. The TableViewer control is available in the palette of WindowBuilderPro but I'm not getting how to use it properly.
Has any body used the same?
Thanks a lot in advance!!
You have two ways of filling the TableViewer with contents (similar to TableViewers in JFace):
You can define a content provider and a label provider manually. A content provider has to return a set of Objects, that represent each line of the table; while the TableLabelProvider translates the returned objects to texts in the columns. The content and label providers are to set in the Properties box on the left. In this case, the resulting code should look like the following snippets: http://wiki.eclipse.org/JFaceSnippets#Snippet001TableViewer or http://wiki.eclipse.org/JFaceSnippets#Snippet007FullSelection.
On the other hand you could define JFace Data Bindings to fill the table with contents. In this case you have to define a corresponding binding, that returns the list of all contents; additionally you have to create a label provider, that works similar to the previous one.
There is also a way to fill the table content using a newer API then supported directly by WindowBuilder: you could create TableViewerColumns, and ColumnLabelProviders for each column, thus resulting in much nicer code for Label Providers (and also this API is newer, so it should be preferred for new JFace based code) - but in this case you have to create your code manually. See the JFace Table tutorial from Lars Vogel.
Additionally, if you don't know the JFace Viewer framework from before, I suggest reading the first few questions listed in the JFace FAQ to gain a better understanding of the ideas (and the tutorial from Lars Vogel is also nice for this reason).