OSDN Git Service

Fix model locking
authorTor Norbye <tnorbye@google.com>
Wed, 15 Dec 2010 05:42:43 +0000 (21:42 -0800)
committerTor Norbye <tnorbye@google.com>
Wed, 15 Dec 2010 05:42:43 +0000 (21:42 -0800)
Fix the bug where editors sometimes can't be reopened due to an
assertion in the XML model.  The IncludeFinder code I added last week
had a mismatch between the type of lock acquired (an edit lock) and
the lock released (a read lock).

Change-Id: I2d3053ec4e9d1efba62ab0f3216d15f738192ddd

eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeFinder.java

index dd8edb2..07c52fe 100644 (file)
@@ -39,7 +39,6 @@ import com.android.ide.eclipse.adt.io.IFileWrapper;
 import com.android.sdklib.SdkConstants;
 import com.android.sdklib.annotations.VisibleForTesting;
 import com.android.sdklib.io.IAbstractFile;
-import com.android.sdklib.io.StreamException;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
@@ -438,7 +437,7 @@ public class IncludeFinder {
                     IStructuredModel model = null;
                     try {
                         IModelManager modelManager = StructuredModelManager.getModelManager();
-                        model = modelManager.getExistingModelForEdit(file);
+                        model = modelManager.getExistingModelForRead(file);
                         if (model instanceof IDOMModel) {
                             IDOMModel domModel = (IDOMModel) model;
                             Document document = domModel.getDocument();