Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorbjörn Svensson2021-02-06 12:58:07 +0000
committerSarika Sinha2021-02-13 07:05:47 +0000
commitacf4c9657f642ebd1ca26ec12724e80443c84820 (patch)
tree06e74546506b87b33e37793a8cfd90629600c573
parentab4870b76608bafa5e0ce9140d904f58e24bf7fc (diff)
downloadeclipse.platform.debug-I20210215-0700.tar.gz
eclipse.platform.debug-I20210215-0700.tar.xz
eclipse.platform.debug-I20210215-0700.zip
When updating the container for a launch configuration, make sure that the new and the old container do not point to the same location. Nested projects can have different container instances that points to the same location and a switch between these containers should not be considered a "move" of the launch configuration. Contributed by STMicroelectronics Change-Id: I504f351b8ae9a6544c86659f99151a81059a7e38 Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
index 0141dd4ad..8a4959bc7 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java
@@ -25,6 +25,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import org.eclipse.core.filesystem.EFS;
@@ -35,6 +36,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -608,13 +610,8 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
}
IContainer newContainer = getContainer();
IContainer originalContainer = ((LaunchConfiguration)getOriginal()).getContainer();
- if (newContainer == originalContainer) {
- return false;
- }
- if (newContainer == null) {
- return !originalContainer.equals(newContainer);
- }
- return !newContainer.equals(originalContainer);
+
+ return !isSameContainerLocation(newContainer, originalContainer);
}
/**
@@ -636,9 +633,22 @@ public class LaunchConfigurationWorkingCopy extends LaunchConfiguration implemen
return fSuppressChange;
}
+ private boolean isSameContainerLocation(IContainer newContainer, IContainer originalContainer) {
+ // Verify that containers are not nested
+ if (newContainer != null && originalContainer != null) {
+ IPath newPath = newContainer.getLocation();
+ IPath originalPath = originalContainer.getLocation();
+
+ if (Objects.equals(newPath, originalPath)) {
+ return true;
+ }
+ }
+ return Objects.equals(newContainer, originalContainer);
+ }
+
@Override
public void setContainer(IContainer container) {
- if (equalOrNull(getContainer(), container)) {
+ if (isSameContainerLocation(container, getContainer())) {
return;
}
super.setContainer(container);

Back to the top