[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [Dltk-dev] new exception after yesterday's update
|
Hi Alex,
I was wrong - this isn't a regression (I haven't seen this failure, since the exception is not logged in SourceModuleDocumentProvider). Can you check the attached patch that fixes this problem?
I think ExternalSourceModule must be used in case of ExternalScriptProject :-)
Thanks!
Michael
On Thu, Oct 15, 2009 at 8:13 PM, Michael Spector
<spektom@xxxxxxxxx> wrote:
Hi Alex,
It's as simple as creating an Untitled Editor (NonExistingEditorInput).
This feature is implemented in PDT (I don't know regarding other DLTK extenders)
Thanks,
Michael
On Thu, Oct 15, 2009 at 7:29 PM, Alex Panchenko
<alex@xxxxxxxxx> wrote:
Hi Michael,
Could you please describe how to reproduce this issue?
Thank you,
Alex
----- Original Message -----
From: "Michael Spector" <
spektom@xxxxxxxxx>
To: "DLTK Developer Discussions" <
dltk-dev@xxxxxxxxxxx>
Sent: Thursday, October 15, 2009 9:52:23 PM GMT +06:00 Almaty, Novosibirsk
Subject: [Dltk-dev] new exception after yesterday's update
Hi,
I've started to get this exception on opening a non-existing file editor (Untitled Editor):
org.eclipse.dltk.core.ModelException: _27022227.php [in <default> [in <project root> [in ]]] does not exist
at org.eclipse.dltk.internal.core.ModelElement.newNotPresentException(ModelElement.java:256)
at org.eclipse.dltk.internal.core.SourceModule.getBufferContent(SourceModule.java:408)
at org.eclipse.dltk.internal.core.AbstractSourceModule.openBuffer(AbstractSourceModule.java:647)
at org.eclipse.dltk.internal.core.AbstractSourceModule.buildStructure(AbstractSourceModule.java:502)
at org.eclipse.dltk.internal.core.Openable.generateInfos(Openable.java:185)
at org.eclipse.dltk.internal.core.ModelElement.openWhenClosed(ModelElement.java:182)
at org.eclipse.dltk.internal.core.BecomeWorkingCopyOperation.executeOperation(BecomeWorkingCopyOperation.java:42)
at org.eclipse.dltk.internal.core.ModelOperation.run(ModelOperation.java:698)
at org.eclipse.dltk.internal.core.ModelOperation.runOperation(ModelOperation.java:764)
at org.eclipse.dltk.internal.core.SourceModule.becomeWorkingCopy(SourceModule.java:68)
at org.eclipse.dltk.core.WorkingCopyOwner.newWorkingCopy(WorkingCopyOwner.java:147)
at org.eclipse.dltk.internal.ui.editor.SourceModuleDocumentProvider.createFakeSourceModule(SourceModuleDocumentProvider.java:1659)
at org.eclipse.dltk.internal.ui.editor.SourceModuleDocumentProvider.createFakeSourceModule(SourceModuleDocumentProvider.java:1622)
at org.eclipse.dltk.internal.ui.editor.SourceModuleDocumentProvider.createFileInfo(SourceModuleDocumentProvider.java:1244)
It's really strange why does it check for the existence - shouldn't it be ExternalSourceModule at all?
Thanks,
Michael
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev
_______________________________________________
### Eclipse Workspace Patch 1.0
#P org.eclipse.dltk.core
Index: model/org/eclipse/dltk/core/WorkingCopyOwner.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.dltk/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/WorkingCopyOwner.java,v
retrieving revision 1.6
diff -u -r1.6 WorkingCopyOwner.java
--- model/org/eclipse/dltk/core/WorkingCopyOwner.java 4 Jun 2009 17:05:21 -0000 1.6
+++ model/org/eclipse/dltk/core/WorkingCopyOwner.java 18 Oct 2009 16:49:58 -0000
@@ -9,13 +9,14 @@
*******************************************************************************/
package org.eclipse.dltk.core;
+import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.dltk.internal.core.BufferManager;
import org.eclipse.dltk.internal.core.DefaultWorkingCopyOwner;
import org.eclipse.dltk.internal.core.ExternalScriptProject;
+import org.eclipse.dltk.internal.core.ExternalSourceModule;
import org.eclipse.dltk.internal.core.ModelElement;
-import org.eclipse.dltk.internal.core.SourceModule;
/**
* The owner of an <code>ISourceModule</code> handle in working copy mode. An
@@ -125,6 +126,8 @@
* during reconciling as they are discovered. The requestor can
* be set to <code>null</code> indicating that the client is not
* interested in problems.
+ * @param storage
+ * Storage for the file
* @param monitor
* a progress monitor used to report progress while opening the
* working copy or <code>null</code> if no progress should be
@@ -137,13 +140,14 @@
*/
public final ISourceModule newWorkingCopy(String name,
IBuildpathEntry[] buildpath, IProblemRequestor problemRequestor,
+ IStorage storage,
IProgressMonitor monitor) throws ModelException {
ExternalScriptProject project = new ExternalScriptProject(buildpath);
IProjectFragment fragment = project.getProjectFragment(Path.EMPTY);
IScriptFolder parent = fragment
.getScriptFolder(IProjectFragment.DEFAULT_SCRIPT_FOLDER_NAME);
- SourceModule result = new SourceModule((ModelElement) parent, name,
- this);
+ ExternalSourceModule result = new ExternalSourceModule(
+ (ModelElement) parent, name, this, storage);
result.becomeWorkingCopy(problemRequestor, monitor);
return result;
}
Index: model/org/eclipse/dltk/core/FileStoreStorage.java
===================================================================
RCS file: model/org/eclipse/dltk/core/FileStoreStorage.java
diff -N model/org/eclipse/dltk/core/FileStoreStorage.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ model/org/eclipse/dltk/core/FileStoreStorage.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,66 @@
+package org.eclipse.dltk.core;
+
+import java.io.InputStream;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * A storage for an <code>IFileStore</code> element.
+ *
+ * @since 2.0
+ */
+public class FileStoreStorage implements IStorage {
+
+ private IFileStore fFileStore;
+ private IPath fFullPath;
+
+ public FileStoreStorage(IFileStore fileStore) {
+ Assert.isNotNull(fileStore);
+ Assert.isTrue(EFS.SCHEME_FILE.equals(fileStore.getFileSystem()
+ .getScheme()));
+ fFileStore = fileStore;
+ }
+
+ /*
+ * @see org.eclipse.core.resources.IStorage#getContents()
+ */
+ public InputStream getContents() throws CoreException {
+ return fFileStore.openInputStream(EFS.NONE, null);
+ }
+
+ /*
+ * @see org.eclipse.core.resources.IStorage#getFullPath()
+ */
+ public IPath getFullPath() {
+ if (fFullPath == null)
+ fFullPath = new Path(fFileStore.toURI().getPath());
+ return fFullPath;
+ }
+
+ /*
+ * @see org.eclipse.core.resources.IStorage#getName()
+ */
+ public String getName() {
+ return fFileStore.getName();
+ }
+
+ /*
+ * @see org.eclipse.core.resources.IStorage#isReadOnly()
+ */
+ public boolean isReadOnly() {
+ return fFileStore.fetchInfo().getAttribute(EFS.ATTRIBUTE_READ_ONLY);
+ }
+
+ /*
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+}
\ No newline at end of file
#P org.eclipse.dltk.ui
Index: src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.dltk/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java,v
retrieving revision 1.38
diff -u -r1.38 SourceModuleDocumentProvider.java
--- src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java 24 Jul 2009 04:47:48 -0000 1.38
+++ src/org/eclipse/dltk/internal/ui/editor/SourceModuleDocumentProvider.java 18 Oct 2009 16:50:02 -0000
@@ -48,6 +48,7 @@
import org.eclipse.dltk.compiler.problem.CategorizedProblem;
import org.eclipse.dltk.compiler.problem.IProblem;
import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.dltk.core.FileStoreStorage;
import org.eclipse.dltk.core.IBuffer;
import org.eclipse.dltk.core.IBuildpathEntry;
import org.eclipse.dltk.core.IModelElement;
@@ -1657,7 +1658,8 @@
.getDefaultInterpreterContainerEntry() };
final ISourceModule cu = woc.newWorkingCopy(fileStore.getName(),
- cpEntries, null, getProgressMonitor());
+ cpEntries, null, new FileStoreStorage(fileStore),
+ getProgressMonitor());
if (!isModifiable(editorInput))
ScriptModelUtil.reconcile(cu);
@@ -1700,7 +1702,8 @@
.getDefaultInterpreterContainerEntry() };
final ISourceModule cu = woc.newWorkingCopy(fileStore.getName(),
- cpEntries, null, getProgressMonitor());
+ cpEntries, null, new FileStoreStorage(fileStore),
+ getProgressMonitor());
if (!isModifiable(editorInput))
ScriptModelUtil.reconcile(cu);
@@ -1744,7 +1747,7 @@
.getDefaultInterpreterContainerEntry() };
final ISourceModule cu = woc.newWorkingCopy(storage.getName(),
- cpEntries, null, getProgressMonitor());
+ cpEntries, null, storage, getProgressMonitor());
if (setContents) {
int READER_CHUNK_SIZE = 2048;
int BUFFER_SIZE = 8 * READER_CHUNK_SIZE;