how to create a custom IMarker with a custom icon? [message #1067043] |
Fri, 05 July 2013 15:05 |
John Smith Messages: 3 Registered: July 2013 |
Junior Member |
|
|
I understand that the org.eclipse.core.resources.markers extension point will allow me to create a custom marker, which I can then instantiate as follows:
IMarker marker = resource.createMarker("com.my.custom.marker");
marker.setAttribute("myAttribute", "x");
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
marker.setAttribute(IMarker.LOCATION, "1");
marker.setAttribute(IMarker.LINE_NUMBER, 1);
marker.setAttribute(IMarker.DONE, true);
That works great, with the exception that the only "custom" markers I know how to create would be either custom "problem", "bookmark", "task" or "text" markers, which would then inherit the corresponding icons.
My objective is to create markers with custom icons.
Is there a simple way to do accomplish this or would it be a major hack probably not worth the trouble?
|
|
|
|
|
Re: how to create a custom IMarker with a custom icon? [message #1092436 is a reply to message #1074956] |
Thu, 22 August 2013 20:00 |
Kevin Regan Messages: 33 Registered: May 2013 |
Member |
|
|
This may not be the only way to do it, but I added a custom icon to my marker by using the markerAnnotationSpecification extension point:
<extension
id="my.marker"
name="Testing Marker"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.core.resources.textmarker"/>
<persistent value="true"/>
</extension>
<extension
id="my.annotationType"
name="Testing Marker Annotation"
point="org.eclipse.ui.editors.annotationTypes">
<type
markerType="my.marker"
name="my.annotationType">
</type>
</extension>
<extension
point="org.eclipse.ui.editors.markerAnnotationSpecification"
id="my.annotationSpec">
<specification
annotationType="my.annotationType"
includeOnPreferencePage="true"
overviewRulerPreferenceKey="clruler"
label="Testing"
icon="lib/mycustomicon.ico"
overviewRulerPreferenceValue="true"
highlightPreferenceKey="highlight.background"
highlightPreferenceValue="true"
colorPreferenceKey="clcolor"
colorPreferenceValue="0,255,0"
textPreferenceKey="cltext"
textPreferenceValue="true"
presentationLayer="0"
verticalRulerPreferenceKey="clvertical"
verticalRulerPreferenceValue="true"
textStylePreferenceKey="clstyle"
textStylePreferenceValue="BOX">
</specification>
</extension>
Hope this helps.
[Updated on: Thu, 22 August 2013 20:01] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03419 seconds