aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2014-02-25 09:00:19 (EST)
committerMike Rennie2014-02-25 09:00:19 (EST)
commita394a58fe4aac2e77e8c9a7e5c2fe78b4f6502e4 (patch)
treeefa1ea62164723dcce92324dc5b896b209acd090
parentd3fb8a17a2acb440ca71716dd914d498dcdd6ad5 (diff)
downloadeclipse.jdt.debug-a394a58fe4aac2e77e8c9a7e5c2fe78b4f6502e4.zip
eclipse.jdt.debug-a394a58fe4aac2e77e8c9a7e5c2fe78b4f6502e4.tar.gz
eclipse.jdt.debug-a394a58fe4aac2e77e8c9a7e5c2fe78b4f6502e4.tar.bz2
Bug 295401 - [breakpoints] Renaming Java project with a breakpointI20140225-1430
throws an exception Signed-off-by: Sarika Sinha <sarika.sinha@in.ibm.com>
-rw-r--r--org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointRenameProjectParticipant.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointRenameProjectParticipant.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointRenameProjectParticipant.java
index 52dc7a2..8825e1a 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointRenameProjectParticipant.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/core/refactoring/BreakpointRenameProjectParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,8 +25,10 @@ import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.debug.core.IJavaBreakpoint;
import org.eclipse.jdt.internal.debug.ui.BreakpointUtils;
+import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
import org.eclipse.ltk.core.refactoring.Change;
/**
@@ -66,7 +68,7 @@ public class BreakpointRenameProjectParticipant extends BreakpointRenameParticip
if (root.isArchive()) {
rootResource = project.getFile(root.getElementName());
} else {
- rootResource = project.getFolder(root.getElementName());
+ rootResource = project.getFolder(getRootName(root));
}
}
IPackageFragmentRoot destRoot = destProject.getPackageFragmentRoot(rootResource);
@@ -89,4 +91,17 @@ public class BreakpointRenameProjectParticipant extends BreakpointRenameParticip
}
}
+ /*
+ * (non-Javadoc) returns the root folder path. root.getElementName() does not work if src folder has layers of folders
+ */
+ private String getRootName(IPackageFragmentRoot root) {
+ try {
+ IResource resource = root.getCorrespondingResource();
+ return resource.getFullPath().removeFirstSegments(1).toString();
+ }
+ catch (JavaModelException e) {
+ JDIDebugUIPlugin.log(e);
+ }
+ return root.getElementName();
+ }
}