mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Flex project configuration: remove dependency entry when library is deleted (AS-212)
This commit is contained in:
+5
@@ -76,4 +76,9 @@ public class UsageInArtifact extends ProjectStructureElementUsage {
|
||||
public Icon getIcon() {
|
||||
return myOriginalArtifact.getArtifactType().getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSourceElement() {
|
||||
removeElement();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-7
@@ -261,7 +261,8 @@ public abstract class BaseLibrariesConfigurable extends BaseStructureConfigurabl
|
||||
Collections.sort(types);
|
||||
|
||||
final StringBuilder sb = new StringBuilder("Library '");
|
||||
sb.append(library.getName()).append("' is used in ");
|
||||
Library libraryModel = myContext.getLibraryModel(library);
|
||||
sb.append(libraryModel != null ? libraryModel.getName() : library.getName()).append("' is used in ");
|
||||
for (int i = 0; i < types.size(); i++) {
|
||||
if (i > 0 && i == types.size() - 1) {
|
||||
sb.append(" and in ");
|
||||
@@ -284,13 +285,8 @@ public abstract class BaseLibrariesConfigurable extends BaseStructureConfigurabl
|
||||
if (DialogWrapper.OK_EXIT_CODE == Messages.showOkCancelDialog(myProject, sb.toString(),
|
||||
"Delete Library", Messages.getQuestionIcon())) {
|
||||
|
||||
final ModuleStructureConfigurable rootConfigurable = ModuleStructureConfigurable.getInstance(myProject);
|
||||
for (final ProjectStructureElementUsage usage : usages) {
|
||||
if (usage instanceof UsageInModuleClasspath) {
|
||||
rootConfigurable.removeLibraryOrderEntry(((ModuleProjectStructureElement)usage.getContainingElement()).getModule(), library);
|
||||
} else if (usage instanceof UsageInArtifact) {
|
||||
((UsageInArtifact)usage).removeElement();
|
||||
}
|
||||
usage.removeSourceElement();
|
||||
}
|
||||
|
||||
getModelProvider().getModifiableModel().removeLibrary(library);
|
||||
|
||||
+2
@@ -21,4 +21,6 @@ public abstract class ProjectStructureElementUsage {
|
||||
public abstract boolean equals(Object obj);
|
||||
|
||||
public abstract Icon getIcon();
|
||||
|
||||
public abstract void removeSourceElement();
|
||||
}
|
||||
|
||||
+9
@@ -2,6 +2,7 @@ package com.intellij.openapi.roots.ui.configuration.projectRoot.daemon;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -63,4 +64,12 @@ public class UsageInModuleClasspath extends ProjectStructureElementUsage {
|
||||
public Icon getIcon() {
|
||||
return ModuleType.get(myModule).getNodeIcon(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSourceElement() {
|
||||
if (mySourceElement instanceof LibraryProjectStructureElement) {
|
||||
ModuleStructureConfigurable.getInstance(myModule.getProject())
|
||||
.removeLibraryOrderEntry(myModule, ((LibraryProjectStructureElement)mySourceElement).getLibrary());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user