Permalink
Browse files

cleanup

  • Loading branch information...
cdracm committed Aug 22, 2017
1 parent 2944c84 commit 9adbba0b6fe279bcc65ad96ab7332d7bf5b59a83
Showing with 207 additions and 247 deletions.
  1. +19 −22 ...a-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java
  2. +1 −1 ...om/intellij/openapi/roots/ui/configuration/projectRoot/daemon/LibraryProjectStructureElement.java
  3. +2 −1 java/java-tests/testSrc/com/intellij/roots/InheritedJdkTest.java
  4. +1 −1 platform/core-impl/src/com/intellij/openapi/vfs/impl/VirtualFilePointerContainerImpl.java
  5. +2 −2 ...mpl/src/com/intellij/openapi/externalSystem/service/project/manage/AbstractModuleDataService.java
  6. +1 −1 ...ystem-impl/src/com/intellij/openapi/externalSystem/service/project/manage/LibraryDataService.java
  7. +2 −2 ...system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java
  8. +6 −6 platform/indexing-impl/src/com/intellij/openapi/module/impl/scopes/LibraryRuntimeClasspathScope.java
  9. +0 −36 platform/lang-api/src/com/intellij/openapi/roots/SearchingPolicy.java
  10. +1 −1 platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerComponent.java
  11. +3 −3 platform/lang-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerComponent.java
  12. +1 −12 platform/projectModel-api/src/com/intellij/openapi/roots/ModifiableRootModel.java
  13. +2 −2 platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootModel.java
  14. +4 −4 platform/projectModel-api/src/com/intellij/openapi/roots/OrderEntry.java
  15. +1 −1 platform/projectModel-api/src/com/intellij/openapi/roots/OrderEnumerationHandler.java
  16. +3 −1 platform/projectModel-api/src/com/intellij/openapi/roots/OrderRootType.java
  17. +9 −7 platform/projectModel-api/src/com/intellij/openapi/roots/RootPolicy.java
  18. +3 −2 platform/projectModel-api/src/com/intellij/openapi/roots/impl/libraries/LibraryEx.java
  19. +15 −8 platform/projectModel-api/src/com/intellij/openapi/roots/libraries/Library.java
  20. +7 −7 platform/projectModel-impl/src/com/intellij/openapi/roots/AnnotationOrderRootType.java
  21. +4 −1 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ClonableOrderEntry.java
  22. +1 −1 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ExcludeFolderImpl.java
  23. +7 −12 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/InheritedJdkOrderEntryImpl.java
  24. +1 −1 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/LibraryOrderEntryBaseImpl.java
  25. +1 −1 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModifiableModelCommitter.java
  26. +5 −5 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleFileIndexImpl.java
  27. +2 −2 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleJdkOrderEntryImpl.java
  28. +5 −4 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleLibraryOrderEntryImpl.java
  29. +11 −10 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleOrderEntryImpl.java
  30. +10 −10 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerImpl.java
  31. +11 −9 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleSourceOrderEntryImpl.java
  32. +24 −35 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderEnumeratorBase.java
  33. +17 −19 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/OrderRootsEnumeratorImpl.java
  34. +10 −6 platform/projectModel-impl/src/com/intellij/openapi/roots/impl/libraries/JarDirectories.java
  35. +1 −1 platform/projectModel-impl/src/com/intellij/project/model/impl/module/JpsRootModel.java
  36. +1 −0 platform/projectModel-impl/src/com/intellij/project/model/impl/module/content/JpsContentEntry.java
  37. +2 −1 ...Model-impl/src/com/intellij/project/model/impl/module/dependencies/JpsInheritedSdkOrderEntry.java
  38. +2 −1 ...ectModel-impl/src/com/intellij/project/model/impl/module/dependencies/JpsModuleSdkOrderEntry.java
  39. +5 −4 ...Model-impl/src/com/intellij/project/model/impl/module/dependencies/JpsModuleSourceOrderEntry.java
  40. +2 −2 ...ojectModel-impl/src/com/intellij/project/model/impl/module/dependencies/JpsSdkOrderEntryBase.java
  41. +2 −2 plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java
