Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Problem Marker(How to add a tooltip)
Problem Marker [message #506263] Wed, 06 January 2010 17:39 Go to next message
Kitesurfer () is currently offline Kitesurfer ()Friend
Messages: 87
Registered: December 2009
Member
Hello,

I add a problem marker with below code. It shows up on the ProblemView and just left of line 11 via a error-icon.
When I move the mouse over the error-icon I would like a tooltip to show up with the message-text.
How do I do this ?

IMarker marker6 = file.createMarker(IMarker.PROBLEM);
lineNumber = 11;
marker6.setAttribute(IMarker.LINE_NUMBER, lineNumber );
marker6.setAttribute(IMarker.MESSAGE, "Mess 8");
marker6.setAttribute(IMarker.TEXT, "Text 8");
marker3.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
marker6.setAttribute(IMarker.SEVERITY , IMarker.SEVERITY_ERROR);
Re: Problem Marker [message #506943 is a reply to message #506263] Mon, 11 January 2010 12:59 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Kitesurfer wrote:
> Hello,
>
> I add a problem marker with below code. It shows up on the ProblemView
> and just left of line 11 via a error-icon.
> When I move the mouse over the error-icon I would like a tooltip to
> show up with the message-text.
> How do I do this ?
Is this for you own/custom editor?

Dani
>
> IMarker marker6 = file.createMarker(IMarker.PROBLEM);
> lineNumber = 11;
> marker6.setAttribute(IMarker.LINE_NUMBER, lineNumber );
> marker6.setAttribute(IMarker.MESSAGE, "Mess 8");
> marker6.setAttribute(IMarker.TEXT, "Text 8");
> marker3.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
> marker6.setAttribute(IMarker.SEVERITY , IMarker.SEVERITY_ERROR);
>
Re: Problem Marker [message #506987 is a reply to message #506943] Mon, 11 January 2010 11:00 Go to previous messageGo to next message
Kitesurfer () is currently offline Kitesurfer ()Friend
Messages: 87
Registered: December 2009
Member
Dani Megert wrote on Mon, 11 January 2010 07:59
Is this for you own/custom editor?



Yes it is. Do you know how to do it ?
Re: Problem Marker [message #506998 is a reply to message #506987] Mon, 11 January 2010 11:24 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Kitesurfer wrote:
> Dani Megert wrote on Mon, 11 January 2010 07:59
>> Is this for you own/custom editor?
>
>
> Yes it is. Do you know how to do it ?
If you use the Platform Text framework to create your editor then a
mistake could be that you only use/set your plug-ins preference store
into the editor instead of using a combined preference store that also
includes the general text editor store, e.g.:

IPreferenceStore[] stores = new IPreferenceStore[2];
stores[0] = YOUR_PLUGIN.getDefault().getPreferenceStore();
stores[1] = EditorsUI.getPreferenceStore();
setPreferenceStore(new ChainedPreferenceStore(stores));

If that's not the case then I suggest to debug into
org.eclipse.ui.editors.text.TextSourceViewerConfiguration.ge tAnnotationHover(ISourceViewer)
and
org.eclipse.jface.text.source.DefaultAnnotationHover.getHove rInfo(ISourceViewer,
int).

HTH
Dani
Re: Problem Marker [message #507018 is a reply to message #506998] Mon, 11 January 2010 16:59 Go to previous messageGo to next message
Kitesurfer () is currently offline Kitesurfer ()Friend
Messages: 87
Registered: December 2009
Member
When I search my plugin for "Preference" then it finds nothing.
I'll give it a try ... in what file whould I have to enter the code of your previous post.
Re: Problem Marker [message #507096 is a reply to message #507018] Tue, 12 January 2010 02:52 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Kitesurfer wrote:
> When I search my plugin for "Preference" then it finds nothing.
> I'll give it a try ... in what file whould I have to enter the code of
> your previous post.
In your editor. Check for calls to setPreferenceStore(...).

Dani
Re: Problem Marker [message #507255 is a reply to message #507096] Tue, 12 January 2010 16:22 Go to previous messageGo to next message
Kitesurfer () is currently offline Kitesurfer ()Friend
Messages: 87
Registered: December 2009
Member
I added the code (see below) ... and checked via debug if the plugin goes through the code (and it does off course, no errors) ... but still no tooltips.

Perhaps it's not possible to have tooltips on Markers ? ... or did you succeed in it ?


public class XMLEditor extends TextEditor
{
private ColorManager colorManager;
private IEditorInput input;
private EditorContentOutlinePage outlinePage;

public XMLEditor()
{
super();
colorManager = new ColorManager();
setSourceViewerConfiguration(new XMLConfiguration(colorManager));
setDocumentProvider(new XMLDocumentProvider());

IPreferenceStore[] stores = new IPreferenceStore[2];
stores[0] = EditorArticlePlugin.getDefault().getPreferenceStore();
stores[1] = EditorsUI.getPreferenceStore();
setPreferenceStore(new ChainedPreferenceStore(stores));

}
Re: Problem Marker [message #507258 is a reply to message #507255] Tue, 12 January 2010 11:30 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Kitesurfer wrote:
> I added the code (see below) ... and checked via debug if the plugin
> goes through the code (and it does off course, no errors) ... but
> still no tooltips.
>
> Perhaps it's not possible to have tooltips on Markers ? ... or did you
> succeed in it ?
Maybe I misunderstood you: where exactly do you want the tool tip to appear?

Dani
>
>
> public class XMLEditor extends TextEditor
> {
> private ColorManager colorManager;
> private IEditorInput input;
> private EditorContentOutlinePage outlinePage;
>
> public XMLEditor()
> {
> super();
> colorManager = new ColorManager();
> setSourceViewerConfiguration(new XMLConfiguration(colorManager));
> setDocumentProvider(new XMLDocumentProvider());
>
> IPreferenceStore[] stores = new IPreferenceStore[2];
> stores[0] =
> EditorArticlePlugin.getDefault().getPreferenceStore();
> stores[1] = EditorsUI.getPreferenceStore();
> setPreferenceStore(new ChainedPreferenceStore(stores));
>
> }
>
Re: Problem Marker [message #507262 is a reply to message #507258] Tue, 12 January 2010 16:40 Go to previous messageGo to next message
Kitesurfer () is currently offline Kitesurfer ()Friend
Messages: 87
Registered: December 2009
Member
I want it to appear when I move the mouse over a marker in the editor. A marker is a small icon (f.e. an error-icon) just left of the line where the error occurs.
Just as in the Java editor ... when you make a syntax error ... a red icon appears left off the line ... and when you move your mouse over it ... it shows the syntax-error.
Re: Problem Marker [message #507269 is a reply to message #507262] Tue, 12 January 2010 17:12 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Kitesurfer wrote:
> I want it to appear when I move the mouse over a marker in the editor.
> A marker is a small icon (f.e. an error-icon) just left of the line
> where the error occurs.
> Just as in the Java editor ... when you make a syntax error ... a red
> icon appears left off the line ... and when you move your mouse over
> it ... it shows the syntax-error.
OK, then we're on the same page ;-)

It should work as described. The normal text editor also shows that tool
tip e.g. for bookmarks or tasks and it uses the DefaultAnnotationHover
that's configured by the TextSourceViewerConfiguration.

Dani
Previous Topic:Problems loading plugins
Next Topic:Bad right-click behavior with context menus
Goto Forum:
  


Current Time: Thu Apr 25 09:33:35 GMT 2024

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

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

Back to the top