Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated API - Plugin dependencies identification during project import #139

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion resources/META-INF/plugin-release-info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@
<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/135" target="_blank" rel="nofollow">#135</a>,
<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/136" target="_blank" rel="nofollow">#136</a>,
<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/137" target="_blank" rel="nofollow">#137</a>,
<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/138" target="_blank" rel="nofollow">#138</a>)</li>
<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/138" target="_blank" rel="nofollow">#138</a>,
<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/139" target="_blank" rel="nofollow">#139</a>)</li>
<li><i>Bug Fix:</i> [y] Tool Window Logo too dark for New UI (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/95" target="_blank" rel="nofollow">#95</a>)</li>
<li><i>Bug Fix:</i> [y] Tool Window is not available after project import (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/125" target="_blank" rel="nofollow">#125</a>)</li>
<li><i>Bug Fix:</i> Impex config processor inspection does not work (<a href="https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/100" target="_blank" rel="nofollow">#100</a>)</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private static List<String> resolveMavenDependencies(
moduleDirPath,
moduleDirPath
);
final MavenGeneralSettings generalSettings = settings.generalSettings;
final MavenGeneralSettings generalSettings = settings.getGeneralSettings();
generalSettings.setNonRecursive(true);

final MavenProjectsTree mavenProjectsTree = new MavenProjectsTree(project);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.intellij.idea.plugin.hybris.project.wizard;

import com.intellij.ide.plugins.IdeaPluginDependency;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
import com.intellij.ide.plugins.PluginManagerCore;
Expand Down Expand Up @@ -46,8 +47,8 @@ public class CheckRequiredPluginsStep extends ProjectImportWizardStep {
private JPanel rootPanel;
private JLabel warningLabel;
private JTextPane descriptionTextPane;
private JList notInstalledList;
private JList notEnabledList;
private JList<?> notInstalledList;
private JList<?> notEnabledList;
private JLabel notInstalledLablel;
private JLabel notEnabledLabel;
private JButton enableButton;
Expand Down Expand Up @@ -82,33 +83,36 @@ public void updateDataModel() {
public boolean isStepVisible() {
notInstalledPlugins.clear();
notEnabledPlugins.clear();
checkDependentPlugins();
boolean missing = isAnyMissing();
if (!missing) {
validateDependentPlugins();
if (!isAnyMissing()) {
return false;
}
fillInGUI();
return true;
}

private void checkDependentPlugins() {
private void validateDependentPlugins() {
final IdeaPluginDescriptor hybrisPlugin = PluginManagerCore.getPlugin(PluginId.getId(HybrisConstants.PLUGIN_ID));
final PluginId[] dependentPluginIds = hybrisPlugin.getOptionalDependentPluginIds();
Arrays.stream(dependentPluginIds).forEach(id -> {
if (id.getIdString().startsWith(EXCLUDED_ID_PREFIX)) {
return;
}
final boolean installed = PluginManager.isPluginInstalled(id);
if (!installed) {
notInstalledPlugins.add(id);
return;
}

final IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(id);
if (plugin != null && !plugin.isEnabled()) {
notEnabledPlugins.add(id);
}
});
if (hybrisPlugin == null) return;

hybrisPlugin.getDependencies().stream()
.filter(IdeaPluginDependency::isOptional)
.map(IdeaPluginDependency::getPluginId)
.forEach(id -> {
if (id.getIdString().startsWith(EXCLUDED_ID_PREFIX)) {
return;
}
if (!PluginManager.isPluginInstalled(id)) {
notInstalledPlugins.add(id);
return;
}

final IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(id);
if (plugin != null && !plugin.isEnabled()) {
notEnabledPlugins.add(id);
}
});
}

private void fillInGUI() {
Expand Down Expand Up @@ -139,8 +143,8 @@ public boolean isAnyMissing() {
}

private void createUIComponents() {
notInstalledList = new JBList(new DefaultListModel());
notEnabledList = new JBList(new DefaultListModel());
notInstalledList = new JBList<>(new DefaultListModel<>());
notEnabledList = new JBList<>(new DefaultListModel<>());
enableButton = new JButton();
enableButton.addActionListener(e -> enablePlugins());
}
Expand Down