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.langed.LanguageEditor;
07: import net.xoetrope.editor.project.XEditorProjectManager;
08:
09: /**
10: * Action that can always be invoked and work procedurally.
11: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
12: * the GNU Public License (GPL), please see license.txt for more details. If
13: * you make commercial use of this software you must purchase a commercial
14: * license from Xoetrope.</p>
15: * <p> $Revision: 1.4 $</p>
16: * @author luano
17: */
18: public class ShowLanguageEditorAction extends CallableSystemAction {
19: public ShowLanguageEditorAction() {
20: super ();
21: }
22:
23: public void performAction() {
24: LanguageEditor langEd = LanguageEditor.getInstance();
25: langEd.open();
26: langEd.requestVisible();
27: langEd.requestActive();
28: }
29:
30: public String getName() {
31: return NbBundle.getMessage(ShowLanguageEditorAction.class,
32: "LBL_Action");
33: }
34:
35: protected String iconResource() {
36: return "com/xoetrope/editor/netbeans/actions/ShowLanguageEditorActionIcon.gif";
37: }
38:
39: public HelpCtx getHelpCtx() {
40: return HelpCtx.DEFAULT_HELP;
41: // If you will provide context help then use:
42: // return new HelpCtx(ShowLanguageEditorAction.class);
43: }
44:
45: protected boolean asynchronous() {
46: // performAction() should run in event thread
47: return false;
48: }
49:
50: /** Perform extra initialization of this action's singleton.
51: * PLEASE do not use constructors for this purpose!
52: * protected void initialize() {
53: * super.initialize();
54: * putProperty(Action.SHORT_DESCRIPTION, NbBundle.getMessage(ShowLanguageEditorAction.class, "HINT_Action"));
55: * }
56: */
57:
58: public boolean isEnabled() {
59: try {
60: Object obj = XEditorProjectManager.getCurrentProject();
61: return (XEditorProjectManager
62: .isUserRegistered("XUI Pro Localization") && (obj != null));
63: } catch (Exception ex) {
64: return false;
65: }
66: }
67: }
|