From 644a4c1e8b55eadea613eec339b017aa798ba0aa Mon Sep 17 00:00:00 2001 From: Nicolas QUINQUENEL Date: Thu, 17 Oct 2024 11:50:38 +0200 Subject: [PATCH] SLI-593 Remove the module level configurable UI --- .../module/SonarLintModuleConfigurable.java | 77 ----------- .../config/module/SonarLintModulePanel.form | 124 ------------------ .../config/module/SonarLintModulePanel.java | 60 --------- .../module/SonarLintModuleSettings.java | 18 +-- src/main/resources/META-INF/plugin.xml | 1 - .../intellij/AbstractSonarLintLightTests.java | 5 - 6 files changed, 1 insertion(+), 284 deletions(-) delete mode 100644 src/main/java/org/sonarlint/intellij/config/module/SonarLintModuleConfigurable.java delete mode 100644 src/main/java/org/sonarlint/intellij/config/module/SonarLintModulePanel.form delete mode 100644 src/main/java/org/sonarlint/intellij/config/module/SonarLintModulePanel.java diff --git a/src/main/java/org/sonarlint/intellij/config/module/SonarLintModuleConfigurable.java b/src/main/java/org/sonarlint/intellij/config/module/SonarLintModuleConfigurable.java deleted file mode 100644 index 78396a9c2a..0000000000 --- a/src/main/java/org/sonarlint/intellij/config/module/SonarLintModuleConfigurable.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * SonarLint for IntelliJ IDEA - * Copyright (C) 2015-2024 SonarSource - * sonarlint@sonarsource.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonarlint.intellij.config.module; - -import com.intellij.openapi.module.Module; -import com.intellij.openapi.options.Configurable; -import javax.swing.JComponent; -import org.jetbrains.annotations.Nls; -import org.jetbrains.annotations.Nullable; - -public class SonarLintModuleConfigurable implements Configurable, Configurable.NoMargin, Configurable.NoScroll { - private final Module module; - private SonarLintModulePanel panel; - - public SonarLintModuleConfigurable(Module module) { - this.module = module; - } - - @Nls(capitalization = Nls.Capitalization.Title) - @Override - public String getDisplayName() { - return "SonarLint"; - } - - @Nullable @Override - public JComponent createComponent() { - if (panel == null) { - panel = new SonarLintModulePanel(module); - } - return panel.getRootPanel(); - } - - @Override - public boolean isModified() { - return false; - } - - @Override - public void reset() { - if (panel != null) { - panel.load(); - } - } - - @javax.annotation.Nullable - @Override - public String getHelpTopic() { - return null; - } - - @Override - public void apply() { - // this configurable is read-only, nothing to save - } - - @Override - public void disposeUIResources() { - // nothing to do - } -} diff --git a/src/main/java/org/sonarlint/intellij/config/module/SonarLintModulePanel.form b/src/main/java/org/sonarlint/intellij/config/module/SonarLintModulePanel.form deleted file mode 100644 index 60543fb76b..0000000000 --- a/src/main/java/org/sonarlint/intellij/config/module/SonarLintModulePanel.form +++ /dev/null @@ -1,124 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/main/java/org/sonarlint/intellij/config/module/SonarLintModulePanel.java b/src/main/java/org/sonarlint/intellij/config/module/SonarLintModulePanel.java deleted file mode 100644 index b55bf65906..0000000000 --- a/src/main/java/org/sonarlint/intellij/config/module/SonarLintModulePanel.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarLint for IntelliJ IDEA - * Copyright (C) 2015-2024 SonarSource - * sonarlint@sonarsource.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonarlint.intellij.config.module; - -import com.intellij.openapi.module.Module; -import org.sonarlint.intellij.common.util.SonarLintUtils; -import org.sonarlint.intellij.core.ModuleBindingManager; - -import javax.swing.JPanel; -import javax.swing.JTextField; - -import static org.sonarlint.intellij.config.Settings.getSettingsFor; - -public class SonarLintModulePanel { - private final Module module; - private JPanel rootPanel; - private JTextField sqPathText; - private JPanel group; - private JTextField projectKeyText; - private JTextField idePathText; - - public SonarLintModulePanel(Module module) { - this.module = module; - } - - public JPanel getRootPanel() { - return rootPanel; - } - - public void load() { - String projectKey = SonarLintUtils.getService(module, ModuleBindingManager.class).resolveProjectKey(); - if (projectKey != null) { - SonarLintModuleSettings settings = getSettingsFor(module); - idePathText.setText(settings.getIdePathPrefix()); - sqPathText.setText(settings.getSqPathPrefix()); - projectKeyText.setText(projectKey); - } else { - idePathText.setText(""); - sqPathText.setText(""); - projectKeyText.setText(""); - } - } -} diff --git a/src/main/java/org/sonarlint/intellij/config/module/SonarLintModuleSettings.java b/src/main/java/org/sonarlint/intellij/config/module/SonarLintModuleSettings.java index 0d4fbb8c19..634ab7e590 100644 --- a/src/main/java/org/sonarlint/intellij/config/module/SonarLintModuleSettings.java +++ b/src/main/java/org/sonarlint/intellij/config/module/SonarLintModuleSettings.java @@ -22,8 +22,7 @@ import static org.sonarlint.intellij.common.util.SonarLintUtils.isBlank; public final class SonarLintModuleSettings { - private String sqPathPrefix = ""; - private String idePathPrefix = ""; + private String projectKey = ""; public String getProjectKey() { @@ -42,19 +41,4 @@ public void clearBindingOverride() { this.projectKey = ""; } - public String getSqPathPrefix() { - return sqPathPrefix; - } - - public void setSqPathPrefix(String sqPathPrefix) { - this.sqPathPrefix = sqPathPrefix; - } - - public String getIdePathPrefix() { - return idePathPrefix; - } - - public void setIdePathPrefix(String idePathPrefix) { - this.idePathPrefix = idePathPrefix; - } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index d6a8989363..9523e5f007 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -204,7 +204,6 @@ - diff --git a/src/test/java/org/sonarlint/intellij/AbstractSonarLintLightTests.java b/src/test/java/org/sonarlint/intellij/AbstractSonarLintLightTests.java index 4fa68f50e1..cb787ff837 100644 --- a/src/test/java/org/sonarlint/intellij/AbstractSonarLintLightTests.java +++ b/src/test/java/org/sonarlint/intellij/AbstractSonarLintLightTests.java @@ -35,7 +35,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.time.Duration; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -61,8 +60,6 @@ import org.sonarlint.intellij.ui.SonarLintConsoleTestImpl; import static com.intellij.notification.NotificationsManager.getNotificationsManager; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; import static org.sonarlint.intellij.common.util.SonarLintUtils.getService; import static org.sonarlint.intellij.config.Settings.getSettingsFor; @@ -99,8 +96,6 @@ final void beforeEachLightTest(TestInfo testInfo) throws Exception { getProjectSettings().setBindingEnabled(false); getProjectSettings().setBindingSuggestionsEnabled(true); setProjectLevelExclusions(Collections.emptyList()); - getModuleSettings().setIdePathPrefix(""); - getModuleSettings().setSqPathPrefix(""); getModuleSettings().clearBindingOverride(); getService(BackendService.class).moduleUnbound(getModule()); getService(BackendService.class).projectUnbound(getProject());