KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > $packageName$ > MessagePopupAction


1 package $packageName$;
2
3 import org.eclipse.jface.action.Action;
4 import org.eclipse.jface.dialogs.MessageDialog;
5 import org.eclipse.ui.IWorkbenchWindow;
6
7
8 public class MessagePopupAction extends Action {
9
10     private final IWorkbenchWindow window;
11
12     MessagePopupAction(String JavaDoc text, IWorkbenchWindow window) {
13         super(text);
14         this.window = window;
15         // The id is used to refer to the action in a menu or toolbar
16
setId(ICommandIds.CMD_OPEN_MESSAGE);
17         // Associate the action with a pre-defined command, to allow key bindings.
18
setActionDefinitionId(ICommandIds.CMD_OPEN_MESSAGE);
19         setImageDescriptor($pluginClass$.getImageDescriptor("/icons/sample3.gif"));
20     }
21
22     public void run() {
23         MessageDialog.openInformation(window.getShell(), "Open", "Open Message Dialog!");
24     }
25 }
Popular Tags