Skip to main content



      Home
Home » Newcomers » Newcomers » How to put hyperlinks in the messages put into the eclipse console view
How to put hyperlinks in the messages put into the eclipse console view [message #266925] Sat, 06 December 2008 01:22 Go to next message
Eclipse UserFriend
Hi,

I want to use the eclipse consolo log view to log messages, when some
operation is executed.
I am able to log into the console view. But i am facing problem is
creating hyper-links in the messages put in console view.

I can create a separate view where i can put hyperlinks but i wanted to
re-use the eclipse console view. The hyperlinks can be used to navigate to
different views and editors.

Can you help me by guiding for "How to put hyperlinks in the messages put
into the eclipse console view" ? Is it possible ?

Thanks and Regards,
Ashwani
Re: How to put hyperlinks in the messages put into the eclipse console view [message #266928 is a reply to message #266925] Sat, 06 December 2008 01:35 Go to previous messageGo to next message
Eclipse UserFriend
Ashwani Kr Sharma wrote:
> Can you help me by guiding for "How to put hyperlinks in the messages
> put into the eclipse console view" ? Is it possible ?

Is the addHyperlink method not working properly for you?
http://help.eclipse.org/stable/nftopic/org.eclipse.platform. doc.isv/reference/api/org/eclipse/ui/console/TextConsole.htm l#addHyperlink(org.eclipse.ui.console.IHyperlink,%20int,%20int)
Re: How to put hyperlinks in the messages put into the eclipse console view [message #266944 is a reply to message #266928] Mon, 08 December 2008 05:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I tried that api. But i dont know how to put the offset.

I think the hyperlink population work like this.
1) put all your text in the cosole and
2) decorate via hyperlick by specifying the offset.
I am facing problem in creating offset. Only way i figured out was the
method console.getDocument().getDocumentLenth().. which returns old value
i.e. before step 1. Hence, i am not able to specify the offset.

Can you any hint, abt how to set the offset.

Thanks and Best Regards,
Ashwani
Re: How to put hyperlinks in the messages put into the eclipse console view [message #266946 is a reply to message #266944] Mon, 08 December 2008 07:50 Go to previous messageGo to next message
Eclipse UserFriend
I don't see what's the problem here.

My old length is ten, I add ten more characters, I want something from
3-5 of that line, so I do 10 + 3 (new offset), and length of two (5 - 3).

You can also consider contributing to the pattern extension point for
adding hyperlinks.

Remy
Re: How to put hyperlinks in the messages put into the eclipse console view [message #266948 is a reply to message #266946] Mon, 08 December 2008 11:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Yes, the logic is pretty simple. The problem was that the console's
document was getting updated in a UIJob asynchrously.
Hence, one has to wait till the document is updated and then decorate the
hyperlink. [ else location where hyperlink has to be populated will never
be correct because it might not exist till than. ]
It is something similar to patterMatcher which gets involed after document
is updated.

But i did it via DocumentEventListener. When the document is udpated
notification is given back where i decorate the hyperlinks.

Thanks a lot for you answers. They were very helpful.

Best Regards,
Ashwani Kr Sharma
Re: How to put hyperlinks in the messages put into the eclipse console view [message #267016 is a reply to message #266948] Wed, 10 December 2008 23:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fastcodejava.gmail.com

I am using FileLink, but I always get BadLocationException.
My code looks like:

offset = this.messageConsole.getDocument().getLength();

messageConsole.addHyperlink(new FileLink(file,
"org.eclipse.jdt.ui.CompilationUnitEditor", 0, 1, 0),
this.offset, file.getName().length());

Thanks in advance,

--Gautam

Ashwani Kr Sharma wrote:
> Hi,
>
> Yes, the logic is pretty simple. The problem was that the console's
> document was getting updated in a UIJob asynchrously.
> Hence, one has to wait till the document is updated and then decorate
> the hyperlink. [ else location where hyperlink has to be populated will
> never be correct because it might not exist till than. ]
> It is something similar to patterMatcher which gets involed after
> document is updated.
>
> But i did it via DocumentEventListener. When the document is udpated
> notification is given back where i decorate the hyperlinks.
>
> Thanks a lot for you answers. They were very helpful.
>
> Best Regards,
> Ashwani Kr Sharma
>
Re: How to put hyperlinks in the messages put into the eclipse console view [message #267018 is a reply to message #267016] Thu, 11 December 2008 01:48 Go to previous message
Eclipse UserFriend
G Gev wrote:
> I am using FileLink, but I always get BadLocationException.
> My code looks like:
>
> offset = this.messageConsole.getDocument().getLength();
>
> messageConsole.addHyperlink(new FileLink(file,
> "org.eclipse.jdt.ui.CompilationUnitEditor", 0, 1, 0),
> this.offset, file.getName().length());

You need to try debugging or rethink how to use this method because the
parameters you're passing it looks incorrect. You should rethink your
offsets. In particular, addHyperlink doesn't add text to the document.

Remy
Previous Topic:Can't start eclipse
Next Topic:MySQL Database access for Eclipse RCP application
Goto Forum:
  


Current Time: Thu Jun 19 11:43:17 EDT 2025

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

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

Back to the top