From 775894119a27409471ab9954fb7e470c30a4189a Mon Sep 17 00:00:00 2001 From: SBT-Kudryashov-AA Date: Thu, 25 Aug 2016 11:53:44 +0300 Subject: [PATCH] Testdox is displayed in Others Settings in Idea 2016. Settings remains. --- src/java/META-INF/plugin.xml | 87 ------------------- .../config/ConfigurationController.java | 31 ++++--- .../ConfigurationControllerProvider.java | 22 +++++ 3 files changed, 39 insertions(+), 101 deletions(-) delete mode 100644 src/java/META-INF/plugin.xml create mode 100644 src/java/org/codehaus/testdox/intellij/config/ConfigurationControllerProvider.java diff --git a/src/java/META-INF/plugin.xml b/src/java/META-INF/plugin.xml deleted file mode 100644 index be42589..0000000 --- a/src/java/META-INF/plugin.xml +++ /dev/null @@ -1,87 +0,0 @@ - - @PROJECT.TITLE@ - @PROJECT.DESCRIPTION@ - @PROJECT.VERSION@ - @PROJECT.CHANGENOTES@ - @PROJECT.VENDOR@ - - - - - org.codehaus.testdox.intellij.config.ConfigurationController - - - org.codehaus.testdox.intellij.TestDoxProjectComponent - - - - - - org.codehaus.testdox.intellij.inspections.TestDoxInspectionProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/java/org/codehaus/testdox/intellij/config/ConfigurationController.java b/src/java/org/codehaus/testdox/intellij/config/ConfigurationController.java index de96a5d..07c6a8a 100644 --- a/src/java/org/codehaus/testdox/intellij/config/ConfigurationController.java +++ b/src/java/org/codehaus/testdox/intellij/config/ConfigurationController.java @@ -5,23 +5,26 @@ import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.ConfigurableProvider; import com.intellij.openapi.options.ConfigurationException; +import com.intellij.openapi.project.Project; import com.intellij.util.xmlb.XmlSerializerUtil; import org.codehaus.testdox.intellij.IconHelper; import org.codehaus.testdox.intellij.TemplateNameResolver; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.Collections; import java.util.List; @State( - name = ConfigurationController.COMPONENT_NAME, - storages = { - @Storage( - id = ConfigurationController.COMPONENT_NAME, - file = "$PROJECT_FILE$" - )} + name = ConfigurationController.COMPONENT_NAME, + storages = { + @Storage( + id = ConfigurationController.COMPONENT_NAME, + file = "$PROJECT_FILE$" + )} ) public class ConfigurationController implements ProjectComponent, Configurable, PersistentStateComponent { @@ -117,14 +120,14 @@ public Icon getIcon() { public boolean isModified() { return bean.isAllowCustomPackages() != panel.getCustomMappingStatus() - || !equals(bean.getCustomPackages(), panel.getCustomPackageMappings()) - || !bean.getTestNameTemplate().equals(panel.getTestNameTemplate()) - || !bean.getTestMethodIndicator().equals(panel.getTestMethodPrefix()) - || bean.isCreateTestIfMissing() != panel.getCreateTestIfMissing() - || bean.isUnderscoreMode() != panel.getUseUnderscore() - || bean.isShowFullyQualifiedClassName() != panel.getShowFullyQualifiedClassName() - || bean.isAutoApplyChangesToTest() != panel.getAutoApplyChangesToTest() - || bean.isDeletePackageOccurrences() != panel.getDeletePackageOccurrences(); + || !equals(bean.getCustomPackages(), panel.getCustomPackageMappings()) + || !bean.getTestNameTemplate().equals(panel.getTestNameTemplate()) + || !bean.getTestMethodIndicator().equals(panel.getTestMethodPrefix()) + || bean.isCreateTestIfMissing() != panel.getCreateTestIfMissing() + || bean.isUnderscoreMode() != panel.getUseUnderscore() + || bean.isShowFullyQualifiedClassName() != panel.getShowFullyQualifiedClassName() + || bean.isAutoApplyChangesToTest() != panel.getAutoApplyChangesToTest() + || bean.isDeletePackageOccurrences() != panel.getDeletePackageOccurrences(); } private boolean equals(List strings1, List strings2) { diff --git a/src/java/org/codehaus/testdox/intellij/config/ConfigurationControllerProvider.java b/src/java/org/codehaus/testdox/intellij/config/ConfigurationControllerProvider.java new file mode 100644 index 0000000..7bd5e99 --- /dev/null +++ b/src/java/org/codehaus/testdox/intellij/config/ConfigurationControllerProvider.java @@ -0,0 +1,22 @@ +package org.codehaus.testdox.intellij.config; + +import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.ConfigurableProvider; +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.Nullable; + +public class ConfigurationControllerProvider extends ConfigurableProvider { + + Project project; + + public ConfigurationControllerProvider(Project project) { + this.project = project; + } + + @Nullable + @Override + public Configurable createConfigurable() { + return project.getComponent(ConfigurationController.class); + } +} +