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: * Add a language to the project
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.2 $</p>
16: * @author luano
17: */
18: public class AddLanguageAction extends CallableSystemAction {
19: public AddLanguageAction() {
20: super ();
21: }
22:
23: public void performAction() {
24: LanguageEditor langEd = LanguageEditor.getInstance();
25: if (!langEd.isOpened()) {
26: langEd.open();
27: langEd.requestVisible();
28: langEd.requestActive();
29: }
30: langEd.addLanguage();
31: }
32:
33: public String getName() {
34: return NbBundle.getMessage(AddLanguageAction.class,
35: "LBL_AddLanguageAction");
36: }
37:
38: // protected String iconResource()
39: // {
40: // return "com/xoetrope/carousel/actions/ShowLanguageEditorActionIcon.gif";
41: // }
42:
43: public HelpCtx getHelpCtx() {
44: return HelpCtx.DEFAULT_HELP;
45: // If you will provide context help then use:
46: // return new HelpCtx(ShowLanguageEditorAction.class);
47: }
48:
49: protected boolean asynchronous() {
50: // performAction() should run in event thread
51: return false;
52: }
53:
54: public boolean isEnabled() {
55: try {
56: Object obj = XEditorProjectManager.getCurrentProject();
57: return (XEditorProjectManager
58: .isUserRegistered("XUI Pro Localization") && (obj != null));
59: } catch (Exception ex) {
60: return false;
61: }
62: }
63: }
|