How to change file/folder resource icons from existing eclipse views - java

I want to change the appearance of project explorer view in eclipse by changing the default file/folder icons for my custom plugin resources. I am aware of Decorators - https://eclipse.org/articles/Article-Decorators/decorators.html , But how can I change the existing icons itself inspite of just putting an overlay or underlay image?
Also I don't want to create a new view , just want to reuse the project explorer with my icons.

The main icon used is taken from the default editor used for the file as defined by the org.eclipse.ui.editors extension point.
If you defining new file types and editors you can specify the icon, but you can't override the icon for existing types and editors.

To modify existing project explorer content first add a org.eclipse.ui.navigator.viewer extension point. Under that add a viewerContentBinding element with the id org.eclipse.ui.navigator.ProjectExplorer (that's the id of the standard Eclipse project explorer view).
Under that add a (includes) with a contentExtension element. The pattern identifies the IDs of navigator content to include and can contain wildcards, e.g. com.example.mycontent.*.
Next define a org.eclipse.ui.navigator.navigatorContent extension point with a navigatorContent element. Make sure the id you provide matches the above pattern. Set the content and label providers. If the content provider implements IPipelinedTreeContentProvider it will allow you to modify existing content (possibly wrapping things like IFolder inside classes your label provider understands). You'll also need to define triggerPoints to identify the items for which your content provider should be called.
It may be useful/necessary to suppress standard navigator content. You can do this by specifying an override element under navigatorContent with the policy InvokeAlwaysRegardlessOfSuppressedExt and id org.eclipse.ui.navigator.resourceContent.

Related

JavaFX: Identical tabs with different data

In Lazarus, there are 2 different kinds of tab elements (cf. Free Pascal docs):
TPageControl
TPageControl is a multi-page component that provides a container to hold a variety of controls per page.
TTabControl
It is a tabbed container component which looks identical to a TPageControl. However, there is a fundamental difference because the control always shows the same page whichever tab is selected. In fact, it containts only a single page. The idea behind this concept is illustrated best by an editor or viewer for text files: When the TabControl contains a TMemo then the individual tabs refer to the files loaded into the memo; whenever the active tab changes another file is loaded into the (same) memo.
In this sense, JavaFX TabPanes are quite similar to TPageControls, but I rather want to replicate a TTabControl. I know I could in fact programmatically create a new Tab(), but I want to visually design it in SceneBuilder.
Is there maybe a way to load a separate .fxml file into a new Tab() element which is then added to the TabPane? (And how could I then access a tab's children?)
I chose the easiest approach: Implementing a head-less TabPane to detect when the user switches between tabs. The elements that appear to the user as the “tab content” are actually placed outside the TabPane, and their content is dynamically changed whenever the tab is switched.

Eclipse RCP ProjectExplorer.refreshLocal() not working for added resource

My RCP app provides content through the CommonNavigator to the ProjectExplorer view. It provides a node whose children are resources which exist in various places on the file system inside the project, similar to how JDT or other toolkits provide a container that provides access to library resources, etc.
When a file is created on the file system inside the project, by a program external to eclipse, I detect it with an IResourceChangeListener and invoke
refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor())
on the resource, and the file appears automatically in the file tree of ProjectExplorer, in the node corresponding to its actual place on the file system. But it doesn't appear under the custom node that I contributed to the CommonNavigator, unless I manually refresh the tree from the UI.
I worked around the problem somewhat by getting a reference to the ProjectExplorer view, and calling refresh() on its CommonViewer instance. The problem with this is that the entire tree is refreshed, collapsing all nodes. But when they're re-expanded the new file shows up in my custom node as desired. I tried calling refresh(theResource) on the CommonViewer, but that has no effect.
Is there any way to cause the file to be added automatically to my custom node when it's created from outside eclipse, just as it's added to its regular place in the file tree?
UPDATE: I implemented an ICommonviewerMapper, which I set on the viewer so that it reports the mapping of model objects to Tree items. With this class I call viewer.refresh(item), where item is the Tree item that the viewer indicated to the mapper is mapped to the model object that I'm updating. In my case, the model object is an IContainer instance to which the ContentProvider adds IFile instances as children (it's one of these files that is being created outside of eclipse, which I want the viewer to show).
So I'm calling viewer.refresh() with the Tree element that is a container to which the ContentProvider will add as a child the file that was created, and still the viewer takes no action. The ContentProvider's getChildren() method is not called after refresh is invoked on the viewer. The viewer seems to be ignoring the invocation of refresh with a Tree item that I know exists in the viewer.

