/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IOpenListener#open(org.eclipse.jface.viewers.OpenEvent)
*/
@Override
public void open(OpenEvent event) {
IHandlerService handlerService =
(IHandlerService) getSite().getService(IHandlerService.class);
try {
handlerService.executeCommand(
"net.sf.logsaw.ui.commands.OpenLogResourceCommand", //$NON-NLS-1$
null);
} catch (CommandException e) {
// log and show error
UIPlugin.logAndShowError(new CoreException(new Status(
IStatus.ERROR, UIPlugin.PLUGIN_ID,
Messages.Generic_errorExecutingCommand, e)), false);
}
}
});
ViewerDropAdapter dropAdapter = new ViewerDropAdapter(viewer) {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
*/
@Override
public boolean performDrop(final Object target) {
Display.getDefault().asyncExec(new Runnable() {
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
IHandlerService handlerService =
(IHandlerService) getSite().getService(IHandlerService.class);
ICommandService commandService =
(ICommandService) getSite().getService(ICommandService.class);
Command cmd = commandService.getCommand("net.sf.logsaw.ui.commands.AddLogResourceCommand"); //$NON-NLS-1$
try {
Parameterization param = new Parameterization(
cmd.getParameter("net.sf.logsaw.ui.commands.AddLogResourceCommand.filename"), ((String[]) target)[0]); //$NON-NLS-1$
ParameterizedCommand paraCmd = new ParameterizedCommand(cmd, new Parameterization[] {param});
handlerService.executeCommand(paraCmd, null);
} catch (CommandException e) {
// log and show error
UIPlugin.logAndShowError(new CoreException(new Status(
IStatus.ERROR, UIPlugin.PLUGIN_ID,
Messages.Generic_errorExecutingCommand, e)), false);