Handler does not execute [message #957978] |
Thu, 25 October 2012 12:52  |
Eclipse User |
|
|
|
Hi,
In a eclipse4 app I have:
In the model:
a command add.level.command,
a command edit.level.command,
a part with toolbar with a Direct Toolbar Item that references a class AddLevelHandler and a handler edit.level.handler that references edit.level.command.
An implementation of:
the mentioned AddLevelHandler
a EditLevelHandler that is references by edit.level.handler.
Running the app, both toolbar items are shown but clicking on them does nothing. The objects AddLevelHandler and EditLevelHandler are instantiated on startup. The execution method is annotated with @Execute. There are no exceptions thrown.
As an example the code for AddLevelHandler. EditLevelHandler just has some minor differences.
package ch.eugster.herakles.tectonics.handlers;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.widgets.Shell;
import ch.eugster.herakles.persistence.model.Level;
import ch.eugster.herakles.persistence.service.LevelService;
import ch.eugster.herakles.tectonics.dialogs.LevelInputDialog;
import ch.eugster.image.service.ImageConverter;
public class AddLevelHandler
{
@Inject
private Shell shell;
@Inject
private LevelService levelService;
@Inject
private ImageConverter imageConverter;
public AddLevelHandler()
{
System.out.println();
}
@Execute
public void execute()
{
Level level = Level.newInstance();
LevelInputDialog dialog = new LevelInputDialog(shell, level, imageConverter);
if (dialog.open() == IDialogConstants.OK_ID)
{
levelService.persist(level);
}
}
}
Can anyone tell me what I am missing? I did not find any hints googling. Thank you!
[Updated on: Thu, 25 October 2012 13:00] by Moderator
|
|
|
|
|
|
|
|
|
Re: Handler does not execute [message #959133 is a reply to message #959122] |
Fri, 26 October 2012 09:30  |
Eclipse User |
|
|
|
Seems you are right on that. No need for a handler declaration for DirectToolItems. Have you ensured that the ClassURI points to the right class?
And if this is correct, maybe you are missing an Addon. I'm not yet very familiar with the Eclipse 4 Addons, but maybe you need to add the CommandServiceAddon to the section of Addons. In my application which I created by wizard, I also see the CommandProcessingAddon.
|
|
|
Powered by
FUDForum. Page generated in 0.05202 seconds