Fixed: couldn't launch linked files nor launch files under a linked folder when local...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / actions / PHPOpenDeclarationEditorAction.java
index e689c33..d800960 100644 (file)
@@ -19,49 +19,54 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.actions.ActionDelegate;
 
-public class PHPOpenDeclarationEditorAction extends ActionDelegate implements IEditorActionDelegate {
-  private IWorkbenchWindow fWindow;
+public class PHPOpenDeclarationEditorAction extends ActionDelegate implements
+               IEditorActionDelegate {
+       private IWorkbenchWindow fWindow;
 
-  private PHPEditor fEditor;
+       private PHPEditor fEditor;
 
-  public void init(IWorkbenchWindow window) {
-    this.fWindow = window;
-  }
+       public void init(IWorkbenchWindow window) {
+               this.fWindow = window;
+       }
 
-  public void selectionChanged(IAction action, ISelection selection) {
-    if (!selection.isEmpty()) {
-      if (selection instanceof TextSelection) {
-        action.setEnabled(true);
-      } else if (fWindow.getActivePage() != null && fWindow.getActivePage().getActivePart() != null) {
-        //
-      }
-    }
-  }
+       public void selectionChanged(IAction action, ISelection selection) {
+               if (!selection.isEmpty()) {
+                       if (selection instanceof TextSelection) {
+                               action.setEnabled(true);
+                       } else if (fWindow.getActivePage() != null
+                                       && fWindow.getActivePage().getActivePart() != null) {
+                               //
+                       }
+               }
+       }
 
-  private boolean checkEnabled(IStructuredSelection selection) {
-    if (selection.isEmpty())
-      return false;
-    return true;
-  }
-  public void run(IAction action) {
-    if (fEditor == null) {
-      IEditorPart targetEditor = fWindow.getActivePage().getActiveEditor();
-      if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
-        fEditor = (PHPEditor) targetEditor;
-      }
-    }
-    if (fEditor != null) {
-      ITextSelection selection = (ITextSelection) fEditor.getSelectionProvider().getSelection();
-      OpenDeclarationEditorAction openAction = new OpenDeclarationEditorAction(fEditor);
-      openAction.openSelectedElement(selection);
-    }
-  }
+       private boolean checkEnabled(IStructuredSelection selection) {
+               if (selection.isEmpty())
+                       return false;
+               return true;
+       }
 
-  public void setActiveEditor(IAction action, IEditorPart targetEditor) {
-    if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
-      fEditor = (PHPEditor) targetEditor;
-    }
-  }
+       public void run(IAction action) {
+               if (fEditor == null) {
+                       IEditorPart targetEditor = fWindow.getActivePage()
+                                       .getActiveEditor();
+                       if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
+                               fEditor = (PHPEditor) targetEditor;
+                       }
+               }
+               if (fEditor != null) {
+                       ITextSelection selection = (ITextSelection) fEditor
+                                       .getSelectionProvider().getSelection();
+                       OpenDeclarationEditorAction openAction = new OpenDeclarationEditorAction(
+                                       fEditor);
+                       openAction.openSelectedElement(selection);
+               }
+       }
+
+       public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+               if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
+                       fEditor = (PHPEditor) targetEditor;
+               }
+       }
 
 }
\ No newline at end of file