intial version
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.jtidy / src / net / sourceforge / phpdt / tidy / actions / AbstractJTidyEditorAction.java
diff --git a/archive/net.sourceforge.phpeclipse.jtidy/src/net/sourceforge/phpdt/tidy/actions/AbstractJTidyEditorAction.java b/archive/net.sourceforge.phpeclipse.jtidy/src/net/sourceforge/phpdt/tidy/actions/AbstractJTidyEditorAction.java
new file mode 100644 (file)
index 0000000..4525157
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * Created on 13.01.2003 by Jan Schulz
+ */
+package net.sourceforge.phpdt.tidy.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * @author jan
+ * @since 13.01.2003
+ */
+public abstract class AbstractJTidyEditorAction extends AbstractJTidyAction implements IEditorActionDelegate {
+       Shell fShell;
+       /* (non-Javadoc)
+        * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
+        */
+       public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+               if (fShell == null) {
+                       fShell = targetEditor.getSite().getShell();
+               }
+               updateEditor(targetEditor);
+
+               updateParent(action);
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+        */
+       public abstract void run(IAction action);
+
+       /* (non-Javadoc)
+        * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+        */
+       public void selectionChanged(IAction action, ISelection selection) {
+               // Noo need to get a selection...
+       }
+ /* (non-Javadoc)
+ * @see net.sourceforge.phpdt.tidy.actions.AbstractJTidyAction#getShell()
+ */
+protected Shell getShell() {
+       return fShell;
+}
+
+}