Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 401611 - [Commands] request: convert parameter value back to Object
Summary: [Commands] request: convert parameter value back to Object
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 4.3 M6   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-24 03:31 EST by Kirill Zotkin CLA
Modified: 2013-03-12 11:41 EDT (History)
2 users (show)

See Also:


Attachments
Simple patch for enbaling object parameters (1.31 KB, patch)
2013-02-24 03:31 EST, Kirill Zotkin CLA
no flags Details | Diff
patch, placing it in addParms (2.35 KB, patch)
2013-02-25 10:20 EST, Kirill Zotkin CLA
no flags Details | Diff
patch, placing it in addParms (2.35 KB, patch)
2013-02-27 00:07 EST, Kirill Zotkin CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kirill Zotkin CLA 2013-02-24 03:31:55 EST
Created attachment 227506 [details]
Simple patch for enbaling object parameters

I've supplied a patch for calling the ParameterValueConverter's convertToObject method while getting the parameter values for execution.
That enables the supplement of typed object values to EModelService.createCommand if MCommandParameters has type-id defined.

See http://www.eclipse.org/forums/index.php/t/456258/.
Comment 1 Paul Webster CLA 2013-02-25 08:38:09 EST
I'm not sure that ParameterizedCommand is the appropriate place for this method.  In the 3.x world, org.eclipse.core.commands.ExecutionEvent.getObjectParameterForExecution(String) provides this functionality since ExecutionEvent provides the parameters to the IHandler.

In Eclipse4 we get parameters directly through the @Execute or @CanExecute method.

Right now, we're passing those parameters through in methods like org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(Event), org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(ParameterizedCommand, IEclipseContext) and org.eclipse.e4.core.commands.internal.HandlerServiceImpl.addParms(ParameterizedCommand, IEclipseContext)

Maybe addParms(*) is a good method to convert the objects provided directly into the static context?

PW
Comment 2 Kirill Zotkin CLA 2013-02-25 10:20:29 EST
Created attachment 227544 [details]
patch, placing it in addParms

I'm not sure about cast to a String of the parameter value.
Comment 3 Kirill Zotkin CLA 2013-02-27 00:07:26 EST
Created attachment 227641 [details]
patch, placing it in addParms

Fixed link in doc.
Comment 4 Paul Webster CLA 2013-03-01 14:09:42 EST
Release as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=e14cff6969683cb974f000ce377610b8b3a577c6

Thankx Kirill. You can see this as @Execute void execute(@Named("parameter.id") Object obj), right?

PW
Comment 5 Kirill Zotkin CLA 2013-03-02 01:16:09 EST
Yes it is. It works so in my RCP app.


I'm very glad.
Comment 6 Paul Webster CLA 2013-03-12 11:41:49 EDT
In 4.3.0.I20130311-2000
PW