Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Can't get marker hover text to appear
Can't get marker hover text to appear [message #323321] Tue, 18 December 2007 08:57 Go to next message
Eclipse UserFriend
Originally posted by: Michael.Grant.bbc.co.initials-of-the-united-kingdom

I am developing an Eclipse editor for which I have been using annotations
to
mark errors. I would like to switch to using markers instead, to gain the
advantages of my errors appearing in the problem view, error decorations in
the package explorer, and extensibility to autocorrection. However, when I
migrated my code, I found the marker text was no longer appearing as hover
text
above either the error itself or the error marker in the margin.

The book I am using, "Eclipse: Building Commercial-Quality Plug-ins" (2nd
edition) does not mention hover text for markers, and I haven't been able
to
find any helpful information googling either -- bar, from
http://dev.eclipse.org/newslists/news.eclipse.platform/msg55 759.html,
a suggestion that this behaviour should have been supported since v. 3.1.2.
(I am using Eclipse v. 3.3.1.1.)

I have reproduced the file in a simple plug-in based on a cut-down version
of
one of the PDE autogenerated products. The marker generation code is as
follows:

private static final String MARKER_ID = Activator.PLUGIN_ID +
".errormarker";

try {
IMarker marker
= ((IFile) XMLEditor.editor.getSite().getWorkbenchWindow()
.getActivePage().getActiveEditor().getEditorInput()
.getAdapter(IFile.class))
.createMarker (MARKER_ID);
marker.setAttribute(IMarker.MESSAGE, "Foo!");
marker.setAttribute(IMarker.CHAR_START, 0);
marker.setAttribute(IMarker.CHAR_END, 1);
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);

My plugin.xml file in full reads:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.ui.editors">
<editor
name="Sample XML Editor"
extensions="gsm"
icon="icons/sample.gif"

contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor "
class="test.editors.XMLEditor"
id="test.editors.XMLEditor">
</editor>
</extension>

<extension id="errormarker"
name="XML error marker"
point="org.eclipse.core.resources.markers">
<super type="org.eclipse.core.resources.problemmarker"/>
<super type="org.eclipse.core.resources.textmarker"/>
<persistent value="false" /> <!-- Pro tem... -->
</extension>
</plugin>

The plug-in in its entirety, should you wish to consult it, is available at
ftp://ftp.bbc.co.uk/incoming/michael_grant.zip. (Total download size:
6226
bytes. :o) ) A marker may be generated by it by opening a file with a
gsm
extension, and double-clicking on its contents.

Any help would be appreciated.

--
Michael Grant
Senior Software Engineer, Interactive TV
BBC Future Media & Technology
Re: Can't get marker hover text to appear [message #323342 is a reply to message #323321] Tue, 18 December 2007 10:19 Go to previous messageGo to next message
Eclipse UserFriend
I'm working along the lines presented in:
http://www.eclipse.org/eclipse/platform-text/eclipseCon/talk .pdf

I guess I have to implemnt some code that will get the error/warning markers for a certain line number.
Let's keep each other posted till we get it to work:-)


Maarten
Re: Can't get marker hover text to appear [message #323358 is a reply to message #323321] Tue, 18 December 2007 12:30 Go to previous messageGo to next message
Eclipse UserFriend
Michael Grant wrote:

> I am developing an Eclipse editor for which I have been using
> annotations to
> mark errors. I would like to switch to using markers instead, to gain
> the
> advantages of my errors appearing in the problem view, error
> decorations in
> the package explorer, and extensibility to autocorrection. However,
> when I
> migrated my code, I found the marker text was no longer appearing as
> hover text
> above either the error itself or the error marker in the margin.

Did you define the org.eclipse.ui.editors.markerAnnotationSpecification
extension for your marker?

Dani

