01: package com.xoetrope.editor.netbeans.actions;
02:
03: import org.openide.util.HelpCtx;
04: import org.openide.util.NbBundle;
05: import org.openide.util.actions.CallableSystemAction;
06: import com.xoetrope.editor.netbeans.services.ServiceTopComponent;
07: import net.xoetrope.editor.project.XEditorProjectManager;
08: import net.xoetrope.editor.project.XEditorProject;
09:
10: /**
11: * Show the model visualizer
12: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
13: * the GNU Public License (GPL), please see license.txt for more details. If
14: * you make commercial use of this software you must purchase a commercial
15: * license from Xoetrope.</p>
16: * <p> $Revision: 1.5 $</p>
17: */
18: public class ShowServiceManagerAction extends CallableSystemAction {
19: public ShowServiceManagerAction() {
20: super ();
21: }
22:
23: /**
24: * Create an instance of the ServiceTopComponent and pass it the current
25: * project
26: */
27: public void performAction() {
28: ServiceTopComponent serviceMgr = new ServiceTopComponent(
29: (XEditorProject) XEditorProjectManager
30: .getCurrentProject());
31: serviceMgr.open();
32: serviceMgr.requestActive();
33: serviceMgr.requestVisible();
34: }
35:
36: public String getName() {
37: return "Service Manager";//NbBundle.getMessage( ShowServiceManagerAction.class, "LBL_ShowServiceManagerAction" );
38: }
39:
40: protected String iconResource() {
41: return "com/xoetrope/editor/netbeans/actions/ShowServiceManagerActionIcon.gif";
42: }
43:
44: public HelpCtx getHelpCtx() {
45: return HelpCtx.DEFAULT_HELP;
46: // If you will provide context help then use:
47: // return new HelpCtx(ShowLanguageEditorAction.class);
48: }
49:
50: protected boolean asynchronous() {
51: // performAction() should run in event thread
52: return false;
53: }
54:
55: /** Perform extra initialization of this action's singleton.
56: * PLEASE do not use constructors for this purpose!
57: * protected void initialize() {
58: * super.initialize();
59: * putProperty(Action.SHORT_DESCRIPTION, NbBundle.getMessage(ShowLanguageEditorAction.class, "HINT_Action"));
60: * }
61: */
62: public boolean isEnabled() {
63: try {
64: Object obj = XEditorProjectManager.getCurrentProject();
65: return (XEditorProjectManager.isUserRegistered("XUI Pro") && (obj != null));
66: } catch (Exception ex) {
67: return false;
68: }
69: }
70: }
|