X-Git-Url: http://secure.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/SelectionDispatchAction.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/SelectionDispatchAction.java
index 891c48e..41d8d34 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/SelectionDispatchAction.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ui/actions/SelectionDispatchAction.java
@@ -10,8 +10,6 @@
  ******************************************************************************/
 package net.sourceforge.phpdt.ui.actions;
 
-import org.eclipse.swt.widgets.Shell;
-
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.text.ITextSelection;
 import org.eclipse.jface.util.Assert;
@@ -20,28 +18,23 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-import org.eclipse.core.runtime.CoreException;
-
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.texteditor.IUpdate;
-
-//import org.eclipse.jdt.internal.ui.actions.ActionMessages;
-import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
 
 /**
- * Action that dispatches the IAction#run() and the 
- * ISelectionChangedListener#selectionChanged 
- * according to the type of the selection. 
+ * Action that dispatches the IAction#run() and the
+ * ISelectionChangedListener#selectionChanged according to the
+ * type of the selection.
  * 
  * 
ITextSelection then
- * 	run(ITextSelection) and selectionChanged(ITextSelection)
- * 	is called.IStructuredSelection then
- * 	run(IStructuredSelection) and 
- * 	selectionChanged(IStructuredSelection) is called.run(ISelection) and 
+ * - if selection is of type ITextSelectionthen
+ *run(ITextSelection)and
+ *selectionChanged(ITextSelection)is called.
+ *- if selection is of type IStructuredSelectionthen
+ *run(IStructuredSelection)and
+ * 	selectionChanged(IStructuredSelection)+ * is called.
+ *- default is to call run(ISelection)and
  * 	selectionChanged(ISelection).
** Configure the action later using the set methods. *
* - * @param site the site this action is working on + * @param site + * the site this action is working on */ protected SelectionDispatchAction(IWorkbenchSite site) { Assert.isNotNull(site); - fSite= site; + fSite = site; } /** @@ -81,7 +76,7 @@ public abstract class SelectionDispatchAction extends Action implements ISelecti * Returns the selection provided by the site owning this action. * * @return the site's selection - */ + */ public ISelection getSelection() { return getSelectionProvider().getSelection(); } @@ -89,94 +84,101 @@ public abstract class SelectionDispatchAction extends Action implements ISelecti /** * Returns the shell provided by the site owning this action. * - * @return the site's shell + * @return the site's shell */ - public Shell getShell() { + public Shell getShell() { return fSite.getShell(); } - + /** * Returns the selection provider managed by the site owning this action. * - * @return the site's selection provider + * @return the site's selection provider */ public ISelectionProvider getSelectionProvider() { return fSite.getSelectionProvider(); } /** - * Updates the action's enablement state according to the given selection. This - * default implementation calls one of theselectionChanged
-	 * methods depending on the type of the passed selection.
+	 * Updates the action's enablement state according to the given selection.
+	 * This default implementation calls one of the
+	 * selectionChanged methods depending on the type of the
+	 * passed selection.
 	 * 
-	 * @param selection the selection this action is working on
+	 * @param selection
+	 *            the selection this action is working on
 	 */
 	public void update(ISelection selection) {
 		dispatchSelectionChanged(selection);
 	}
 
 	/**
-	 * Notifies this action that the given structured selection has changed. This default
-	 * implementation calls selectionChanged(ISelection selection).
+	 * Notifies this action that the given structured selection has changed.
+	 * This default implementation calls
+	 * selectionChanged(ISelection selection).
 	 * 
-	 * @param selection the new selection
- 	 */
+	 * @param selection
+	 *            the new selection
+	 */
 	protected void selectionChanged(IStructuredSelection selection) {
-		selectionChanged((ISelection)selection);
+		selectionChanged((ISelection) selection);
 	}
 
 	/**
-	 * Executes this actions with the given structured selection. This default implementation
-	 * calls run(ISelection selection).
+	 * Executes this actions with the given structured selection. This default
+	 * implementation calls run(ISelection selection).
 	 */
 	protected void run(IStructuredSelection selection) {
-		run((ISelection)selection);
+		run((ISelection) selection);
 	}
-	
+
 	/**
-	 * Notifies this action that the given text selection has changed.  This default
-	 * implementation calls selectionChanged(ISelection selection).
+	 * Notifies this action that the given text selection has changed. This
+	 * default implementation calls
+	 * selectionChanged(ISelection selection).
 	 * 
-	 * @param selection the new selection
- 	 */
+	 * @param selection
+	 *            the new selection
+	 */
 	protected void selectionChanged(ITextSelection selection) {
-		selectionChanged((ISelection)selection);
+		selectionChanged((ISelection) selection);
 	}
-	
+
 	/**
-	 * Executes this actions with the given text selection. This default implementation
-	 * calls run(ISelection selection).
+	 * Executes this actions with the given text selection. This default
+	 * implementation calls run(ISelection selection).
 	 */
 	protected void run(ITextSelection selection) {
-		run((ISelection)selection);
+		run((ISelection) selection);
 	}
-	
+
 	/**
-	 * Notifies this action that the given selection has changed.  This default
+	 * Notifies this action that the given selection has changed. This default
 	 * implementation sets the action's enablement state to false.
 	 * 
-	 * @param selection the new selection
- 	 */
+	 * @param selection
+	 *            the new selection
+	 */
 	protected void selectionChanged(ISelection selection) {
 		setEnabled(false);
 	}
-	
+
 	/**
-	 * Executes this actions with the given selection. This default implementation
-	 * does nothing.
+	 * Executes this actions with the given selection. This default
+	 * implementation does nothing.
 	 */
 	protected void run(ISelection selection) {
 	}
 
-	/* (non-Javadoc)
-	 * Method declared on IAction.
+	/*
+	 * (non-Javadoc) Method declared on IAction.
 	 */
 	public void run() {
 		dispatchRun(getSelection());
 	}
-	
-	/* (non-Javadoc)
-	 * Method declared on ISelectionChangedListener.
+
+	/*
+	 * (non-Javadoc) Method declared on ISelectionChangedListener.
 	 */
 	public void selectionChanged(SelectionChangedEvent event) {
 		dispatchSelectionChanged(event.getSelection());
@@ -184,9 +186,9 @@ public abstract class SelectionDispatchAction extends Action implements ISelecti
 
 	private void dispatchSelectionChanged(ISelection selection) {
 		if (selection instanceof IStructuredSelection) {
-			selectionChanged((IStructuredSelection)selection);
+			selectionChanged((IStructuredSelection) selection);
 		} else if (selection instanceof ITextSelection) {
-			selectionChanged((ITextSelection)selection);
+			selectionChanged((ITextSelection) selection);
 		} else {
 			selectionChanged(selection);
 		}
@@ -194,9 +196,9 @@ public abstract class SelectionDispatchAction extends Action implements ISelecti
 
 	private void dispatchRun(ISelection selection) {
 		if (selection instanceof IStructuredSelection) {
-			run((IStructuredSelection)selection);
+			run((IStructuredSelection) selection);
 		} else if (selection instanceof ITextSelection) {
-			run((ITextSelection)selection);
+			run((ITextSelection) selection);
 		} else {
 			run(selection);
 		}