Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 347349

Summary: DirectEditing proposals list shows wrong labels when using new scheme with IProposal
Product: [Modeling] Graphiti Reporter: Dobrou Mising name <dobrou>
Component: CoreAssignee: Project Inbox <graphiti-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: christian.brand, matthias.gorning, michael.wenz
Version: 0.8.0Flags: michael.wenz: iplog+
michael.wenz: juno+
Target Milestone: 0.9.0   
Hardware: All   
OS: All   
Whiteboard: Juno M1 Theme_bugs

Description Dobrou Mising name CLA 2011-05-26 13:09:42 EDT
Build Identifier: 0.8.0RC1-201105171213

With this bug, it's impossible to show some additional details in proposals list. There is shown exactly the text that would be set after selecting given proposal.



After implementing org.eclipse.graphiti.func.IProposalSupport.getValueProposals(String, int, IDirectEditingContext) , list proposing possible values in editor should show org.eclipse.graphiti.func.IProposal.getText() for every IProposal.

Instead of IProposal.getText() for every proposal, values returned from org.eclipse.graphiti.func.IProposalSupport.completeValue(String, int, IProposal, IDirectEditingContext) for every proposal is shown.

Simple fix is to change line 59 in 
org.eclipse.graphiti.ui.internal.parts.directedit.ContentProposalProvider
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.gmp/org.eclipse.gmp.graphiti/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/parts/directedit/ContentProposalProvider.java?view=markup&root=Modeling_Project

from

 proposals[i] = new ContentProposal(directEditHolder, position, contents, null, valueProposals[i], null);

to

 proposals[i] = new ContentProposal(directEditHolder, position, contents, valueProposals[i].getText(), valueProposals[i], null);





Reproducible: Always
Comment 1 Christian Brand CLA 2011-05-31 07:08:15 EDT
To have the value to be set in your diagram (text GA) be independent of the proposal texts, you can implement your own ProposalSupport. Your class can extend AbstractProposalSupport. The method to decide about the text value to be set is setValue(). There you receive the current text value, the proposal object as well as the context. At this point nearly everything is possible.
Comment 2 Dobrou Mising name CLA 2011-05-31 08:14:46 EDT
(In reply to comment #1)
> To have the value to be set in your diagram (text GA) be independent of the
> proposal texts, you can implement your own ProposalSupport. Your class can
> extend AbstractProposalSupport. The method to decide about the text value to be
> set is setValue(). There you receive the current text value, the proposal
> object as well as the context. At this point nearly everything is possible.

I'm talking about little different problem.
I will try to explain it more.

I use scenario with ProposalSupport implented as extended AbstractProposalSupport.
I have direct edit text box.
With populated proposals list.
I would like to show proposals labels in list, and after selecting proposal set text in text box different from proposal label (set text in text box, not in diagram elements, after accepting proposal, we are still editing text box!).

Expected behaviour, as I understand, should be:
When proposal from list is selected and accepted, result of completeValue(...) is set as text box value.
After that, I can edit text in text box if I want. Then when value in text box is accepted, setValue(...) changes values in diagram elements.


So I cannot use setValue to correct this bug, because setValue is called after accepting value in text box and it is not called after accepting proposal from proposals list.


Problem is, that in current Graphiti, value from completeValue(...) is used as label for every proposal in proposals list. Here I expect IProposal.getText() should be used as label, but it is not used at all. (completeValue(...) is used as label, because ContentProposal label is set to null, where I suggested to use IProposal.getText(), in previous post).
Comment 3 Matthias Gorning CLA 2011-06-16 06:37:21 EDT
Fixed as proposed in the bug description.
Comment 4 Michael Wenz CLA 2012-04-13 03:33:42 EDT
Bookkeeping
Comment 5 Michael Wenz CLA 2012-05-09 08:09:13 EDT
Relevant for IP log
Comment 6 Michael Wenz CLA 2012-06-28 10:35:58 EDT
Part of Graphiti 0.9.0 (Eclipse Juno)