aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-03-26 17:38:40 -0700
committerXavier Ducrohet <xav@android.com>2010-03-26 17:38:40 -0700
commit58e510428f69a020487520e9d995dee5291b44be (patch)
treeb18f3a453d1487a540e02e99b7e8cc1385a6f410 /eclipse
parent3aef63786a732dc066e229d2a8add1e031dcd376 (diff)
downloadsdk-58e510428f69a020487520e9d995dee5291b44be.zip
sdk-58e510428f69a020487520e9d995dee5291b44be.tar.gz
sdk-58e510428f69a020487520e9d995dee5291b44be.tar.bz2
ADT: Don't add duplicate source folder.
When a project is opened, and libraries are resolved, make sure that linked source folder are not already in the classpath entries before adding theme. Bug: 2549864 Change-Id: Ibb946b7e37ff3a9f3bae2c713e31b482c365cec3
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
index 1948761..76c057e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
@@ -1052,16 +1052,26 @@ public final class Sdk {
ArrayList<IClasspathEntry> list = new ArrayList<IClasspathEntry>(
Arrays.asList(entries));
- // add the new one.
+ // add the source folder to the classpath entries
IPath path = libSrc.getFullPath();
- list.add(JavaCore.newSourceEntry(path));
+ int count = list.size();
+ boolean foundMatch = false;
+ for (int i = 0 ; i < count ; i++) {
+ if (list.get(i).getPath().equals(path)) {
+ foundMatch = true;
+ break;
+ }
+ }
+ if (foundMatch == false) {
+ list.add(JavaCore.newSourceEntry(path));
+ }
// remove a previous one if needed (in case of a rename)
if (previousLibraryPath != null) {
String oldLibName = previousLibraryPath.lastSegment();
IPath oldEntryPath = new Path("/").append(project.getName()).append(oldLibName);
// first remove the class path entry.
- final int count = list.size();
+ count = list.size();
for (int i = 0 ; i < count ; i++) {
if (list.get(i).getPath().equals(oldEntryPath)) {
list.remove(i);