fix #774 infinite loop in net.sourceforge.phpeclipse.builder.IdentifierIndexManager...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPEditor.java
index a3605cb..ae728e1 100644 (file)
@@ -61,17 +61,19 @@ import net.sourceforge.phpdt.ui.text.JavaTextTools;
 import net.sourceforge.phpdt.ui.text.PHPSourceViewerConfiguration;
 import net.sourceforge.phpdt.ui.text.folding.IJavaFoldingStructureProvider;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.ui.IPreferenceConstants;
+import net.sourceforge.phpeclipse.builder.ExternalEditorInput;
 import net.sourceforge.phpeclipse.ui.editor.BrowserUtil;
-import net.sourceforge.phpeclipse.ui.overlaypages.ProjectPrefUtil;
 import net.sourceforge.phpeclipse.webbrowser.views.BrowserView;
 
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
@@ -178,6 +180,7 @@ import org.eclipse.ui.actions.ActionGroup;
 import org.eclipse.ui.editors.text.DefaultEncodingSupport;
 import org.eclipse.ui.editors.text.EditorsUI;
 import org.eclipse.ui.editors.text.IEncodingSupport;
+import org.eclipse.ui.ide.FileStoreEditorInput;
 import org.eclipse.ui.part.FileEditorInput;
 import org.eclipse.ui.part.IShowInSource;
 import org.eclipse.ui.part.IShowInTargetList;
@@ -3061,12 +3064,6 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements
         */
        private boolean fStickyOccurrenceAnnotations;
 
-       /** Preference key for showing the line number ruler */
-       // private final static String LINE_NUMBER_RULER =
-       // PreferenceConstants.EDITOR_LINE_NUMBER_RULER;
-       /** Preference key for the foreground color of the line numbers */
-       // private final static String LINE_NUMBER_COLOR =
-       // PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR;
        /** Preference key for the link color */
        private final static String LINK_COLOR = PreferenceConstants.EDITOR_LINK_COLOR;
 
@@ -5874,13 +5871,25 @@ public abstract class PHPEditor extends AbstractDecoratedTextEditor implements
        }
 
        public ShowInContext getShowInContext() {
-               FileEditorInput fei = (FileEditorInput) getEditorInput();
-               ShowInContext context = BrowserUtil.getShowInContext(fei.getFile(),
+               IFile file = null;
+               if(getEditorInput() instanceof FileStoreEditorInput){
+                       FileStoreEditorInput fei = (FileStoreEditorInput) getEditorInput();
+                       file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fei.getURI().getPath()));
+               } else if (getEditorInput() instanceof FileEditorInput) {
+                       FileEditorInput fei = (FileEditorInput) getEditorInput();
+                       // added to fix ticket 637
+                       file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fei.getURI().getPath()));
+               } else if (getEditorInput() instanceof ExternalEditorInput) {
+                       ExternalEditorInput fei = (ExternalEditorInput) getEditorInput();
+                       file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fei.getFullPath()/* .getURI().getPath()*/));
+               }
+
+               ShowInContext context = BrowserUtil.getShowInContext(file,
                                false, "");
                if (context != null) {
                        return context;
                }
-               return new ShowInContext(fei.getFile(), null);
+               return new ShowInContext(file, null);
        }
 
        public String[] getShowInTargetIds() {