KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > $packageName$ > $className$


1 package $packageName$;
2
3 import org.eclipse.core.commands.AbstractHandler;
4 import org.eclipse.core.commands.ExecutionEvent;
5 import org.eclipse.core.commands.ExecutionException;
6 import org.eclipse.ui.IWorkbenchWindow;
7 import org.eclipse.ui.handlers.HandlerUtil;
8 import org.eclipse.jface.dialogs.MessageDialog;
9
10 /**
11  * Our sample handler extends AbstractHandler, an IHandler base class.
12  * @see org.eclipse.core.commands.IHandler
13  * @see org.eclipse.core.commands.AbstractHandler
14  */

15 public class $className$ extends AbstractHandler {
16     /**
17      * The constructor.
18      */

19     public $className$() {
20     }
21
22     /**
23      * the command has been executed, so extract extract the needed information
24      * from the application context.
25      */

26     public Object JavaDoc execute(ExecutionEvent event) throws ExecutionException {
27         IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
28         MessageDialog.openInformation(
29                 window.getShell(),
30                 "$pluginName$",
31                 "$message$");
32         return null;
33     }
34 }
35
Popular Tags