diff options
author | Xavier Ducrohet <xav@android.com> | 2010-03-01 17:01:18 -0800 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2010-03-02 10:29:07 -0800 |
commit | f39e6b7b433c9c90226519d20a2084c9eecb9f22 (patch) | |
tree | 77d103c963fb53a2f43b980fedf049475e281a9e | |
parent | 4aa16d7cdee638337e2c37a9ea9bf7ee336222cc (diff) | |
download | sdk-f39e6b7b433c9c90226519d20a2084c9eecb9f22.zip sdk-f39e6b7b433c9c90226519d20a2084c9eecb9f22.tar.gz sdk-f39e6b7b433c9c90226519d20a2084c9eecb9f22.tar.bz2 |
ADT: Setup projects that are opened after their libraries.
Change-Id: I2e556b8b993dda29feaff272d44b6b048597f8a7
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java | 28 |
1 files changed, 24 insertions, 4 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 0767c95..724ac96 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 @@ -333,7 +333,6 @@ public final class Sdk { return; } - synchronized (sLock) { boolean resolveProject = false; @@ -802,8 +801,30 @@ public final class Sdk { if (openedState != null) { // find dependencies, if any if (openedState.isMissingLibraries()) { - // FIXME look for all opened projects to see if they are valid library - // for this project. + // the opened project depends on some libraries. + // Look for all other opened projects to see if any is a library for it. + // if they are, fix its LibraryState to get the IProject reference and + // link the two projects with the linked source folder. + boolean foundLibrary = false; + synchronized (sLock) { + for (ProjectState projectState : sProjectStateMap.values()) { + if (projectState != openedState) { + LibraryState libState = openedState.needs( + projectState.getProject()); + + if (libState != null) { + foundLibrary = true; + linkProjectAndLibrary(openedState, libState, null); + } + } + } + } + + // force a recompile of the main project through a job + // (tree is locked) + if (recompile && foundLibrary) { + recompile(openedState.getProject()); + } } // if the project is a library, then try to see if it's required by other projects. @@ -1138,7 +1159,6 @@ public final class Sdk { */ private void recompile(final IProject project) { Job job = new Job("Project recompilation trigger") { //$NON-NLS-1$ - @Override protected IStatus run(IProgressMonitor monitor) { try { |