@@ -150,7 +150,7 @@ public void addNode(MyNode nodeToAdd, MyNode parent) {
final ArrayList<AnAction> result = super.createActions(fromPopup);
if (fromPopup) {
result.add(Separator.getInstance());
result.add(new FlattenModulesToggleAction(myProject, () -> true, () -> myFlattenModules, (value) -> {
result.add(new FlattenModulesToggleAction(myProject, () -> true, () -> myFlattenModules, value -> {
myFlattenModules = value;
regroupModules();
}));
@@ -306,8 +306,8 @@ private DefaultTreeModel getTreeModel() {
private ModuleGroupingTreeHelper<Module, MyNode> createGroupingHelper() {
ModuleGrouper grouper = getModuleGrouper();
ModuleGroupingImplementation<Module> grouping = ModuleGroupingTreeHelper.createDefaultGrouping(grouper);
return ModuleGroupingTreeHelper.forTree(myRoot, (node) -> node instanceof ModuleGroupNode ? ((ModuleGroupNode)node).getModuleGroup() : null,
(node) -> node instanceof ModuleNode ? ((ModuleNode)node).getModule() : null,
return ModuleGroupingTreeHelper.forTree(myRoot, node -> node instanceof ModuleGroupNode ? ((ModuleGroupNode)node).getModuleGroup() : null,
node -> node instanceof ModuleNode ? ((ModuleNode)node).getModule() : null,
!myHideModuleGroups && !myFlattenModules,
grouping, ModuleStructureConfigurable::createModuleGroupNode,
module -> createModuleNode(module, grouper), getNodeComparator());
@@ -316,7 +316,7 @@ private DefaultTreeModel getTreeModel() {
@Override
protected Comparator<MyNode> getNodeComparator() {
List<Comparator<MyNode>> comparators = ContainerUtil
.mapNotNull(ModuleStructureExtension.EP_NAME.getExtensions(), moduleStructureExtension -> moduleStructureExtension.getNodeComparator());
.mapNotNull(ModuleStructureExtension.EP_NAME.getExtensions(), ModuleStructureExtension::getNodeComparator);
return new MergingComparator<>(ContainerUtil.concat(comparators, Collections.singletonList(NODE_COMPARATOR)));
}
@@ -602,7 +602,7 @@ public String getId() {
@Nullable
public Module getModule(final String moduleName) {
if (moduleName == null) return null;
return (myContext != null && myContext.myModulesConfigurator != null)
return myContext != null && myContext.myModulesConfigurator != null
? myContext.myModulesConfigurator.getModule(moduleName)
: myModuleManager.findModuleByName(moduleName);
}
@@ -634,6 +634,7 @@ public ModuleNode(@NotNull ModuleConfigurable configurable, @Nullable ModuleGrou
myModuleAsGroup = moduleAsGroup;
}
@Override
public ModuleGroup getModuleGroup() {
return myModuleAsGroup;
}
@@ -680,7 +681,7 @@ protected void reloadNode(DefaultTreeModel treeModel) {
private static class ModuleGroupNodeImpl extends MyNode implements ModuleGroupNode {
private final ModuleGroup myModuleGroup;
public ModuleGroupNodeImpl(@NotNull NamedConfigurable configurable, @NotNull ModuleGroup moduleGroup) {
ModuleGroupNodeImpl(@NotNull NamedConfigurable configurable, @NotNull ModuleGroup moduleGroup) {
super(configurable, true);
myModuleGroup = moduleGroup;
}
@@ -692,7 +693,7 @@ public ModuleGroup getModuleGroup() {
}
private class FacetInModuleRemoveHandler extends RemoveConfigurableHandler<Facet> {
public FacetInModuleRemoveHandler() {
FacetInModuleRemoveHandler() {
super(FacetConfigurable.class);
}
@@ -707,7 +708,7 @@ public boolean remove(@NotNull Collection<Facet> facets) {
}
private class ModuleRemoveHandler extends RemoveConfigurableHandler<Module> {
public ModuleRemoveHandler() {
ModuleRemoveHandler() {
super(ModuleConfigurable.class);
}
@@ -732,7 +733,7 @@ public boolean remove(@NotNull Collection<Module> modules) {
}
private class MyDataProviderWrapper extends JPanel implements DataProvider {
public MyDataProviderWrapper(final JComponent component) {
MyDataProviderWrapper(final JComponent component) {
super(new BorderLayout());
add(component, BorderLayout.CENTER);
}
@@ -768,8 +769,7 @@ public Object getData(@NonNls String dataId) {
}
private class HideGroupsAction extends ToggleAction implements DumbAware {
public HideGroupsAction() {
HideGroupsAction() {
super("", "", AllIcons.ObjectBrowser.CompactEmptyPackages);
}
@@ -778,8 +778,7 @@ public void update(@NotNull
final AnActionEvent e) {
super.update(e);
final Presentation presentation = e.getPresentation();
String text;
text = ProjectBundle
String text = ProjectBundle
.message(myHideModuleGroups ? "project.roots.plain.mode.action.text.enabled" : "project.roots.plain.mode.action.text.disabled");
presentation.setText(text);
presentation.setDescription(text);
@@ -821,10 +820,9 @@ protected AbstractAddGroup createAddAction() {
public AnAction[] getChildren(@Nullable
final AnActionEvent e) {
ArrayList<AnAction> result = new ArrayList<>();
AnAction addModuleAction = new AddModuleAction(false);
addModuleAction.getTemplatePresentation().setText("New Module");
List<AnAction> result = new ArrayList<>();
result.add(addModuleAction);
AnAction importModuleAction = new AddModuleAction(true);
@@ -901,7 +899,7 @@ public void actionPerformed(final AnActionEvent e) {
dialogBuilder.setPreferredFocusComponent(component.getNameComponent());
dialogBuilder.setOkOperation(() -> {
final String name = component.getNameValue();
if (name.length() == 0) {
if (name.isEmpty()) {
Messages.showErrorDialog(ProjectBundle.message("enter.module.copy.name.error.message"), CommonBundle.message("title.error"));
return;
}
@@ -911,7 +909,7 @@ public void actionPerformed(final AnActionEvent e) {
return;
}
if (component.getPath().length() == 0) {
if (component.getPath().isEmpty()) {
Messages.showErrorDialog(IdeBundle.message("prompt.enter.project.file.location", modulePresentation),
CommonBundle.message("title.error"));
return;
@@ -931,7 +929,7 @@ public void actionPerformed(final AnActionEvent e) {
final String path = component.getPath();
final ModuleBuilder builder = new ModuleBuilder() {
@Override
public void setupRootModel(final ModifiableRootModel modifiableRootModel) throws ConfigurationException {
public void setupRootModel(final ModifiableRootModel modifiableRootModel) {
if (rootModel.isSdkInherited()) {
modifiableRootModel.inheritSdk();
}
@@ -949,8 +947,7 @@ public void setupRootModel(final ModifiableRootModel modifiableRootModel) throws
if (entry instanceof ModuleSourceOrderEntry) continue;
if (entry instanceof ClonableOrderEntry) {
modifiableRootModel.addOrderEntry(((ClonableOrderEntry)entry).cloneEntry((RootModelImpl)modifiableRootModel,
(ProjectRootManagerImpl)ProjectRootManager
.getInstance(myProject),
(ProjectRootManagerImpl)ProjectRootManager.getInstance(myProject),
VirtualFilePointerManager.getInstance()));
}
}
@@ -1000,7 +997,7 @@ public void update(final AnActionEvent e) {
private final boolean myImport;
public AddModuleAction(boolean anImport) {
AddModuleAction(boolean anImport) {
super(ProjectBundle.message("add.new.module.text.full"), null, AllIcons.Actions.Module);
myImport = anImport;
}
@@ -1014,7 +1011,7 @@ public void actionPerformed(final AnActionEvent e) {
private static class MergingComparator<T> implements Comparator<T> {
private final List<Comparator<T>> myDelegates;
public MergingComparator(final List<Comparator<T>> delegates) {
MergingComparator(final List<Comparator<T>> delegates) {
myDelegates = delegates;
}
@@ -78,7 +78,7 @@ public void check(ProjectStructureProblemsHolder problemsHolder) {
}
private void reportInvalidRoots(ProjectStructureProblemsHolder problemsHolder, LibraryEx library,
final OrderRootType type, String rootName, final ProjectStructureProblemType problemType) {
@NotNull OrderRootType type, String rootName, final ProjectStructureProblemType problemType) {
final List<String> invalidUrls = library.getInvalidRootUrls(type);
if (!invalidUrls.isEmpty()) {
final String description = createInvalidRootsDescription(invalidUrls, rootName, library.getName());
@@ -26,6 +26,7 @@
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.ModuleTestCase;
import junit.framework.Assert;
import org.jetbrains.annotations.NotNull;
/**
* @author dsl
@@ -84,7 +85,7 @@ public void test2() {
Assert.assertEquals("Correct non-existing JDK inherited", "jdk1",
rootManager.orderEntries().process(new RootPolicy<String>() {
@Override
public String visitInheritedJdkOrderEntry(InheritedJdkOrderEntry inheritedJdkOrderEntry, String s) {
public String visitInheritedJdkOrderEntry(@NotNull InheritedJdkOrderEntry inheritedJdkOrderEntry, String s) {
return inheritedJdkOrderEntry.getJdkName();
}
}, null));
@@ -42,7 +42,7 @@
/**
* @author dsl
*/
public class VirtualFilePointerContainerImpl extends TraceableDisposable implements VirtualFilePointerContainer, Disposable {
class VirtualFilePointerContainerImpl extends TraceableDisposable implements VirtualFilePointerContainer, Disposable {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vfs.pointers.VirtualFilePointerContainer");
@NotNull private final List<VirtualFilePointer> myList = ContainerUtil.createLockFreeCopyOnWriteList();
@NotNull private final VirtualFilePointerManager myVirtualFilePointerManager;
@@ -132,13 +132,13 @@ private void createModules(@NotNull Collection<DataNode<E>> toCreate,
RootPolicy<Object> visitor = new RootPolicy<Object>() {
@Override
public Object visitLibraryOrderEntry(LibraryOrderEntry libraryOrderEntry, Object value) {
public Object visitLibraryOrderEntry(@NotNull LibraryOrderEntry libraryOrderEntry, Object value) {
modifiableRootModel.removeOrderEntry(libraryOrderEntry);
return value;
}
@Override
public Object visitModuleOrderEntry(ModuleOrderEntry moduleOrderEntry, Object value) {
public Object visitModuleOrderEntry(@NotNull ModuleOrderEntry moduleOrderEntry, Object value) {
modifiableRootModel.removeOrderEntry(moduleOrderEntry);
return value;
}
@@ -225,7 +225,7 @@ private static boolean isOrphanProjectLibrary(@NotNull final Library library,
@NotNull final IdeModifiableModelsProvider modelsProvider) {
RootPolicy<Boolean> visitor = new RootPolicy<Boolean>() {
@Override
public Boolean visitLibraryOrderEntry(LibraryOrderEntry ideDependency, Boolean value) {
public Boolean visitLibraryOrderEntry(@NotNull LibraryOrderEntry ideDependency, Boolean value) {
return !ideDependency.isModuleLevel() &&
(library == ideDependency.getLibrary() ||
(ideDependency.getLibrary() == null && StringUtil.equals(library.getName(), ideDependency.getLibraryName())));
@@ -281,13 +281,13 @@ protected void assertExportedDeps(String moduleName, String... expectedDeps) {
getRootManager(moduleName).orderEntries().withoutSdk().withoutModuleSourceEntries().exportedOnly().process(new RootPolicy<Object>() {
@Override
public Object visitModuleOrderEntry(ModuleOrderEntry e, Object value) {
public Object visitModuleOrderEntry(@NotNull ModuleOrderEntry e, Object value) {
actual.add(e.getModuleName());
return null;
}
@Override
public Object visitLibraryOrderEntry(LibraryOrderEntry e, Object value) {
public Object visitLibraryOrderEntry(@NotNull LibraryOrderEntry e, Object value) {
actual.add(e.getLibraryName());
return null;
}
@@ -92,8 +92,8 @@ private void buildEntries(@NotNull final Module module,
ModuleRootManager.getInstance(module).orderEntries().recursively().satisfying(condition).process(new RootPolicy<Set<VirtualFile>>() {
@Override
public Set<VirtualFile> visitLibraryOrderEntry(final LibraryOrderEntry libraryOrderEntry,
final Set<VirtualFile> value) {
public Set<VirtualFile> visitLibraryOrderEntry(@NotNull final LibraryOrderEntry libraryOrderEntry,
final Set<VirtualFile> value) {
final Library library = libraryOrderEntry.getLibrary();
if (library != null && processedLibraries.add(library)) {
ContainerUtil.addAll(value, libraryOrderEntry.getRootFiles(OrderRootType.CLASSES));
@@ -103,15 +103,15 @@ private void buildEntries(@NotNull final Module module,
}
@Override
public Set<VirtualFile> visitModuleSourceOrderEntry(final ModuleSourceOrderEntry moduleSourceOrderEntry,
final Set<VirtualFile> value) {
public Set<VirtualFile> visitModuleSourceOrderEntry(@NotNull final ModuleSourceOrderEntry moduleSourceOrderEntry,
final Set<VirtualFile> value) {
processedModules.add(moduleSourceOrderEntry.getOwnerModule());
ContainerUtil.addAll(value, moduleSourceOrderEntry.getRootModel().getSourceRoots());
return value;
}
@Override
public Set<VirtualFile> visitModuleOrderEntry(ModuleOrderEntry moduleOrderEntry, Set<VirtualFile> value) {
public Set<VirtualFile> visitModuleOrderEntry(@NotNull ModuleOrderEntry moduleOrderEntry, Set<VirtualFile> value) {
final Module depModule = moduleOrderEntry.getModule();
if (depModule != null) {
ContainerUtil.addAll(value, ModuleRootManager.getInstance(depModule).getSourceRoots());
@@ -120,7 +120,7 @@ private void buildEntries(@NotNull final Module module,
}
@Override
public Set<VirtualFile> visitJdkOrderEntry(final JdkOrderEntry jdkOrderEntry, final Set<VirtualFile> value) {
public Set<VirtualFile> visitJdkOrderEntry(@NotNull final JdkOrderEntry jdkOrderEntry, final Set<VirtualFile> value) {
final Sdk jdk = jdkOrderEntry.getJdk();
if (jdk != null && processedSdk.add(jdk)) {
ContainerUtil.addAll(value, jdkOrderEntry.getRootFiles(OrderRootType.CLASSES));

This file was deleted.

Oops, something went wrong.
@@ -60,7 +60,7 @@ public Resolution getResolution(@NotNull Storage storage, @NotNull StateStorageO
// IDEA-133480 Eclipse integration: .iml content is not reduced on setting Dependencies Storage Format = Eclipse
// We clear any storage except eclipse (because we must not clear shared files).
// Currently there is only one known non-default storage - ExternalProjectStorage.
return isEffectiveStorage ? Resolution.DO : (isClasspathStorage ? Resolution.SKIP : Resolution.CLEAR);
return isEffectiveStorage ? Resolution.DO : isClasspathStorage ? Resolution.SKIP : Resolution.CLEAR;
}
}
@@ -67,8 +67,8 @@
public class ProjectRootManagerComponent extends ProjectRootManagerImpl implements ProjectComponent, Disposable {
private static final Logger LOG = Logger.getInstance(ProjectRootManagerComponent.class);
private boolean myPointerChangesDetected = false;
private int myInsideRefresh = 0;
private boolean myPointerChangesDetected;
private int myInsideRefresh;
private final BatchUpdateListener myHandler;
private final MessageBusConnection myConnection;
@@ -168,7 +168,7 @@ private void doUpdateOnRefresh() {
}
}
private boolean affectsRoots(VirtualFilePointer[] pointers) {
private boolean affectsRoots(@NotNull VirtualFilePointer[] pointers) {
Pair<Set<String>, Set<String>> roots = getAllRoots(true);
if (roots == null) return false;
@@ -32,7 +32,7 @@
* @see ModuleRootManager#getModifiableModel()
*/
public interface ModifiableRootModel extends ModuleRootModel {
@NotNull
Project getProject();
/**
@@ -78,10 +78,6 @@
/**
* Adds an entry for invalid library.
*
* @param name
* @param level
* @return
*/
@NotNull
LibraryOrderEntry addInvalidLibrary(@NotNull @NonNls String name, @NotNull String level);
@@ -97,14 +93,9 @@
/**
* Removes order entry from an order.
*
* @param orderEntry
*/
void removeOrderEntry(@NotNull OrderEntry orderEntry);
/**
* @param newOrder
*/
void rearrangeOrderEntries(@NotNull OrderEntry[] newOrder);
void clear();
@@ -137,8 +128,6 @@
/**
* Sets JDK for this module to a specific value
*
* @param jdk
*/
void setSdk(@Nullable Sdk jdk);
Oops, something went wrong.

0 comments on commit 9adbba0

Please sign in to comment.