>
> The book I am using, "Eclipse: Building Commercial-Quality Plug-ins" (2nd
> edition) does not mention hover text for markers, and I haven't been
> able to find any helpful information googling either -- bar, from
> http://dev.eclipse.org/newslists/news.eclipse.platform/msg55 759.html,
> a suggestion that this behaviour should have been supported since v.
> 3.1.2.
> (I am using Eclipse v. 3.3.1.1.)
>
> I have reproduced the file in a simple plug-in based on a cut-down
> version of one of the PDE autogenerated products. The marker
> generation code is as follows:
>
> private static final String MARKER_ID = Activator.PLUGIN_ID +
> ".errormarker";
>
> try {
> IMarker marker = ((IFile)
> XMLEditor.editor.getSite().getWorkbenchWindow()
> .getActivePage().getActiveEditor().getEditorInput()
> .getAdapter(IFile.class))
> .createMarker (MARKER_ID);
> marker.setAttribute(IMarker.MESSAGE, "Foo!");
> marker.setAttribute(IMarker.CHAR_START, 0);
> marker.setAttribute(IMarker.CHAR_END, 1);
> marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
>
> My plugin.xml file in full reads:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <?eclipse version="3.2"?>
> <plugin>
> <extension
> point="org.eclipse.ui.editors">
> <editor
> name="Sample XML Editor"
> extensions="gsm"
> icon="icons/sample.gif"
>
> contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor "
>
> class="test.editors.XMLEditor"
> id="test.editors.XMLEditor">
> </editor>
> </extension>
>
> <extension id="errormarker"
> name="XML error marker"
> point="org.eclipse.core.resources.markers">
> <super type="org.eclipse.core.resources.problemmarker"/>
> <super type="org.eclipse.core.resources.textmarker"/>
> <persistent value="false" /> <!-- Pro tem... -->
> </extension>
> </plugin>
>
> The plug-in in its entirety, should you wish to consult it, is
> available at
> ftp://ftp.bbc.co.uk/incoming/michael_grant.zip. (Total download size:
> 6226 bytes. :o) ) A marker may be generated by it by opening a file
> with a gsm extension, and double-clicking on its contents.
>
> Any help would be appreciated.
>
> --
> Michael Grant
> Senior Software Engineer, Interactive TV
> BBC Future Media & Technology
>
Re: Can't get marker hover text to appear [message #323383 is a reply to message #323321] Wed, 19 December 2007 03:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: valere.fedronic.ext.streamezzo.com

I think you just have to add the following code in your source viewer
configuration :

@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String
contentType)
{
return new DefaultTextHover(sourceViewer);
}



Valère.
Re: Can't get marker hover text to appear [message #323401 is a reply to message #323358] Wed, 19 December 2007 10:34 Go to previous message
Eclipse UserFriend
Originally posted by: michael.grant.bbc.co.initials-of-united-kingdom

Daniel Megert wrote:
> Michael Grant wrote:

>> I am developing an Eclipse editor for which I have been using
>> annotations to
>> mark errors. I would like to switch to using markers instead, to gain
>> the
>> advantages of my errors appearing in the problem view, error
>> decorations in
>> the package explorer, and extensibility to autocorrection. However,
>> when I
>> migrated my code, I found the marker text was no longer appearing as
>> hover text
>> above either the error itself or the error marker in the margin.
>
> Did you define the org.eclipse.ui.editors.markerAnnotationSpecification
> extension for your marker?

No. I had that there when I was using annotations. I've now put it
back, as follows:

<extension point="org.eclipse.ui.editors.markerAnnotationSpecification ">
<specification annotationType="test.editors.errormarker"
[...]
/>
</extension>

I also put in the following:

<extension point="org.eclipse.ui.editors.annotationTypes">
<type name="test.editors.errormarker"
super="org.eclipse.ui.workbench.texteditor.error"
markerType="errormarker"
markerSeverity="2"/>
</extension>

But now the marker doesn't appear at all!

I have to confess, I'm floundering around a little here. When I was using
Annotations, I referenced the annotation type as defined in plugin.xml when
I was creating the annotation, like so:

public static final String
ERROR_ANNOTATION_TYPE= "test.editors.error",

Annotation annotation = new Annotation(annotationType, false, text);

When I create my marker, I am doing similar:

private static final String MARKER_ID = Activator.PLUGIN_ID +
".errormarker";

IMarker marker =
[...]
.createMarker (MARKER_ID);

But as I said, the hover text does not appear for the marker, and
since I put what you suggested in, the marker itself does not appear
either. What am I doing wrong?

--
Michael Grant
Senior Software Engineer, Interactive TV
BBC Future Media & Technology
Previous Topic:Tree/TreeViewer expand Item
Next Topic:Complex sequence of builders aborts mid-way with no errors
Goto Forum:
  


Current Time: Wed May 07 16:22:39 EDT 2025

Powered by FUDForum. Page generated in 0.04020 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top