Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » dynamic command parameter and converter(register converter in eclipse 4)
dynamic command parameter and converter [message #1245011] Thu, 13 February 2014 06:51 Go to next message
Beat Schaller is currently offline Beat SchallerFriend
Messages: 42
Registered: July 2009
Member
I want to define dynamic a MHandledMenuItem with corresponding command and parameter. After seen the problem (bug 383403) I searched with EModelService my windows and could attach my menu items.

On the command side I have a problem. Defining commands and parameters is okay. But I can't see where to register my converter. What is the pure Eclipse 4 way? If I use the extension point eclipse.org.ui.commands - I use the compatibility layer, right? If I don't want to use it what's the pure eclipse 4 way?

Thx for any help
Beat
Re: dynamic command parameter and converter [message #1248385 is a reply to message #1245011] Mon, 17 February 2014 07:40 Go to previous messageGo to next message
Beat Schaller is currently offline Beat SchallerFriend
Messages: 42
Registered: July 2009
Member
If I want to use converters and parameters in my commands I can't do it. Why can't we define the converter in the model editor (like in the extension point)? There is only a possibility to define a typeId but no converter. So only default String converters are supported.

Beat
Re: dynamic command parameter and converter [message #1248442 is a reply to message #1248385] Mon, 17 February 2014 09:05 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
IIRC the underlying system is that old one, so if you define a
commandParameterType using the old extension point it will be used!

Tom

On 17.02.14 08:40, Beat Schaller wrote:
> If I want to use converters and parameters in my commands I can't do it.
> Why can't we define the converter in the model editor (like in the
> extension point)? There is only a possibility to define a typeId but no
> converter. So only default String converters are supported.
>
> Beat
Re: dynamic command parameter and converter [message #1248531 is a reply to message #1248442] Mon, 17 February 2014 11:11 Go to previous messageGo to next message
Beat Schaller is currently offline Beat SchallerFriend
Messages: 42
Registered: July 2009
Member
Thank you Tom for the reply. As we have a big pure e4 Application I don't want just for this reason to add org.eclipse.ui.commands (needs compatibility layer, correct?).

I tried to define a command in the model with just the TypeId and then to modify it dynamic:
final Map<String, Object> commandParameters = new HashMap<String, Object>();
     final ParameterizedCommand command = commandService.createCommand(ModelIdConstants.COMMAND_PROFIL_ACTIVATE, commandParameters);
     final ParameterType type = command.getCommand().getParameterType(ModelIdConstants.COMMAND_PROFIL_PARAMETER);
     type.define(Profil.class.getCanonicalName(), converter);
     commandParameters.put(ModelIdConstants.COMMAND_PROFIL_PARAMETER, profil);


But to create the ParameterizedCommand I have to create an empty map. Otherwise I get an error because there is no converter defined.
If I make it as described I get no error but in HandlerServiceImpl I see there is an empty map. So - not parameters, an empty map. Is there another way or just the possibility to pass String parameters?

Beat
Re: dynamic command parameter and converter [message #1248568 is a reply to message #1248531] Mon, 17 February 2014 12:09 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
.... well the extension point is defined in org.eclipse.ui but I guess
the parsing (see CommandPersitence!) is done by the core-bundle and the
exsd is not loaded at runtime at all.

Most likely this happened because the extension point was published
first in org.eclipse.ui and afterwards all code was moved to core.commands.

I think this is a very strange scenario so I'd suggest you file a
bugzilla so that we can discuss solutions - it simply sounds extremely
strange that you need to use an extension point which looks like it can
only be used together with the compat layer which apparently is wrong!

Tom

On 17.02.14 12:11, Beat Schaller wrote:
> Thank you Tom for the reply. As we have a big pure e4 Application I
> don't want just for this reason to add org.eclipse.ui.commands (needs
> compatibility layer, correct?).
>
> I tried to define a command in the model with just the TypeId and then
> to modify it dynamic:
> final Map<String, Object> commandParameters = new HashMap<String,
> Object>();
> final ParameterizedCommand command =
> commandService.createCommand(ModelIdConstants.COMMAND_PROFIL_ACTIVATE,
> commandParameters);
> final ParameterType type =
> command.getCommand().getParameterType(ModelIdConstants.COMMAND_PROFIL_PARAMETER);
>
> type.define(Profil.class.getCanonicalName(), converter);
> commandParameters.put(ModelIdConstants.COMMAND_PROFIL_PARAMETER,
> profil);
>
> But to create the ParameterizedCommand I have to create an empty map.
> Otherwise I get an error because there is no converter defined.
> If I make it as described I get no error but in HandlerServiceImpl I see
> there is an empty map. So - not parameters, an empty map. Is there
> another way or just the possibility to pass String parameters?
>
> Beat
Re: dynamic command parameter and converter [message #1248588 is a reply to message #1248568] Mon, 17 February 2014 12:33 Go to previous message
Beat Schaller is currently offline Beat SchallerFriend
Messages: 42
Registered: July 2009
Member
Thanks Tom
https://bugs.eclipse.org/bugs/show_bug.cgi?id=428348
Previous Topic:Dynamic toolbar contribution
Next Topic:JFace databinding issues after migration
Goto Forum:
  


Current Time: Tue Mar 19 09:43:15 GMT 2024

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

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

Back to the top