From 98276f805f88345d74659de083a41a7e8a3c53f1 Mon Sep 17 00:00:00 2001 From: Mykhailo Lytvyn Date: Fri, 23 Dec 2022 11:05:20 +0100 Subject: [PATCH] #107 | Deprecated API - Diagrams & Impex --- resources/i18n/HybrisBundle.properties | 2 +- .../plugin/hybris/common/HybrisConstants.kt | 2 ++ .../FlexibleSearchParserDefinition.java | 4 +++- .../formatting/FSCodeStyleSettingsProvider.java | 7 ++++--- .../utils/FlexibleSearchParserUtils.java | 2 +- .../idea/plugin/hybris/impex/ImpexLanguage.java | 7 +++++-- .../hybris/impex/ImpexParserDefinition.java | 2 +- .../ImpexCodeStyleSettingsProvider.java | 1 - .../processor/ImpexMacrosRenameProcessor.kt | 6 +++--- .../hybris/impex/utils/ImpexPsiUtils.java | 4 ++-- .../ModuleDepDiagramElementManager.java | 13 ++++++++----- .../ModuleDepDiagramNodeContentManager.java | 11 +++++++---- .../moduleDiagram/ModuleDepDiagramProvider.java | 11 ++++++++++- .../DefaultHybrisProjectImportBuilder.java | 2 +- .../impl/DebugRunConfigurationConfigurator.java | 17 +++++++++-------- .../impl/DefaultAntConfigurator.java | 2 +- .../impl/DefaultSearchScopeConfigurator.java | 16 ++++++++-------- .../project/configurators/impl/MavenUtils.java | 13 +++++++------ .../providers/HybrisWritingAccessProvider.java | 4 +--- .../tasks/ImportProjectProgressModalWindow.java | 5 +++-- .../wizard/CheckRequiredPluginsStep.java | 4 +++- 21 files changed, 80 insertions(+), 55 deletions(-) diff --git a/resources/i18n/HybrisBundle.properties b/resources/i18n/HybrisBundle.properties index f0c0d48bb..de69edad2 100644 --- a/resources/i18n/HybrisBundle.properties +++ b/resources/i18n/HybrisBundle.properties @@ -269,7 +269,7 @@ hybris.gutter.navigate.no.matching.populators=No matching populators found hybris.gutter.populator.class.navigate.choose.class.title=Choose Populator hybris.gutter.populator.class.tooltip.navigate.declaration=Navigate to the hybris populator -hybris.module.dependencies.diagram.provider.name=[y] Module Dependencies +hybris.module.dependencies.diagram.provider.name=[y] module dependencies hybris.stats.permission.no=I disagree hybris.scope.custom.ts.files=Custom Type System Files diff --git a/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt index cfdee09cd..9cd98bd5f 100644 --- a/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt +++ b/src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt @@ -29,6 +29,8 @@ object HybrisConstants { const val NOTIFICATION_GROUP_HYBRIS = "[y] SAP Commerce Cloud" + const val IDEA_EDITION_ULTIMATE = "Ultimate Edition" + const val IMPEX_CONFIG_PREFIX = "\$config" const val IMPEX_CONFIG_COMPLETE_PREFIX = "$IMPEX_CONFIG_PREFIX-" const val IMPEX_CATALOG_VERSION_ONLINE = "Online" diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParserDefinition.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParserDefinition.java index 421bdd01d..82849e757 100644 --- a/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParserDefinition.java +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/FlexibleSearchParserDefinition.java @@ -78,7 +78,9 @@ public PsiFile createFile(FileViewProvider viewProvider) { return new FlexibleSearchFile(viewProvider); } - public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) { + @Override + @NotNull + public SpaceRequirements spaceExistenceTypeBetweenTokens(final ASTNode left, final ASTNode right) { return SpaceRequirements.MAY; } diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettingsProvider.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettingsProvider.java index 84ec7587d..e29ad92b4 100644 --- a/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettingsProvider.java +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/formatting/FSCodeStyleSettingsProvider.java @@ -22,7 +22,7 @@ import com.intellij.application.options.CodeStyleAbstractPanel; import com.intellij.application.options.TabbedLanguageCodeStylePanel; import com.intellij.idea.plugin.hybris.flexibleSearch.FlexibleSearchLanguage; -import com.intellij.openapi.options.Configurable; +import com.intellij.psi.codeStyle.CodeStyleConfigurable; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CodeStyleSettingsProvider; import com.intellij.psi.codeStyle.CustomCodeStyleSettings; @@ -45,11 +45,12 @@ public String getConfigurableDisplayName() { @NotNull @Override - public Configurable createSettingsPage(final CodeStyleSettings settings, final CodeStyleSettings modelSettings) { + public CodeStyleConfigurable createConfigurable(final @NotNull CodeStyleSettings settings, final @NotNull CodeStyleSettings modelSettings) { return new CodeStyleAbstractConfigurable(settings, modelSettings, "FlexibleSearch") { @Override - protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) { + @NotNull + protected CodeStyleAbstractPanel createPanel(final @NotNull CodeStyleSettings settings) { return new SimpleCodeStyleMainPanel(getCurrentSettings(), settings); } diff --git a/src/com/intellij/idea/plugin/hybris/flexibleSearch/utils/FlexibleSearchParserUtils.java b/src/com/intellij/idea/plugin/hybris/flexibleSearch/utils/FlexibleSearchParserUtils.java index b25cce20c..afade1a99 100644 --- a/src/com/intellij/idea/plugin/hybris/flexibleSearch/utils/FlexibleSearchParserUtils.java +++ b/src/com/intellij/idea/plugin/hybris/flexibleSearch/utils/FlexibleSearchParserUtils.java @@ -980,7 +980,7 @@ public static FlexibleSearchParserUtils.ErrorState get(PsiBuilder builder) { public static void initState(FlexibleSearchParserUtils.ErrorState state, PsiBuilder builder, IElementType root, TokenSet[] extendsSets) { state.extendsSets = extendsSets; - PsiFile file = builder.getUserDataUnprotected(FileContextUtil.CONTAINING_FILE_KEY); + PsiFile file = builder.getUserData(FileContextUtil.CONTAINING_FILE_KEY); state.completionState = file == null? null: file.getUserData(COMPLETION_STATE_KEY); Language language = file == null? root.getLanguage() : file.getLanguage(); state.caseSensitive = language.isCaseSensitive(); diff --git a/src/com/intellij/idea/plugin/hybris/impex/ImpexLanguage.java b/src/com/intellij/idea/plugin/hybris/impex/ImpexLanguage.java index 8fd1e4433..618b387cf 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/ImpexLanguage.java +++ b/src/com/intellij/idea/plugin/hybris/impex/ImpexLanguage.java @@ -21,12 +21,15 @@ import com.intellij.idea.plugin.hybris.common.HybrisConstants; import com.intellij.lang.Language; +import java.io.Serial; + public class ImpexLanguage extends Language { - private static final ImpexLanguage INSTANCE = new ImpexLanguage(); + @Serial private static final long serialVersionUID = -6312784074276675105L; + private static final Language INSTANCE = new ImpexLanguage(); - public static ImpexLanguage getInstance() { + public static Language getInstance() { return INSTANCE; } diff --git a/src/com/intellij/idea/plugin/hybris/impex/ImpexParserDefinition.java b/src/com/intellij/idea/plugin/hybris/impex/ImpexParserDefinition.java index 23ba4011c..e377d570a 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/ImpexParserDefinition.java +++ b/src/com/intellij/idea/plugin/hybris/impex/ImpexParserDefinition.java @@ -93,7 +93,7 @@ public PsiFile createFile(final FileViewProvider viewProvider) { @NotNull @Override - public SpaceRequirements spaceExistanceTypeBetweenTokens(final ASTNode left, final ASTNode right) { + public SpaceRequirements spaceExistenceTypeBetweenTokens(final ASTNode left, final ASTNode right) { return SpaceRequirements.MAY; } diff --git a/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexCodeStyleSettingsProvider.java b/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexCodeStyleSettingsProvider.java index 65b218a2b..127268d71 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexCodeStyleSettingsProvider.java +++ b/src/com/intellij/idea/plugin/hybris/impex/formatting/ImpexCodeStyleSettingsProvider.java @@ -51,7 +51,6 @@ public String getConfigurableDisplayName() { @NotNull @Override public CodeStyleConfigurable createConfigurable(@NotNull final CodeStyleSettings settings, @NotNull final CodeStyleSettings originalSettings) { - return new CodeStyleAbstractConfigurable(settings, originalSettings, HybrisConstants.IMPEX) { @Override diff --git a/src/com/intellij/idea/plugin/hybris/impex/rename/processor/ImpexMacrosRenameProcessor.kt b/src/com/intellij/idea/plugin/hybris/impex/rename/processor/ImpexMacrosRenameProcessor.kt index a13ad771e..6c96097ea 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/rename/processor/ImpexMacrosRenameProcessor.kt +++ b/src/com/intellij/idea/plugin/hybris/impex/rename/processor/ImpexMacrosRenameProcessor.kt @@ -24,6 +24,7 @@ import com.intellij.idea.plugin.hybris.impex.psi.ImpexPsiNamedElement import com.intellij.idea.plugin.hybris.impex.psi.references.ImpexMacrosReferenceBase import com.intellij.psi.PsiElement import com.intellij.psi.PsiReference +import com.intellij.psi.search.SearchScope import com.intellij.psi.util.PsiTreeUtil import com.intellij.refactoring.listeners.RefactoringElementListener import com.intellij.refactoring.rename.RenamePsiElementProcessor @@ -38,10 +39,9 @@ class ImpexMacrosRenameProcessor : RenamePsiElementProcessor() { return element is ImpexMacroNameDec || element is ImpexMacroUsageDec } - override fun findReferences(element: PsiElement): MutableCollection { + override fun findReferences(element: PsiElement, searchScope: SearchScope, searchInCommentsAndStrings: Boolean): MutableCollection { val file = element.containingFile - val psiElements = PsiTreeUtil.collectElements( - file, { el -> (el is ImpexMacroNameDec || el is ImpexMacroUsageDec) && el.text == element.text }) + val psiElements = PsiTreeUtil.collectElements(file) { el -> (el is ImpexMacroNameDec || el is ImpexMacroUsageDec) && el.text == element.text } return psiElements.map { ImpexMacrosReferenceBase(it) }.toMutableList() } diff --git a/src/com/intellij/idea/plugin/hybris/impex/utils/ImpexPsiUtils.java b/src/com/intellij/idea/plugin/hybris/impex/utils/ImpexPsiUtils.java index 3264d5bb6..6001324fb 100644 --- a/src/com/intellij/idea/plugin/hybris/impex/utils/ImpexPsiUtils.java +++ b/src/com/intellij/idea/plugin/hybris/impex/utils/ImpexPsiUtils.java @@ -39,7 +39,6 @@ import com.intellij.psi.PsiWhiteSpace; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtilBase; -import com.intellij.util.containers.Predicate; import org.apache.commons.lang3.Validate; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; @@ -49,6 +48,7 @@ import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.function.Predicate; /** * Created 22:43 01 January 2015 @@ -167,7 +167,7 @@ public static PsiElement findSiblingByPredicate( return null; } else { for (PsiElement child = sibling.getNextSibling(); child != null; child = child.getNextSibling()) { - if (predicate.apply(child)) { + if (predicate.test(child)) { return child; } } diff --git a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramElementManager.java b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramElementManager.java index b9e32ca9a..224e7df50 100644 --- a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramElementManager.java +++ b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramElementManager.java @@ -19,7 +19,7 @@ package com.intellij.idea.plugin.hybris.moduleDiagram; import com.intellij.diagram.AbstractDiagramElementManager; -import com.intellij.diagram.presentation.DiagramState; +import com.intellij.diagram.DiagramBuilder; import com.intellij.idea.plugin.hybris.actions.ActionUtils; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.ui.SimpleColoredText; @@ -62,11 +62,14 @@ public String getElementTitle(final ModuleDepDiagramItem element) { return element.toString(); } - @Nullable @Override - public SimpleColoredText getItemName(final Object element, final DiagramState diagramState) { - return element instanceof ModuleDepDiagramItem - ? new SimpleColoredText(((ModuleDepDiagramItem) element).getName(), DEFAULT_TITLE_ATTR) + public @Nullable SimpleColoredText getItemName( + @Nullable final ModuleDepDiagramItem nodeElement, + @Nullable final Object nodeItem, + @NotNull final DiagramBuilder builder + ) { + return nodeElement != null + ? new SimpleColoredText(nodeElement.getName(), DEFAULT_TITLE_ATTR) : null; } diff --git a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramNodeContentManager.java b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramNodeContentManager.java index 79a3aaf5f..f53f3787e 100644 --- a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramNodeContentManager.java +++ b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramNodeContentManager.java @@ -19,8 +19,10 @@ package com.intellij.idea.plugin.hybris.moduleDiagram; import com.intellij.diagram.AbstractDiagramNodeContentManager; +import com.intellij.diagram.DiagramBuilder; import com.intellij.diagram.DiagramCategory; -import com.intellij.diagram.presentation.DiagramState; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @author Eugene.Kudelevsky @@ -29,9 +31,10 @@ public class ModuleDepDiagramNodeContentManager extends AbstractDiagramNodeConte @Override public boolean isInCategory( - final Object o, - final DiagramCategory diagramCategory, - final DiagramState diagramState + @Nullable final Object nodeElement, + @Nullable final Object item, + @NotNull final DiagramCategory category, + @Nullable final DiagramBuilder builder ) { return false; } diff --git a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramProvider.java b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramProvider.java index 59260e51f..288f80c30 100644 --- a/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramProvider.java +++ b/src/com/intellij/idea/plugin/hybris/moduleDiagram/ModuleDepDiagramProvider.java @@ -55,47 +55,56 @@ public String getID() { } @Override + @NotNull public DiagramVisibilityManager createVisibilityManager() { return new ModuleDepDiagramVisibilityManager(); } @Override - public DiagramNodeContentManager getNodeContentManager() { + @NotNull + public DiagramNodeContentManager createNodeContentManager() { return myNodeContentManager; } @Override + @NotNull public DiagramElementManager getElementManager() { return myElementManager; } @Override + @NotNull public DiagramVfsResolver getVfsResolver() { return myVfsResolver; } @Override + @NotNull public DiagramColorManager getColorManager() { return myColorManager; } @SuppressWarnings("unchecked") @Override + @NotNull public DiagramRelationshipManager getRelationshipManager() { return (DiagramRelationshipManager) DiagramRelationshipManager.NO_RELATIONSHIP_MANAGER; } @Override + @NotNull public String getPresentableName() { return HybrisI18NBundleUtils.message("hybris.module.dependencies.diagram.provider.name"); } @Override + @NotNull public Icon getActionIcon(final boolean isPopup) { return HybrisIcons.HYBRIS_ICON; } @Override + @NotNull public DiagramDataModel createDataModel( @NotNull final Project project, @Nullable final ModuleDepDiagramItem item, diff --git a/src/com/intellij/idea/plugin/hybris/project/DefaultHybrisProjectImportBuilder.java b/src/com/intellij/idea/plugin/hybris/project/DefaultHybrisProjectImportBuilder.java index 403ffd664..e06a830d1 100644 --- a/src/com/intellij/idea/plugin/hybris/project/DefaultHybrisProjectImportBuilder.java +++ b/src/com/intellij/idea/plugin/hybris/project/DefaultHybrisProjectImportBuilder.java @@ -180,7 +180,7 @@ public List commit( final boolean[] finished = {false}; - StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> { + StartupManager.getInstance(project).runAfterOpened(() -> { finished[0] = true; finishImport( diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DebugRunConfigurationConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DebugRunConfigurationConfigurator.java index 49da51c0d..62ff10d92 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DebugRunConfigurationConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DebugRunConfigurationConfigurator.java @@ -48,9 +48,9 @@ public class DebugRunConfigurationConfigurator implements RunConfigurationConfig @Override public void configure( - @NotNull final HybrisProjectDescriptor hybrisProjectDescriptor, + final HybrisProjectDescriptor hybrisProjectDescriptor, @NotNull final Project project, - @NotNull final HybrisConfiguratorCache cache + final HybrisConfiguratorCache cache ) { final RunManager runManager = RunManager.getInstance(project); @@ -65,23 +65,24 @@ private void createRemoteDebug( final RemoteConfigurationType remoteConfigurationType = ConfigurationTypeUtil.findConfigurationType( RemoteConfigurationType.class); final ConfigurationFactory configurationFactory = remoteConfigurationType.getConfigurationFactories()[0]; - final String configurationName = HybrisI18NBundleUtils.message( - "hybris.project.import.run.configuration.remote.debug"); + final String configurationName = HybrisI18NBundleUtils.message("hybris.project.import.run.configuration.remote.debug"); if (runManager.findConfigurationByName(configurationName) != null) { return; } - final RunnerAndConfigurationSettings runner = runManager.createRunConfiguration( + final RunnerAndConfigurationSettings runner = runManager.createConfiguration( configurationName, configurationFactory ); + final RemoteConfiguration remoteConfiguration = (RemoteConfiguration) runner.getConfiguration(); remoteConfiguration.PORT = getDebugPort(hybrisProjectDescriptor, cache); + remoteConfiguration.setAllowRunningInParallel(false); ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> { - runner.setSingleton(true); runner.setActivateToolWindowBeforeRun(true); - runManager.addConfiguration(runner, true); + runner.storeInDotIdeaFolder(); + runManager.addConfiguration(runner); runManager.setSelectedConfiguration(runner); })); } @@ -129,7 +130,7 @@ private String findPortProperty( final Optional transport = Arrays.stream(debugOptions.split(" ")) .filter(e -> e.startsWith(HybrisConstants.X_RUNJDWP_TRANSPORT)) .findAny(); - if (!transport.isPresent()) { + if (transport.isEmpty()) { return null; } final Optional address = Arrays.stream(transport.get().split(",")) diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultAntConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultAntConfigurator.java index 2a58b53ce..5b68f1411 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultAntConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultAntConfigurator.java @@ -358,6 +358,6 @@ private void removeMake(final Project project) { final ConfigurationFactory configurationFactory = antRunConfigurationType.getConfigurationFactories()[0]; final RunnerAndConfigurationSettings template = runManager.getConfigurationTemplate(configurationFactory); final AntRunConfiguration runConfiguration = (AntRunConfiguration) template.getConfiguration(); - runManager.setBeforeRunTasks(runConfiguration, Collections.emptyList(), false); + runManager.setBeforeRunTasks(runConfiguration, Collections.emptyList()); } } diff --git a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java index 7ea9f80d8..ed9788acb 100644 --- a/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java +++ b/src/com/intellij/idea/plugin/hybris/project/configurators/impl/DefaultSearchScopeConfigurator.java @@ -108,8 +108,8 @@ public void configure( NamedScope defaultScope = customScope != null ? customScope : hybrisScope != null ? hybrisScope : platformScope; if (defaultScope != null) { - FindSettings.getInstance().setCustomScope(defaultScope.getName()); - FindSettings.getInstance().setDefaultScopeName(defaultScope.getName()); + FindSettings.getInstance().setCustomScope(defaultScope.getPresentableName()); + FindSettings.getInstance().setDefaultScopeName(defaultScope.getPresentableName()); } } @@ -139,10 +139,10 @@ public static PackageSet createCustomTsImpexBeansFilesPattern() { impexFilePatternPackageSet); } - private static void addOrReplaceScopes(@NotNull Project project, @NotNull List newScopes) { + private static void addOrReplaceScopes(@NotNull final Project project, @NotNull final List newScopes) { final Set newScopeNames = newScopes .stream() - .map(NamedScope::getName) + .map(NamedScope::getPresentableName) .collect(Collectors.toSet()); final NamedScopeManager namedScopeManager = NamedScopeManager.getInstance(project); @@ -150,7 +150,7 @@ private static void addOrReplaceScopes(@NotNull Project project, @NotNull List !newScopeNames.contains(it.getName())) + .filter(it -> !newScopeNames.contains(it.getPresentableName())) .toArray(NamedScope[]::new); namedScopeManager.setScopes(ArrayUtil.mergeArrays( @@ -159,7 +159,7 @@ private static void addOrReplaceScopes(@NotNull Project project, @NotNull List resolveMavenDependencies( ); if (downloadDocs) { for (final MavenId resolvedDoc : downloadResult.resolvedDocs) { - final File libFile = getArtifactLib(manager, resolvedDoc); - final String resultJarPath = libFile.getAbsolutePath().replace(".jar", "-javadoc.jar"); + final Path libFile = getArtifactLib(manager, resolvedDoc); + final String resultJarPath = libFile.toAbsolutePath().toString().replace(".jar", "-javadoc.jar"); resultPathList.add(resultJarPath); } } if (downloadSources) { for (final MavenId resolvedDoc : downloadResult.resolvedSources) { - final File libFile = getArtifactLib(manager, resolvedDoc); - final String resultJarPath = libFile.getAbsolutePath().replace(".jar", "-sources.jar"); + final Path libFile = getArtifactLib(manager, resolvedDoc); + final String resultJarPath = libFile.toAbsolutePath().toString().replace(".jar", "-sources.jar"); resultPathList.add(resultJarPath); } } @@ -170,9 +171,9 @@ private static List resolveMavenDependencies( } @NotNull - static File getArtifactLib(final MavenProjectsManager manager, final MavenId resolvedDoc) { + static Path getArtifactLib(final MavenProjectsManager manager, final MavenId resolvedDoc) { return MavenArtifactUtil - .getArtifactFile( + .getArtifactNioPath( manager.getLocalRepository(), resolvedDoc.getGroupId(), resolvedDoc.getArtifactId(), diff --git a/src/com/intellij/idea/plugin/hybris/project/providers/HybrisWritingAccessProvider.java b/src/com/intellij/idea/plugin/hybris/project/providers/HybrisWritingAccessProvider.java index 3f5beb5e3..23301936b 100644 --- a/src/com/intellij/idea/plugin/hybris/project/providers/HybrisWritingAccessProvider.java +++ b/src/com/intellij/idea/plugin/hybris/project/providers/HybrisWritingAccessProvider.java @@ -19,7 +19,6 @@ package com.intellij.idea.plugin.hybris.project.providers; import com.intellij.idea.plugin.hybris.common.HybrisConstants; -import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; @@ -29,7 +28,6 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Objects; @@ -64,7 +62,7 @@ public HybrisWritingAccessProvider(@NotNull final Project project) { @NotNull @Override - public Collection requestWriting(final VirtualFile... files) { + public Collection requestWriting(final Collection files) { final List writingDenied = new ArrayList<>(); for (VirtualFile file : files) { if (isFileReadOnly(file)) { diff --git a/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java b/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java index 872368053..82cf6f82f 100644 --- a/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java +++ b/src/com/intellij/idea/plugin/hybris/project/tasks/ImportProjectProgressModalWindow.java @@ -112,6 +112,7 @@ import static com.intellij.idea.plugin.hybris.common.HybrisConstants.DICTIONARY_NAME; import static com.intellij.idea.plugin.hybris.common.HybrisConstants.DICTIONARY_WORDS; +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.IDEA_EDITION_ULTIMATE; import static com.intellij.idea.plugin.hybris.project.descriptors.HybrisModuleDescriptorType.CUSTOM; import static com.intellij.idea.plugin.hybris.project.utils.ModuleGroupUtils.fetchGroupMapping; import static com.intellij.idea.plugin.hybris.project.utils.PluginCommon.JAVAEE_PLUGIN_ID; @@ -185,7 +186,7 @@ public synchronized void run(@NotNull final ProgressIndicator indicator) { this.disableWrapOnType(ImpexLanguage.getInstance()); PropertiesComponent.getInstance(project).setValue(SHOW_UNLINKED_GRADLE_POPUP, false); - if ("Ultimate Edition".equalsIgnoreCase(ApplicationNamesInfo.getInstance().getEditionName())) { + if (IDEA_EDITION_ULTIMATE.equalsIgnoreCase(ApplicationNamesInfo.getInstance().getEditionName())) { indicator.setText(HybrisI18NBundleUtils.message("hybris.project.import.facets")); if (isPluginActive(SPRING_PLUGIN_ID)) { this.excludeFrameworkDetection(project, SpringFacet.FACET_TYPE_ID); @@ -467,7 +468,7 @@ private void saveImportedSettings(final Project project) { CommonIdeaService.getInstance().fixRemoteConnectionSettings(project); - StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> { + StartupManager.getInstance(project).runAfterOpened(() -> { project.getMessageBus().syncPublisher(HybrisDeveloperSpecificProjectSettingsListener.TOPIC).hacConnectionSettingsChanged(); project.getMessageBus().syncPublisher(HybrisDeveloperSpecificProjectSettingsListener.TOPIC).solrConnectionSettingsChanged(); }); diff --git a/src/com/intellij/idea/plugin/hybris/project/wizard/CheckRequiredPluginsStep.java b/src/com/intellij/idea/plugin/hybris/project/wizard/CheckRequiredPluginsStep.java index 836ffc8b8..91f567dcc 100644 --- a/src/com/intellij/idea/plugin/hybris/project/wizard/CheckRequiredPluginsStep.java +++ b/src/com/intellij/idea/plugin/hybris/project/wizard/CheckRequiredPluginsStep.java @@ -36,6 +36,8 @@ import java.util.List; import java.util.Set; +import static com.intellij.idea.plugin.hybris.common.HybrisConstants.IDEA_EDITION_ULTIMATE; + /** * Created by Martin Zdarsky-Jones (martin.zdarsky@hybris.com) on 13/3/17. */ @@ -125,7 +127,7 @@ public boolean isAnyMissing() { if (!notEnabledPlugins.isEmpty()) { return true; } - if ("Ultimate Edition".equalsIgnoreCase(ApplicationNamesInfo.getInstance().getEditionName())) { + if (IDEA_EDITION_ULTIMATE.equalsIgnoreCase(ApplicationNamesInfo.getInstance().getEditionName())) { return !notInstalledPlugins.isEmpty(); } for (PluginId pluginId : notInstalledPlugins) {