Eclipse PDE, markerAnnotationSpecification - define without icon

I am developing an PDE for Eclipse, i have created annotations via markerAnnotationSpecification (see PDB help). I need those annotations without icon on left side (where breakpoints are), but problem is that when i do not specify icon parameter for my annotation, it will use default icon from symbolicIcon parameter. Currently i am using a bit hacky solution - loading an empty image. Still cursor changes when user targets icon place, which is not desired behavior.
TL;DR; Is there a way remove (do not use) this icon completely?
Here is one of my specification extension point elements
<specification
annotationType="com.xxx.profiler.editor.highlight.highannotation"
colorPreferenceKey="covc_h"
colorPreferenceValue="255,120,120"
highlightPreferenceKey="covh_h"
highlightPreferenceValue="true"
icon="/icons/ph_icon.gif" <!-- empty icon -->
label="High Coverage"
overviewRulerPreferenceKey="covr_h"
overviewRulerPreferenceValue="false"
presentationLayer="1"
textPreferenceKey="covt_h"
textPreferenceValue="false"
textStylePreferenceKey="covs_h"
textStylePreferenceValue="BOX"
verticalRulerPreferenceKey="covv_h"
verticalRulerPreferenceValue="false">
</specification>
//EDIT: I found out that this should be done with verticalRulerPreferenceValue="false" but for some reason, even that it is disabled in annotations preferences, the image is shown at my annotation
OK found the problem. org.eclipse.ui.editors.markerAnnotationSpecification was linked to markerType via org.eclipse.ui.editors.annotationTypes plug-in. In this plug-in i (following tutorial) automatically set parameter super to some value, which covered my settings in markerAnnotationSpecification. After removing inheritance parameter here, everything works as expected.

Adobe CQ - Specify where JCR content is written (exact path)

I am trying to create a dialog that has an xtype of "textfield"...I need to specify that anytime the user updates this field it will always overwrite the same JCR content node.
I am including this component/dialog in multiple pages, so that the author can edit the text. The issue is that the text will be updated for that page. (because I am using a relative path).
What I need to happen...The content is updated and written to a central location so that no matter which page the user edits this text it will always update to a central location.
A real world example:
We have modal dialogs that show throughout the site. Some of these dialogs are global. Out client has requested to have an edit option on any page that these dialogs show. The acceptance criteria is that they can edit on any page and that edit will be applied globally.
My problem is that I am not sure how to set the path that the text field will write to.
I am retrieving the content from here:
<cq:include path="/content/jjj/en/misc/deviceoutmodal/jcr:content/buttontext1" resourceType="zig/components/text"/>
How can I write to the same path?
I think this would be best achieved with design dialogs — you can set a property based on the component (or template), which will then get used by every instance of that component.
The editor can edit the property when in Design mode, (or through the Designer as far as I remember). Design dialogs are created like regular dialogs but named design_dialog.xml. The example use-case that Adobe lists is for a logo component:
The Logo component displays the logo of the website Geometrixx. The
logo image and the home link can be configured globally (same for
every page of the website) so that every instance of this component is
identical. Therefore a design dialog is needed to provide the image
and path of the home link to the design of the corresponding Page. The
Logo component is placed in the upper left corner of all pages on the
website.

how to add image plugin under rteplugins for richtext component

I have a rich text component, I need to configure it in such a way that we can drag and drop the image in the rich text component.For that under rte plugins I have added one plugin called image which is of primary type nt:unstructured having features of String[] and value as *.Even,after adding that above image plugin, Im not able to drag and drop the image.Please let me know what I have done wrong.
Thanks,
Balaji
Due to documentation:
To activate all features for that plugin:
Name features
Type String
Value * (asterisk)
To activate specific features (any not explicitly defined will be deactivated):
Name features
Type String[] (multi-string; set Type to String and click Multi in CRXDE Lite)
Value(s) set to one, or more, feature values
Even if you are only setting one specific value of features you do
have to use String[].
String is only valid when defining features as *.
So if your type is String[], you have to explicitly put the feature name.I suggest you to change String[] to String ("*" in this situation will be ok).This
adds context menu entries for setting some image properties (currently only alignment is supported).
The Richtext Image plugin (and indeed most of the rtePlugins) seems to only be compatible with Mozilla Firefox. Try that browser and see if it works.

Categories