From e2272243e2bdd3012824934e27ca100ccbe54f8d Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 18 Nov 2010 10:28:24 +0300 Subject: [PATCH] IDEA-26195: Add application server library: incorrect scope --- .../ui/configuration/classpath/AddLibraryAction.java | 8 +++++++- .../openapi/roots/impl/libraries/LibraryTableBase.java | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/AddLibraryAction.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/AddLibraryAction.java index 09711c05fd54..dd9e33cac3b5 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/AddLibraryAction.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/AddLibraryAction.java @@ -20,6 +20,7 @@ import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.roots.LibraryOrderEntry; import com.intellij.openapi.roots.ModifiableRootModel; import com.intellij.openapi.roots.OrderEntry; +import com.intellij.openapi.roots.impl.libraries.LibraryTableBase; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.libraries.LibraryTable; import com.intellij.openapi.roots.ui.configuration.libraries.LibraryEditingUtil; @@ -98,7 +99,12 @@ class AddLibraryAction extends AddItemPopupAction { } } } - return ClasspathTableItem.createLibItem(rootModel.addLibraryEntry(item), myContext); + final LibraryOrderEntry orderEntry = rootModel.addLibraryEntry(item); + final LibraryTable table = item.getTable(); + if (table instanceof LibraryTableBase) { + orderEntry.setScope(((LibraryTableBase)table).getDefaultDependencyScope()); + } + return ClasspathTableItem.createLibItem(orderEntry, myContext); } protected ClasspathElementChooser createChooser() { diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTableBase.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTableBase.java index ab579a6d437b..ce6f10e57346 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTableBase.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/libraries/LibraryTableBase.java @@ -20,6 +20,7 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.roots.DependencyScope; import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.libraries.LibraryTable; @@ -125,6 +126,11 @@ public abstract class LibraryTableBase implements PersistentStateComponent