From eb03498efbb8847402d3629cb97377762eeb2340 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Mon, 15 Aug 2016 15:21:40 +0300 Subject: [PATCH] maven: clean-up --- .../maven/project/MavenArtifactIndex.java | 4 ++-- .../project/MavenDisablePanelCheckbox.java | 3 ++- .../idea/maven/project/MavenGeneralPanel.java | 24 ++++--------------- .../project/MavenGeneralSettingsEditor.java | 4 ++-- .../idea/maven/project/MavenProject.java | 1 - .../idea/maven/project/MavenProjectsTree.java | 12 +++++----- ...esourceCompilerConfigurationGenerator.java | 7 ++---- .../DownloadSelectedSourcesAndDocsAction.java | 2 +- .../actions/MavenShowEffectivePom.java | 1 - .../OpenOrCreateSettingsXmlAction.java | 4 ++-- .../idea/maven/utils/ManifestBuilder.java | 4 ++-- .../utils/MavenAttachSourcesProvider.java | 4 +--- .../idea/maven/utils/MavenJDOMUtil.java | 4 ++-- .../org/jetbrains/idea/maven/utils/Path.java | 4 ++-- .../maven/wizards/MavenArchetypesStep.java | 3 ++- .../wizards/MavenModuleBuilderHelper.java | 21 ++++++++++------ .../maven/wizards/MavenProjectBuilder.java | 2 +- .../maven/wizards/MavenProjectImportStep.java | 13 +++++----- .../wizards/MavenProjectOpenProcessor.java | 4 ++-- 19 files changed, 53 insertions(+), 68 deletions(-) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenArtifactIndex.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenArtifactIndex.java index a5373700572f..cb18beeed451 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenArtifactIndex.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenArtifactIndex.java @@ -18,7 +18,7 @@ import java.util.Map; */ public class MavenArtifactIndex { - private static final MavenArtifactIndex EMPTY_INDEX = new MavenArtifactIndex(Collections.>>emptyMap()); + private static final MavenArtifactIndex EMPTY_INDEX = new MavenArtifactIndex(Collections.emptyMap()); private final Map>> myData; @@ -36,7 +36,7 @@ public class MavenArtifactIndex { if (groupMap == null) return Collections.emptyList(); List res = groupMap.get(artifactId); - return res == null ? Collections.emptyList() : res; + return res == null ? Collections.emptyList() : res; } @NotNull diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenDisablePanelCheckbox.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenDisablePanelCheckbox.java index ed6e97b9374e..b840c062e58d 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenDisablePanelCheckbox.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenDisablePanelCheckbox.java @@ -16,6 +16,7 @@ package org.jetbrains.idea.maven.project; import com.intellij.openapi.util.Pair; +import com.intellij.ui.JBColor; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -87,7 +88,7 @@ public class MavenDisablePanelCheckbox extends JCheckBox { @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); - Color c = enabled ? Color.GRAY : Color.LIGHT_GRAY; + Color c = enabled ? JBColor.GRAY : JBColor.LIGHT_GRAY; setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, c), BorderFactory.createEmptyBorder(10, 0, 0, 0))); } }; diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenGeneralPanel.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenGeneralPanel.java index 312f0f2ab998..82703039965a 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenGeneralPanel.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenGeneralPanel.java @@ -64,41 +64,25 @@ public class MavenGeneralPanel implements PanelWithAnchor { private void fillOutputLevelCombobox() { ComboBoxUtil.setModel(outputLevelCombo, outputLevelComboModel, Arrays.asList(MavenExecutionOptions.LoggingLevel.values()), - new Function>() { - public Pair fun(MavenExecutionOptions.LoggingLevel each) { - return Pair.create(each.getDisplayString(), each); - } - }); + each -> Pair.create(each.getDisplayString(), each)); } private void fillFailureBehaviorCombobox() { ComboBoxUtil.setModel(failPolicyCombo, failPolicyComboModel, Arrays.asList(MavenExecutionOptions.FailureMode.values()), - new Function>() { - public Pair fun(MavenExecutionOptions.FailureMode each) { - return Pair.create(each.getDisplayString(), each); - } - }); + each -> Pair.create(each.getDisplayString(), each)); } private void fillChecksumPolicyCombobox() { ComboBoxUtil.setModel(checksumPolicyCombo, checksumPolicyComboModel, Arrays.asList(MavenExecutionOptions.ChecksumPolicy.values()), - new Function>() { - public Pair fun(MavenExecutionOptions.ChecksumPolicy each) { - return Pair.create(each.getDisplayString(), each); - } - }); + each -> Pair.create(each.getDisplayString(), each)); } private void fillPluginUpdatePolicyCombobox() { ComboBoxUtil.setModel(pluginUpdatePolicyCombo, pluginUpdatePolicyComboModel, Arrays.asList(MavenExecutionOptions.PluginUpdatePolicy.values()), - new Function>() { - public Pair fun(MavenExecutionOptions.PluginUpdatePolicy each) { - return Pair.create(each.getDisplayString(), each); - } - }); + each -> Pair.create(each.getDisplayString(), each)); } public JComponent createComponent() { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenGeneralSettingsEditor.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenGeneralSettingsEditor.java index 69a4e50ee09d..a0f559dcb083 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenGeneralSettingsEditor.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenGeneralSettingsEditor.java @@ -41,7 +41,7 @@ public class MavenGeneralSettingsEditor extends SettingsEditor modules = myAggregatorToModuleMapping.get(aggregator); return modules == null - ? Collections.emptyList() + ? Collections.emptyList() : new ArrayList<>(modules); } finally { @@ -1164,7 +1164,7 @@ public class MavenProjectsTree { } } - return result == null ? Collections.emptyList() : result; + return result == null ? Collections.emptyList() : result; } finally { readUnlock(); @@ -1214,7 +1214,7 @@ public class MavenProjectsTree { } } - return result == null ? Collections.emptyList() : result; + return result == null ? Collections.emptyList() : result; } finally { readUnlock(); @@ -1501,10 +1501,10 @@ public class MavenProjectsTree { public void fireUpdatedIfNecessary() { if (updatedProjectsWithChanges.isEmpty() && deletedProjects.isEmpty()) return; List mavenProjects = deletedProjects.isEmpty() - ? Collections.emptyList() + ? Collections.emptyList() : new ArrayList<>(deletedProjects); List> updated = updatedProjectsWithChanges.isEmpty() - ? Collections.>emptyList() + ? Collections.emptyList() : MavenUtil.mapToList(updatedProjectsWithChanges); fireProjectsUpdated(updated, mavenProjects); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenResourceCompilerConfigurationGenerator.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenResourceCompilerConfigurationGenerator.java index a37028107cb6..352d0ddbf901 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenResourceCompilerConfigurationGenerator.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenResourceCompilerConfigurationGenerator.java @@ -14,10 +14,7 @@ import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.StreamUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.CharsetToolkit; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.VfsUtil; -import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.*; import com.intellij.util.Base64; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.XmlSerializer; @@ -468,7 +465,7 @@ public class MavenResourceCompilerConfigurationGenerator { ? compilerModuleExtension.getCompilerOutputUrlForTests() : compilerModuleExtension.getCompilerOutputUrl(); - cfg.targetPath = VfsUtil.urlToPath(compilerOutputUrl); + cfg.targetPath = VfsUtilCore.urlToPath(compilerOutputUrl); convertIdeaExcludesToMavenExcludes(cfg, (CompilerConfigurationImpl)compilerConfiguration); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadSelectedSourcesAndDocsAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadSelectedSourcesAndDocsAction.java index 680d94f81bac..bfd83be2d008 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadSelectedSourcesAndDocsAction.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadSelectedSourcesAndDocsAction.java @@ -47,7 +47,7 @@ public class DownloadSelectedSourcesAndDocsAction extends MavenProjectsAction { private static Collection getDependencies(AnActionEvent e) { Collection result = e.getData(MavenDataKeys.MAVEN_DEPENDENCIES); - return result == null ? Collections.emptyList() : result; + return result == null ? Collections.emptyList() : result; } protected void perform(@NotNull MavenProjectsManager manager, List mavenProjects, AnActionEvent e) { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/MavenShowEffectivePom.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/MavenShowEffectivePom.java index 46d6b76b9fa6..78f07e4ca15b 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/MavenShowEffectivePom.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/MavenShowEffectivePom.java @@ -13,7 +13,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFileFactory; -import com.intellij.util.NullableConsumer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.project.MavenProject; diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/OpenOrCreateSettingsXmlAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/OpenOrCreateSettingsXmlAction.java index f0ef576721a5..f6a8b1030273 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/OpenOrCreateSettingsXmlAction.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/OpenOrCreateSettingsXmlAction.java @@ -27,9 +27,9 @@ import java.util.List; public class OpenOrCreateSettingsXmlAction extends MavenOpenOrCreateFilesAction { protected List getFiles(AnActionEvent e) { final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(e.getDataContext()); - if(projectsManager == null) return Collections.emptyList(); + if(projectsManager == null) return Collections.emptyList(); File file = projectsManager.getGeneralSettings().getEffectiveUserSettingsIoFile(); - return file != null ? Collections.singletonList(file) : Collections.emptyList(); + return file != null ? Collections.singletonList(file) : Collections.emptyList(); } @Override diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/ManifestBuilder.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/ManifestBuilder.java index 67fe874d69dc..4647b4e810c2 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/ManifestBuilder.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/ManifestBuilder.java @@ -71,7 +71,7 @@ public class ManifestBuilder { final Element mavenArchiveConfiguration = mavenPackagingPluginConfiguration != null ? mavenPackagingPluginConfiguration.getChild("archive") : null; - if (mavenArchiveConfiguration == null) return getDefaultManifest(Collections.emptyMap()); + if (mavenArchiveConfiguration == null) return getDefaultManifest(Collections.emptyMap()); final Element manifestEntries = mavenArchiveConfiguration.getChild("manifestEntries"); Map entries = getManifestEntries(manifestEntries); @@ -139,7 +139,7 @@ public class ManifestBuilder { boolean hasManifestEntries = manifestEntries != null && manifestEntries.getContentSize() > 0; Map entries = hasManifestEntries ? new LinkedHashMap<>(manifestEntries.getContentSize()) : - Collections.emptyMap(); + Collections.emptyMap(); if (hasManifestEntries) { for (Element element : manifestEntries.getChildren()) { entries.put(element.getName(), element.getTextTrim()); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenAttachSourcesProvider.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenAttachSourcesProvider.java index ebe56ff3ea6b..a6171f3719d1 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenAttachSourcesProvider.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenAttachSourcesProvider.java @@ -27,7 +27,6 @@ import com.intellij.openapi.roots.LibraryOrderEntry; import com.intellij.openapi.roots.OrderEntry; import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.roots.ProjectRootManager; -import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.util.ActionCallback; import com.intellij.openapi.util.AsyncResult; import com.intellij.openapi.vfs.LocalFileSystem; @@ -36,7 +35,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.util.Consumer; import com.intellij.util.PathUtil; -import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.maven.importing.MavenRootModelAdapter; @@ -63,7 +61,7 @@ public class MavenAttachSourcesProvider implements AttachSourcesProvider { if (projects.isEmpty()) return Collections.emptyList(); if (findArtifacts(projects, orderEntries).isEmpty()) return Collections.emptyList(); - return Collections.singleton(new AttachSourcesAction() { + return Collections.singleton(new AttachSourcesAction() { @Override public String getName() { return ProjectBundle.message("maven.action.download.sources"); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenJDOMUtil.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenJDOMUtil.java index 2b4f1c09ecf7..0c6f7e0fc848 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenJDOMUtil.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenJDOMUtil.java @@ -20,7 +20,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; -import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.encoding.EncodingRegistry; import com.intellij.psi.impl.source.parsing.xml.XmlBuilder; @@ -42,7 +42,7 @@ public class MavenJDOMUtil { if (!file.isValid()) return null; try { - text = VfsUtil.loadText(file); + text = VfsUtilCore.loadText(file); } catch (IOException e) { if (handler != null) handler.onReadError(e); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/Path.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/Path.java index 6b390e7a5ed3..c655d7c689c8 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/Path.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/Path.java @@ -16,7 +16,7 @@ package org.jetbrains.idea.maven.utils; import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.util.PathUtil; import org.jetbrains.annotations.NotNull; @@ -35,7 +35,7 @@ public class Path { } public Url toUrl() { - return new Url(VfsUtil.pathToUrl(path)); + return new Url(VfsUtilCore.pathToUrl(path)); } @Override diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenArchetypesStep.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenArchetypesStep.java index 7e5844e96e2b..062ffcc5992e 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenArchetypesStep.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenArchetypesStep.java @@ -27,6 +27,7 @@ import com.intellij.util.containers.Convertor; import com.intellij.util.ui.AsyncProcessIcon; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.tree.TreeUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.indices.MavenIndicesManager; import org.jetbrains.idea.maven.model.MavenArchetype; @@ -306,7 +307,7 @@ public class MavenArchetypesStep extends ModuleWizardStep implements Disposable } private static class MyRenderer extends ColoredTreeCellRenderer { - public void customizeCellRenderer(JTree tree, + public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleBuilderHelper.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleBuilderHelper.java index aecba9e017a4..cec986c14538 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleBuilderHelper.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenModuleBuilderHelper.java @@ -106,9 +106,11 @@ public class MavenModuleBuilderHelper { if (myAggregatorProject != null) { MavenDomProjectModel model = MavenDomUtil.getMavenDomProjectModel(project, myAggregatorProject.getFile()); - model.getPackaging().setStringValue("pom"); - MavenDomModule module = model.getModules().addModule(); - module.setValue(getPsiFile(project, file)); + if (model != null) { + model.getPackaging().setStringValue("pom"); + MavenDomModule module = model.getModules().addModule(); + module.setValue(getPsiFile(project, file)); + } } } }.execute().getResultObject(); @@ -166,8 +168,10 @@ public class MavenModuleBuilderHelper { pom.putUserData(MavenProjectsManagerWatcher.FORCE_IMPORT_AND_RESOLVE_ON_REFRESH, Boolean.TRUE); try { Document doc = FileDocumentManager.getInstance().getDocument(pom); - PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(doc); - FileDocumentManager.getInstance().saveDocument(doc); + if (doc != null) { + PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(doc); + FileDocumentManager.getInstance().saveDocument(doc); + } } finally { pom.putUserData(MavenProjectsManagerWatcher.FORCE_IMPORT_AND_RESOLVE_ON_REFRESH, null); @@ -194,7 +198,7 @@ public class MavenModuleBuilderHelper { MavenRunnerParameters params = new MavenRunnerParameters( false, workingDir.getPath(), Collections.singletonList("org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate"), - Collections.emptyList()); + Collections.emptyList()); MavenRunner runner = MavenRunner.getInstance(project); MavenRunnerSettings settings = runner.getState().clone(); @@ -217,7 +221,10 @@ public class MavenModuleBuilderHelper { private void copyGeneratedFiles(File workingDir, VirtualFile pom, Project project) { try { - FileUtil.copyDir(new File(workingDir, myProjectId.getArtifactId()), new File(pom.getParent().getPath())); + String artifactId = myProjectId.getArtifactId(); + if (artifactId != null) { + FileUtil.copyDir(new File(workingDir, artifactId), new File(pom.getParent().getPath())); + } } catch (IOException e) { showError(project, e); diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectBuilder.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectBuilder.java index 38439cc5f799..a20a37fae063 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectBuilder.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectBuilder.java @@ -134,7 +134,7 @@ public class MavenProjectBuilder extends ProjectImportBuilder { : new IdeModifiableModelsProviderImpl(project)); } - private void appendProfilesFromString(Collection selectedProfiles, String profilesList) { + private static void appendProfilesFromString(Collection selectedProfiles, String profilesList) { if (profilesList == null) return; for (String profile : StringUtil.split(profilesList, ",")) { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectImportStep.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectImportStep.java index 632663e077b5..aac763372539 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectImportStep.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectImportStep.java @@ -23,6 +23,7 @@ import com.intellij.openapi.options.ShowSettingsUtil; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.projectImport.ProjectImportWizardStep; +import com.intellij.util.ui.JBUI; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; @@ -69,19 +70,19 @@ public class MavenProjectImportStep extends ProjectImportWizardStep { c.gridy = 0; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; - c.insets = new Insets(4, 4, 0, 4); + c.insets = JBUI.insets(4, 4, 0, 4); myPanel.add(myRootPathComponent, c); c.gridy = 1; - c.insets = new Insets(4, 4, 0, 4); + c.insets = JBUI.insets(4, 4, 0, 4); myPanel.add(myImportingSettingsForm.createComponent(), c); c.gridy = 2; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTHEAST; c.weighty = 1; - c.insets = new Insets(4 + envSettingsButton.getPreferredSize().height, 4, 4, 4); + c.insets = JBUI.insets(4 + envSettingsButton.getPreferredSize().height, 4, 4, 4); myPanel.add(envSettingsButton, c); myRootPathComponent.setNameComponentVisible(false); @@ -115,10 +116,8 @@ public class MavenProjectImportStep extends ProjectImportWizardStep { else { path = getWizardContext().getProjectFileDirectory(); } - if (path != null) { - myRootPathComponent.setPath(FileUtil.toSystemDependentName(path)); - myRootPathComponent.getPathComponent().selectAll(); - } + myRootPathComponent.setPath(FileUtil.toSystemDependentName(path)); + myRootPathComponent.getPathComponent().selectAll(); } myImportingSettingsForm.setData(getImportingSettings()); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectOpenProcessor.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectOpenProcessor.java index db9b5562e073..96daf48fd76c 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectOpenProcessor.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/wizards/MavenProjectOpenProcessor.java @@ -29,7 +29,7 @@ import org.jetbrains.idea.maven.model.MavenConstants; import org.jetbrains.idea.maven.model.MavenExplicitProfiles; import org.jetbrains.idea.maven.project.MavenProject; -import java.util.Arrays; +import java.util.Collections; import java.util.List; public class MavenProjectOpenProcessor extends ProjectOpenProcessorBase { @@ -43,7 +43,7 @@ public class MavenProjectOpenProcessor extends ProjectOpenProcessorBase