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 XuiProCheckSpellingAction extends
21: XuiProShowLanguageEditorAction {
22: public void run(IAction action) {
23: LanguageEditor languageEditor = getLanguageEditor();
24: if (languageEditor == null)
25: languageEditor = showEditor();
26:
27: LangEdDesktop langEdDesktop = languageEditor.getLangEdDesktop();
28: langEdDesktop.checkSpelling();
29: }
30:
31: /**
32: * Selection in the workbench has been changed. We can change the state of the
33: * 'real' action here if we want, but this can only happen after the delegate
34: * has been created.
35: *
36: * @see IWorkbenchWindowActionDelegate#selectionChanged
37: */
38: public void selectionChanged(IAction action, ISelection selection) {
39: action.setEnabled(XEditorProjectManager
40: .isUserRegistered("XUI Pro"));
41: }
42: }
|