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