Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359548 - ConfigurableCompletionProposal: Provide access to the EObject in additionalProposalInfo
Summary: ConfigurableCompletionProposal: Provide access to the EObject in additionalPr...
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: v2.4.3
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-30 06:48 EDT by Karsten Thoms CLA
Modified: 2017-10-31 11:17 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2011-09-30 06:48:30 EDT
It is not possible to access the EObject that might be stored in field additionalProposalInfo. The getters getAdditionalProposalInfo() either return the string representation or hover information.

Access to the object might be necessary to decide the priority of proposals for a cross reference (IContentProposalPriorities) depending on the type of object.
Comment 1 Michael Vorburger CLA 2013-09-03 14:05:12 EDT
+1 yup... I just ran into the same problem and was about to open an issue and found this.

I'm currently working around this via a https://github.com/vorburger/efactory/blob/15f22d91ae3d64c9a97f9af6120549ef50e7ebed/com.googlecode.efactory.ui/src/com/googlecode/efactory/ui/contentassist/ConfigurableCompletionProposal2.java and then using that via:

	@Override
	protected ConfigurableCompletionProposal doCreateProposal(String proposal, StyledString displayString, Image image, int replacementOffset, int replacementLength) {
		return new ConfigurableCompletionProposal2(proposal, replacementOffset, replacementLength, proposal.length(), image, displayString, null, null);
	}

in my *ProposalProvider, but that's not very nice, of course.
Comment 2 Michael Vorburger CLA 2013-09-03 14:07:05 EDT
PS: I would simply provide access to the Object (not EObject) in additionalProposalInfo, note my Object getAdditionalTypedProposalObject() - this would be more consistent with the fact that setAdditionalProposalInfo() takes a java.lang.Object and not an EObject arg.
Comment 3 Sebastian Zarnekow CLA 2013-09-03 14:22:46 EDT
Since 2.4.3, you may use 

/**
	 * Used to store arbitrary data as a protocol between two or more clients unknown to this class.
	 * 
	 * @since 2.4
	 */
	public void setAdditionalData(String key, Object additionalData) {
		if (this.additionalData == null)
			this.additionalData = newHashMap();
		this.additionalData.put(key, additionalData);
	}
	
	/**
	 * Used to store arbitrary data as a protocol between two or more clients unknown to this class.
	 * 
	 * @since 2.4
	 */
	public Object getAdditionalData(String key) {
		return additionalData != null ? additionalData.get(key) : null;
	}
Comment 4 Sven Efftinge CLA 2013-09-04 01:48:26 EDT
see comment #3
Comment 5 Eclipse Webmaster CLA 2017-10-31 11:06:28 EDT
Requested via bug 522520.

-M.
Comment 6 Eclipse Webmaster CLA 2017-10-31 11:17:52 EDT
Requested via bug 522520.

-M.