intial version
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.jtidy / src / net / sourceforge / phpdt / tidy / actions / AbstractJTidyEditorAction.java
1 /**
2  * Created on 13.01.2003 by Jan Schulz
3  */
4 package net.sourceforge.phpdt.tidy.actions;
5
6 import org.eclipse.jface.action.IAction;
7 import org.eclipse.jface.viewers.ISelection;
8 import org.eclipse.swt.widgets.Shell;
9 import org.eclipse.ui.IEditorActionDelegate;
10 import org.eclipse.ui.IEditorPart;
11
12 /**
13  * @author jan
14  * @since 13.01.2003
15  */
16 public abstract class AbstractJTidyEditorAction extends AbstractJTidyAction implements IEditorActionDelegate {
17         Shell fShell;
18         /* (non-Javadoc)
19          * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
20          */
21         public void setActiveEditor(IAction action, IEditorPart targetEditor) {
22                 if (fShell == null) {
23                         fShell = targetEditor.getSite().getShell();
24                 }
25                 updateEditor(targetEditor);
26
27                 updateParent(action);
28         }
29
30         /* (non-Javadoc)
31          * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
32          */
33         public abstract void run(IAction action);
34
35         /* (non-Javadoc)
36          * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
37          */
38         public void selectionChanged(IAction action, ISelection selection) {
39                 // Noo need to get a selection...
40         }
41  /* (non-Javadoc)
42  * @see net.sourceforge.phpdt.tidy.actions.AbstractJTidyAction#getShell()
43  */
44 protected Shell getShell() {
45         return fShell;
46 }
47
48 }