diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index c7bf891c0ec..d4b1a2475d1 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,3 +1,6 @@ +2004-06-09 Hoda Amer + Fix for PR 62656 : [Saving] a cpp file after copying/renaming a function in front of a constructor locks Eclipse + 2004-06-09 David Inglis added new ICDescriptor manager method to get a descriptor with the option of creating diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java index 81473c62f2d..56627cd9e0d 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElementDelta.java @@ -83,6 +83,15 @@ public interface ICElementDelta { */ public int F_MOVED_TO = 0x0020; + /** + * Change flag indicating that the element has changed position relatively to its siblings. + * If the element is an IPackageFragmentRoot, a classpath entry corresponding + * to the element has changed position in the project's classpath. + * + * @since 2.1 + */ + public int F_REORDER = 0x00100; + /** * Change flag indicating that the underlying IProject has been * opened. diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java index 9e8cad5628e..cfaa49243c3 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CElementDeltaBuilder.java @@ -1,4 +1,3 @@ -package org.eclipse.cdt.internal.core.model; /********************************************************************** * Copyright (c) 2002,2003 Rational Software Corporation and others. * All rights reserved. This program and the accompanying materials @@ -9,6 +8,7 @@ package org.eclipse.cdt.internal.core.model; * Contributors: * Rational Software - Initial API and implementation ***********************************************************************/ +package org.eclipse.cdt.internal.core.model; import java.util.ArrayList; import java.util.HashMap; @@ -175,8 +175,7 @@ private void findChangesInPositioning(ICElement element, int depth) throws CMode return; if (!isPositionedCorrectly(element)) { - this.delta.removed(element); - this.delta.added(element); + this.delta.changed(element, ICElementDelta.F_REORDER); } if (element instanceof IParent) { @@ -287,28 +286,19 @@ private boolean isIdentical(CElement e1, CElement e2) { */ private boolean isPositionedCorrectly(ICElement element) { ListItem oldListItem = this.getOldPosition(element); - if (oldListItem == null) - return false; - ICElement oldPrevious = oldListItem.previous; + if (oldListItem == null) return false; + ListItem newListItem = this.getNewPosition(element); - if (newListItem == null) - return false; - ICElement newPrevious = newListItem.previous; - if (oldPrevious == newPrevious) - return true; - ICElement lastNewPrevious = null; - while(lastNewPrevious != newPrevious) { - if (isIdentical((CElement)oldPrevious, (CElement)newPrevious)) - return true; - ICElement tempLastPrevious = lastNewPrevious; //JOHNC added this - lastNewPrevious = newPrevious; - // if newPrevious is null at this time we should exit the loop. - if (newPrevious == null) break; - ICElement tempPrevious = (this.getNewPosition(newPrevious)).previous; //JOHNC added this - if( tempLastPrevious == tempPrevious ) break; // JOHNC added this - newPrevious = tempPrevious; - } - return false; + if (newListItem == null) return false; + + ICElement oldPrevious = oldListItem.previous; + ICElement newPrevious = newListItem.previous; + + if (oldPrevious == null) { + return newPrevious == null; + } else { + return oldPrevious.equals(newPrevious); + } } private void putElementInfo(ICElement element, CElementInfo info) { this.infos.put(element, info);