Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » CustomCompletionProposal(Image)
CustomCompletionProposal [message #691353] Fri, 01 July 2011 09:37 Go to next message
MarcoGT  is currently offline MarcoGT Friend
Messages: 77
Registered: May 2011
Member
Hi all,

in my "extended" content assist I am using my own image to show results inside the box.

The context is "attribute value proposals" but for some values I need to have a different image describing the suggestion...is it possible?

If I do

proposal = new CustomCompletionProposal(...)


I can of course pass only one image...

To provide suggestion I fill proposal object with a for cycle cycling an array containing all my proposals.

I thought it was possible to "update" proposal object doing something proposal += proposal but of course it does not work.

How can I do?

Thanks
Marco
Re: CustomCompletionProposal [message #693642 is a reply to message #691353] Wed, 06 July 2011 23:37 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

On 7/1/2011 5:37 AM, MarcoGT wrote:
> The context is "attribute value proposals" but for some values I need to
> have a different image describing the suggestion...is it possible?

Where are you stuck doing this?

> If I do
>
> proposal = new CustomCompletionProposal(...)
>
>
> I can of course pass only one image...

Yes, you get one image to use for each proposal.

> To provide suggestion I fill proposal object with a for cycle cycling an
> array containing all my proposals.
>
> I thought it was possible to "update" proposal object doing something
> proposal += proposal but of course it does not work.

I think you're going to have to restate this, as I'm unsure exactly what
you're asking.

--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: CustomCompletionProposal [message #693732 is a reply to message #693642] Thu, 07 July 2011 05:55 Go to previous messageGo to next message
MarcoGT  is currently offline MarcoGT Friend
Messages: 77
Registered: May 2011
Member
Ok, I try to explain better.

I evaluate the context, that means in which tag I am, on which attribute and so on.
I build an XPath expression which gives me back results according to context.
These results are inserted into my CustomCompletionProposal and CustomCompletionProposal can accept one image...in for example from XPath expression I get 10 results, that means that proposals for my context, it is possible to have a different image for each proposal?

So, I have an array containing all my results, using a cycle I fill my object CustomCompletionProposal, but image is the same for each entry, is it possible to have different image for every entry?

I do something like:

for(int i = 0; i < results.length(); i ++) {
proposal = new CustomCompletionProposal("\"" + results[i] + "\"",
								contentAssistRequest.getReplacementBeginPosition(),
								contentAssistRequest.getReplacementLength(), results[i].length() + 1, myImage,
								results[i], contextInformation, info,
								XMLRelevanceConstants.R_XML_ATTRIBUTE_VALUE);
}


Array results[] is a String array containing all my results from XPath query that matches context, matchString and so on and so on.
It is similar, not equal, to what has been done for addAttributeNameProposal.

By the way, as far as I know it is not possible to change image for each result...

Hope I explained better Very Happy

Thanks
Marco

[Updated on: Thu, 07 July 2011 06:23]

Report message to a moderator

Re: CustomCompletionProposal [message #693950 is a reply to message #693732] Thu, 07 July 2011 14:23 Go to previous messageGo to next message
Nick Sandonato is currently offline Nick SandonatoFriend
Messages: 126
Registered: July 2009
Senior Member
I hope I'm understanding your problem correctly. It is definitely possible to have a different image for each proposal. Instead of a static use of myImage in the CustomCompletionProposal constructor, you'll want to set up a condition to determine what image to use on each iteration through the loop.
Re: CustomCompletionProposal [message #693993 is a reply to message #691353] Thu, 07 July 2011 15:35 Go to previous message
MarcoGT  is currently offline MarcoGT Friend
Messages: 77
Registered: May 2011
Member
Yes, you are absolutely right.

The problem were somewhere else, but I solved.

Sorry for the silly question Embarrassed
Previous Topic:How to add custom code templates to my plugin?
Next Topic:Search inside Content Outline
Goto Forum:
  


Current Time: Sat Apr 27 03:07:45 GMT 2024

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

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

Back to the top