IDEA-26195: Add application server library: incorrect scope

This commit is contained in:
nik
2010-11-18 10:28:24 +03:00
parent 90cfcf8186
commit e2272243e2
2 changed files with 13 additions and 1 deletions
@@ -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<Library> {
}
}
}
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<Library> createChooser() {
@@ -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<Eleme
return createLibrary(null);
}
@NotNull
public DependencyScope getDefaultDependencyScope() {
return DependencyScope.COMPILE;
}
public void fireLibraryRenamed(LibraryImpl library) {
myDispatcher.getMulticaster().afterLibraryRenamed(library);
}