Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix PR 37064

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.91
diff -u -r1.91 ChangeLog
--- ChangeLog	25 Apr 2003 15:27:52 -0000	1.91
+++ ChangeLog	29 Apr 2003 17:23:46 -0000
@@ -1,3 +1,13 @@
+2003-04-29 Alain Magloire
+
+	PR 37064
+
+	* model/org/eclipse/cdt/internal/core/model/DelatProcessor.java (close):
+	New method, close the openable when content changed to flush the cache.
+	(contentChanged): Remove only use elementChanged().
+	* model/org/eclipse/cdt/internal/core/model/parser/ElfParser.java (getBinary):
+	Catch if path == null.
+
 2003-04-25 Alain Magloire
 
 	* model/org/eclipse/cdt/internal/core/model/Binary.java (getNeededSharedLibs):
Index: model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java,v
retrieving revision 1.8
diff -u -r1.8 DeltaProcessor.java
--- model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java	12 Apr 2003 14:03:54 -0000	1.8
+++ model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java	29 Apr 2003 17:23:46 -0000
@@ -45,17 +45,6 @@
 	ICElement movedFromElement = null;
 
 	/**
-	 * Generic processing for elements with changed contents:<ul>
-	 * <li>The element is closed such that any subsequent accesses will re-open
-	 * the element reflecting its new structure.
-	 * <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set).
-	 * </ul>
-	 */
-	protected void contentChanged(ICElement element, IResourceDelta delta) {
-		fCurrentDelta.changed(element, ICElementDelta.F_CONTENT);
-	}
-
-	/**
 	 * Creates the create corresponding to this resource.
 	 * Returns null if none was found.
 	 */
@@ -206,8 +195,29 @@
 		}
 	}
 
+	/*
+	 * Closes the given element, which removes it from the cache of open elements.
+	 */
+	private void close(Openable element) {
+		try {
+			element.close();
+		} catch (CModelException e) {
+			// do nothing
+		}
+	}
+
+	/**
+	 * Generic processing for elements with changed contents:<ul>
+	 * <li>The element is closed such that any subsequent accesses will re-open
+	 * the element reflecting its new structure.
+	 * <li>An entry is made in the delta reporting a content change (K_CHANGE with F_CONTENT flag set).
+	 * </ul>
+	 */
 	protected void elementChanged(ICElement element, IResourceDelta delta) {
-			fCurrentDelta.changed(element, ICElementDelta.F_CONTENT);
+		if (element instanceof Openable) {
+			close((Openable)element);
+		}
+		fCurrentDelta.changed(element, ICElementDelta.F_CONTENT);
 	}
 
 	/**
@@ -403,7 +413,7 @@
 				if ((flags & IResourceDelta.CONTENT) != 0) {
 					// content has changed
 					if (element != null) {
-						contentChanged(element, delta);
+						elementChanged(element, delta);
 						updateIndexAddResource(element, delta);
 					}
 				} else if (resource.getType() == IResource.PROJECT) {
Index: model/org/eclipse/cdt/internal/core/model/parser/ElfParser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/ElfParser.java,v
retrieving revision 1.5
diff -u -r1.5 ElfParser.java
--- model/org/eclipse/cdt/internal/core/model/parser/ElfParser.java	28 Feb 2003 21:29:37 -0000	1.5
+++ model/org/eclipse/cdt/internal/core/model/parser/ElfParser.java	29 Apr 2003 17:23:46 -0000
@@ -12,6 +12,7 @@
 import org.eclipse.cdt.utils.elf.AR;
 import org.eclipse.cdt.utils.elf.Elf;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 
 /**
  */
@@ -21,6 +22,9 @@
 	 * @see org.eclipse.cdt.core.model.IBinaryParser#getBinary(IPath)
 	 */
 	public IBinaryFile getBinary(IPath path) throws IOException {
+		if (path == null ) {
+			path = new Path("");
+		}
 		try {
 			Elf e = new Elf(path.toOSString());
 			e.dispose();



Back to the top