Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/PHPUiConstants.java1
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/EditorUtility.java53
2 files changed, 17 insertions, 37 deletions
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/PHPUiConstants.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/PHPUiConstants.java
index b292b90cc..bceeb4909 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/PHPUiConstants.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/PHPUiConstants.java
@@ -13,6 +13,7 @@ package org.eclipse.php.internal.ui;
public interface PHPUiConstants {
public static final int INTERNAL_ERROR = 10001;
public static final String PHP_EDITOR_ID = "org.eclipse.php.editor";
+ public static final String PHP_UNTITLED_EDITOR_ID = "org.eclipse.php.untitledPhpEditor";
// disable cut/copy/paste/rename etc on php elements within file
public static final boolean DISABLE_ELEMENT_REFACTORING=true;
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/EditorUtility.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/EditorUtility.java
index 1bd6fd4e1..d65a6bd82 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/EditorUtility.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/util/EditorUtility.java
@@ -10,11 +10,7 @@
*******************************************************************************/
package org.eclipse.php.internal.ui.util;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.List;
@@ -24,27 +20,13 @@ import java.util.zip.ZipInputStream;
import org.eclipse.core.internal.filesystem.local.LocalFile;
import org.eclipse.core.internal.resources.ICoreConstants;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.*;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.php.internal.core.containers.LocalFileStorage;
import org.eclipse.php.internal.core.containers.ZipEntryStorage;
@@ -60,6 +42,7 @@ import org.eclipse.php.internal.core.resources.ExternalFileDecorator;
import org.eclipse.php.internal.core.resources.ExternalFilesRegistry;
import org.eclipse.php.internal.ui.Logger;
import org.eclipse.php.internal.ui.PHPUIMessages;
+import org.eclipse.php.internal.ui.PHPUiConstants;
import org.eclipse.php.internal.ui.PHPUiPlugin;
import org.eclipse.php.internal.ui.containers.LocalFileStorageEditorInput;
import org.eclipse.php.internal.ui.containers.ZipEntryStorageEditorInput;
@@ -67,19 +50,7 @@ import org.eclipse.php.internal.ui.editor.PHPStructuredEditor;
import org.eclipse.php.internal.ui.editor.input.NonExistingPHPFileEditorInput;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.*;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.ide.IDE;
@@ -270,6 +241,10 @@ public class EditorUtility {
// If this is external file:
if (ExternalFilesRegistry.getInstance().isEntryExist(path.toString())) {
+ //first check maybe it is an untitled PHP document
+ if ((path.segmentCount() > 1) && path.segment(path.segmentCount() - 2).equals("Untitled_Documents")) {
+ return new NonExistingPHPFileEditorInput(path);
+ }
return new FileStoreEditorInput(new LocalFile(externalSource));
}
@@ -460,8 +435,12 @@ public class EditorUtility {
return openInEditor(fileInput.getFile(), activate);
}
- if (input != null)
+ if (input != null) {
+ if (input instanceof NonExistingPHPFileEditorInput) {
+ return openInEditor(input, PHPUiConstants.PHP_UNTITLED_EDITOR_ID, activate);
+ }
return openInEditor(input, getEditorID(input), activate);
+ }
return null;
}
@@ -512,7 +491,7 @@ public class EditorUtility {
ExternalFilesRegistry.getInstance().addFileEntry(fileName, externalFile);
}
}
-
+
// If this is external file:
if (ExternalFilesRegistry.getInstance().isEntryExist(path.toString())) {
editorInput = new FileStoreEditorInput(new LocalFile(localFile));

Back to the top