01: package com.xoetrope.editor.eclipse;
02:
03: import net.xoetrope.editor.project.XEditorProjectManager;
04:
05: import org.eclipse.jface.action.IAction;
06: import org.eclipse.jface.viewers.ISelection;
07: import org.eclipse.ui.IWorkbenchWindowActionDelegate;
08:
09: import com.xoetrope.carousel.langed.LangEdDesktop;
10: import com.xoetrope.editor.eclipse.langed.LanguageEditor;
11:
12: /**
13: * Our sample action implements workbench action delegate. The action proxy will
14: * be created by the workbench and shown in the UI. When the user tries to use
15: * the action, this delegate will be created and execution will be delegated to
16: * it.
17: *
18: * @see IWorkbenchWindowActionDelegate
19: */
20: public class XuiProScanProjectAction extends
21: XuiProShowLanguageEditorAction {
22: public void run(IAction action) {
23: LanguageEditor languageEditor = getLanguageEditor();
24: if (languageEditor == null) {
25: super .run(action);
26: languageEditor = getLanguageEditor();
27: }
28:
29: LangEdDesktop langEdDesktop = languageEditor.getLangEdDesktop();
30: langEdDesktop.scanCurrentProject();
31: }
32:
33: /**
34: * Selection in the workbench has been changed. We can change the state of the
35: * 'real' action here if we want, but this can only happen after the delegate
36: * has been created.
37: *
38: * @see IWorkbenchWindowActionDelegate#selectionChanged
39: */
40: public void selectionChanged(IAction action, ISelection selection) {
41: action.setEnabled(XEditorProjectManager
42: .isUserRegistered("XUI Pro"));
43: }
44: }
|