Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » HTML Formatting in Editor ContentAssit
HTML Formatting in Editor ContentAssit [message #299866] Mon, 27 February 2006 11:37 Go to next message
Eclipse UserFriend
Originally posted by: ahmedlazreg.free.fr

Hi,
I have added content assist to my Editor (I'm writing an ASM editor plugin).
I have added some context info using the second constructor of completion
proposal.

public CompletionProposal(String replacementString, int replacementOffset,
int replacementLength, int cursorPosition, Image image, String
displayString, IContextInformation contextInformation, String
additionalProposalInfo)
My info ares stored in the "AdditionnalProposalInfo " (the last param).
They appear correctely in a little window at the right of the selected word
in the proposal list.
My question is : How can I have html formtting of this info ? I tried by
adding html formatting tags but it does not work. The tags are drawn as
normal text.
What I want is to have info window like JDT one, with the keyword written in
bold and its description in normal text.
Any help ?
Best regards
Re: HTML Formatting in Editor ContentAssit [message #299871 is a reply to message #299866] Mon, 27 February 2006 13:33 Go to previous messageGo to next message
Tom Hofmann is currently offline Tom HofmannFriend
Messages: 770
Registered: July 2009
Senior Member
Have your proposals implement ICompletionProposalExtension3 and
implement getInformationControlCreator().

-tom

Ahmed LAZREG wrote:
> Hi,
> I have added content assist to my Editor (I'm writing an ASM editor plugin).
> I have added some context info using the second constructor of completion
> proposal.
>
> public CompletionProposal(String replacementString, int replacementOffset,
> int replacementLength, int cursorPosition, Image image, String
> displayString, IContextInformation contextInformation, String
> additionalProposalInfo)
> My info ares stored in the "AdditionnalProposalInfo " (the last param).
> They appear correctely in a little window at the right of the selected word
> in the proposal list.
> My question is : How can I have html formtting of this info ? I tried by
> adding html formatting tags but it does not work. The tags are drawn as
> normal text.
> What I want is to have info window like JDT one, with the keyword written in
> bold and its description in normal text.
> Any help ?
> Best regards
>
>
Re: HTML Formatting in Editor ContentAssit [message #299873 is a reply to message #299871] Mon, 27 February 2006 13:38 Go to previous messageGo to next message
Tom Hofmann is currently offline Tom HofmannFriend
Messages: 770
Registered: July 2009
Senior Member
Tom Eicher wrote:
> Have your proposals implement ICompletionProposalExtension3 and
> implement getInformationControlCreator().

Oh, and then return an IInformationControl capable of displaying HTML -
for example a copy of jdt-ui's BrowserInformationControl.

-tom
Re: HTML Formatting in Editor ContentAssit [message #299877 is a reply to message #299873] Mon, 27 February 2006 15:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ahmedlazreg.free.fr

Ah ... ok I see. if understand correctely what you mean ....
in the ContentAssistCreator, my code look a bit like this

public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
int offset) {

ICompletionProposal[] result;

String currWord = MPASMTextHoover.getLeftWordPart(viewer.getDocument(),
offset);

List ret= new LinkedList();

for (int i = 0; i < MPASMCodeScanner.fgOpcodes.length; i++) {
if (MPASMCodeScanner.fgOpcodes[i].startsWith(currWord.toLowerCa se()))
ret.add(new CompletionProposal(MPASMCodeScanner.fgOpcodes[i],
offset-currWord.length(), currWord.length(),
MPASMCodeScanner.fgOpcodes[i].length(),
PlatformUI.getWorkbench().getSharedImages().getImage(IShared Images.IMG_OBJS_INFO_TSK),
MPASMCodeScanner.fgOpcodes[i], null, "INFO : " +
MPASMCodeScanner.fgOpcodes[i] ));
}
.....

}



instead of " ICompletionProposal[] result; " I have to write a thing like
" ICompletionProposalExtension3[] result; "
and I have to develop a class that implement the
ICompletionProposalExtension3 and
instead of using the CompletionProposal constructor in the line
.... ret.add(new CompletionProposal(MPASMCodeScanner.fgOpcodes[i],
I will have to use the NewClass that implements the
ICompletionProposalExtension3 interface.
And this NewClass have to retrun a IInformationControl capable of displaying
HTML.

Is that Correct ?

Best regards
A.Lazreg




instead
"Tom Eicher" <eclipse@tom.eicher.name> a
Re: HTML Formatting in Editor ContentAssit [message #299920 is a reply to message #299877] Tue, 28 February 2006 09:24 Go to previous messageGo to next message
Tom Hofmann is currently offline Tom HofmannFriend
Messages: 770
Registered: July 2009
Senior Member
Ahmed LAZREG wrote:
> instead of " ICompletionProposal[] result; " I have to write a thing like
> " ICompletionProposalExtension3[] result; "

You still have to return a result with a declared type of
ICompletionProposal[].

> and I have to develop a class that implement the
> ICompletionProposalExtension3 and
> instead of using the CompletionProposal constructor in the line
> .... ret.add(new CompletionProposal(MPASMCodeScanner.fgOpcodes[i],
> I will have to use the NewClass that implements the
> ICompletionProposalExtension3 interface.
> And this NewClass have to retrun a IInformationControl capable of displaying
> HTML.
>
> Is that Correct ?

Yes.

-t
Re: HTML Formatting in Editor ContentAssit [message #300075 is a reply to message #299920] Wed, 01 March 2006 15:10 Go to previous message
Eclipse UserFriend
Originally posted by: ahmedlazreg.free.fr

Thank you Tom, it worked great :) :) :)
Best regards
"Tom Eicher" <eclipse@tom.eicher.name> a
Previous Topic:CVS line terminator changed when commit
Next Topic:Dev System Configuration (weblogic in debug mode on eclipse/windows)
Goto Forum:
  


Current Time: Fri May 03 20:53:00 GMT 2024

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

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

Back to the top