Content Proposal description with HTML render [message #332802] |
Mon, 10 November 2008 15:18 |
Jean-François Garreau Messages: 5 Registered: July 2009 |
Junior Member |
|
|
Hello, I have a problem using the IContentProposalProvider. I don't how to
have html render in description area...
That I want to do is like content assit we have in eclipse when pressed
CTRL+Space.
* I want to have icon (I understand how to do this -> redefine the label
provider)
* I want a more presized description -> the getDescription method of
IContentProposal is good but I want a description like we have in javaDoc
view with html content... (here is my problem) Despite I use <B> or <BR>
... etc, I have "<B>" ... show in the description area.
* I want that a click on description focus me on this area (not close it).
I don't if I'm right to use Content Proposal...?
Here an example of the code I use :
char[] autoActivationCharacters = new char[] { '#', '(' };
KeyStroke keyStroke;
try {
keyStroke = KeyStroke.getInstance("Ctrl+Space");
IContentProposalProvider proposalProvider = new
IContentProposalProvider() {
private String[] values = { "abc", "toto", "titi", "tata",
"tutu" };
public IContentProposal[] getProposals(String contents,
int position) {
IContentProposal[] proposals = new IContentProposal[values.length];
for (int i = 0; i < values.length; i++) {
final String val = values[i];
proposals[i] = new IContentProposal() {
public String getContent() {
return val;
}
public String getLabel() {
return "A label " + val;
}
public String getDescription() {
return MessageFormat.format(
"{0} this is an <b>example</b> ",
new Object[] { val });
}
public int getCursorPosition() {
return val.length();
}
};
}
return proposals;
}
};
ContentProposalAdapter adapter = new ContentProposalAdapter(text,
new TextContentAdapter(),
proposalProvider, keyStroke, autoActivationCharacters);
} catch (ParseException e) {
e.printStackTrace();
}
When I launch my application in description, I just have "toto this is an
<b>example</b>" ...
Could someone help me ?
|
|
|
|
Powered by
FUDForum. Page generated in 0.02841 seconds