mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
[run configurations] implement ConfigurationFactory::getId method in all inheritors and return non-localizable value
The default implementation delegates to 'getName' method and it may cause problems if it returns localized value (IDEA-232878). GitOrigin-RevId: 28495a477af06896f0c3f98141b424c33920f1e0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f354e97f59
commit
2c59c81361
@@ -478,6 +478,11 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
|
||||
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
|
||||
return new ProcessAttachRunConfiguration(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return INSTANCE.getId();
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -37,6 +37,11 @@ public class ApplicationConfigurationType implements ConfigurationType {
|
||||
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
|
||||
return new ApplicationConfiguration("", project, ApplicationConfigurationType.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return ApplicationConfigurationType.this.getId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.DeprecatedMethodException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -52,9 +54,24 @@ public abstract class AbstractExternalSystemTaskConfigurationType implements Con
|
||||
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
|
||||
return doCreateConfiguration(myExternalSystemId, project, this, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return getConfigurationFactoryId();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This method must be overriden and a proper ID must be returned from it (it'll be used as a key in run configuration file).
|
||||
*/
|
||||
@NonNls
|
||||
@NotNull
|
||||
protected String getConfigurationFactoryId() {
|
||||
DeprecatedMethodException.report("Override AbstractExternalSystemTaskConfigurationType::getConfigurationFactoryId method. The default implementation delegates to 'ProjectSystemId::getReadableName' which is supposed to be localized but return value of this method must not be localized.");
|
||||
return myExternalSystemId.getReadableName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ProjectSystemId getExternalSystemId() {
|
||||
return myExternalSystemId;
|
||||
|
||||
@@ -119,6 +119,11 @@ public class ExternalSystemTaskActivatorTest extends HeavyPlatformTestCase {
|
||||
|
||||
private static class TestTaskConfigurationType extends AbstractExternalSystemTaskConfigurationType {
|
||||
private TestTaskConfigurationType() {super(TEST_EXTERNAL_SYSTEM_ID);}
|
||||
|
||||
@Override
|
||||
protected @NotNull String getConfigurationFactoryId() {
|
||||
return "Test_external_system_id";
|
||||
}
|
||||
}
|
||||
|
||||
private class MyTestExternalSystemManager extends TestExternalSystemManager {
|
||||
|
||||
@@ -33,6 +33,11 @@ public class FakeConfigurationFactory extends ConfigurationFactory {
|
||||
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
|
||||
return new FakeRunConfiguration(project, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return getType().getId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class BaseTestConfigurationFactory extends ConfigurationFactory
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getId() {
|
||||
return "Local";
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public abstract class BaseTestConfigurationFactory extends ConfigurationFactory
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getId() {
|
||||
return "Remote";
|
||||
}
|
||||
|
||||
@@ -84,4 +84,9 @@ public abstract class BaseTestConfigurationFactory extends ConfigurationFactory
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return getType().getId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ import com.intellij.remoteServer.runtime.Deployment;
|
||||
import com.intellij.remoteServer.runtime.ServerConnector;
|
||||
import com.intellij.remoteServer.runtime.ServerTaskExecutor;
|
||||
import com.intellij.remoteServer.runtime.deployment.debug.DebugConnector;
|
||||
import com.intellij.util.DeprecatedMethodException;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -43,6 +45,15 @@ public abstract class ServerType<C extends ServerConfiguration> {
|
||||
return getPresentableName() + " Deployment";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method must be overriden and a proper ID must be returned from it (it'll be used as a key in run configuration file).
|
||||
*/
|
||||
@NotNull @NonNls
|
||||
public String getDeploymentConfigurationFactoryId() {
|
||||
DeprecatedMethodException.report("Override ServerType::getDeploymentConfigurationFactoryId method. The default implementation delegates to 'getDeploymentConfigurationTypePresentableName' which is supposed to be localized but return value of this method must not be localized.");
|
||||
return getDeploymentConfigurationTypePresentableName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getHelpTopic() {
|
||||
return "reference.settings.clouds";
|
||||
|
||||
@@ -79,7 +79,7 @@ public final class DeployToServerConfigurationType extends ConfigurationTypeBase
|
||||
}
|
||||
|
||||
// todo do not extends ConfigurationFactoryEx once Google Cloud Tools plugin will get rid of getFactory() usage
|
||||
public class DeployToServerConfigurationFactory extends ConfigurationFactoryEx<DeployToServerRunConfiguration<?, ?>> {
|
||||
public abstract class DeployToServerConfigurationFactory extends ConfigurationFactoryEx<DeployToServerRunConfiguration<?, ?>> {
|
||||
public DeployToServerConfigurationFactory() {
|
||||
super(DeployToServerConfigurationType.this);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public final class DeployToServerConfigurationType extends ConfigurationTypeBase
|
||||
@Override
|
||||
public String getId() {
|
||||
//compatibility reasons, before 173 it was the only configuration factory stored with this ID
|
||||
return DeployToServerConfigurationType.this.getDisplayName();
|
||||
return DeployToServerConfigurationType.this.getServerType().getDeploymentConfigurationFactoryId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class MockRuntimeConfiguration extends LocatableConfigurationBase i
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getId() {
|
||||
public String getId() {
|
||||
return "MockRuntimeConfiguration";
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,11 @@ public class AppEngineCloudType extends ServerType<AppEngineServerConfiguration>
|
||||
return "Google App Engine";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getDeploymentConfigurationFactoryId() {
|
||||
return "Google App Engine Deployment";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
|
||||
@@ -29,6 +29,11 @@ public final class GradleExternalTaskConfigurationType extends AbstractExternalS
|
||||
return (GradleExternalTaskConfigurationType)ExternalSystemUtil.findConfigurationType(GradleConstants.SYSTEM_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull String getConfigurationFactoryId() {
|
||||
return "Gradle";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected ExternalSystemRunConfiguration doCreateConfiguration(@NotNull ProjectSystemId externalSystemId,
|
||||
|
||||
@@ -69,6 +69,11 @@ public final class GroovyScriptRunConfigurationType implements ConfigurationType
|
||||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "Groovy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(@NotNull Project project) {
|
||||
return FileTypeIndex.containsFileOfType(GroovyFileType.GROOVY_FILE_TYPE, GlobalSearchScope.allScope(project));
|
||||
|
||||
@@ -28,6 +28,11 @@ public class JUnitConfigurationType implements ConfigurationType {
|
||||
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
|
||||
return new JUnitConfiguration("", project, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "JUnit";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ public class MavenApplicationConfigurationExecutionEnvironmentProvider implement
|
||||
}
|
||||
}
|
||||
|
||||
private class MavenExecConfigurationFactory extends ConfigurationFactory {
|
||||
private static class MavenExecConfigurationFactory extends ConfigurationFactory {
|
||||
private final ApplicationConfiguration myApplicationConfiguration;
|
||||
|
||||
protected MavenExecConfigurationFactory(ApplicationConfiguration applicationConfiguration) {
|
||||
@@ -228,6 +228,11 @@ public class MavenApplicationConfigurationExecutionEnvironmentProvider implement
|
||||
myApplicationConfiguration = applicationConfiguration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "Maven";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
|
||||
|
||||
@@ -227,6 +227,11 @@ public final class MavenRunConfigurationType implements ConfigurationType {
|
||||
return new MavenRunConfiguration(project, this, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "Maven";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public RunConfiguration createConfiguration(@Nullable String name, @NotNull RunConfiguration template) {
|
||||
|
||||
@@ -36,6 +36,11 @@ public final class XsltRunConfigType implements ConfigurationType {
|
||||
public RunConfiguration createTemplateConfiguration(@NotNull final Project project) {
|
||||
return new XsltRunConfiguration(project, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "XSLT";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.jetbrains.rest.RestBundle;
|
||||
import com.jetbrains.rest.RestFileType;
|
||||
import com.jetbrains.rest.run.docutils.DocutilsRunConfiguration;
|
||||
import com.jetbrains.rest.run.sphinx.SphinxRunConfiguration;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -66,10 +67,12 @@ public final class RestRunConfigurationType implements ConfigurationType {
|
||||
|
||||
private static abstract class RestConfigurationFactory extends PythonConfigurationFactoryBase {
|
||||
private final String myName;
|
||||
private final String myId;
|
||||
|
||||
RestConfigurationFactory(@NotNull final ConfigurationType type, @NotNull String name) {
|
||||
RestConfigurationFactory(@NotNull final ConfigurationType type, @NotNull String name, @NotNull @NonNls String id) {
|
||||
super(type);
|
||||
myName = name;
|
||||
myId = id;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -77,11 +80,16 @@ public final class RestRunConfigurationType implements ConfigurationType {
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return myId;
|
||||
}
|
||||
}
|
||||
|
||||
private static class DocutilsRunConfigurationFactory extends RestConfigurationFactory {
|
||||
protected DocutilsRunConfigurationFactory(ConfigurationType type) {
|
||||
super(type, "Docutils task");
|
||||
super(type, "Docutils task", "Docutils task");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,7 +101,7 @@ public final class RestRunConfigurationType implements ConfigurationType {
|
||||
|
||||
private static class SphinxRunConfigurationFactory extends RestConfigurationFactory {
|
||||
protected SphinxRunConfigurationFactory(ConfigurationType type) {
|
||||
super(type, "Sphinx task");
|
||||
super(type, "Sphinx task", "Sphinx task");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,6 +34,11 @@ public final class PythonConfigurationType implements ConfigurationType {
|
||||
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
|
||||
return new PythonRunConfiguration(project, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "Python";
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -52,5 +52,7 @@ class PyNoseTestConfiguration(project: Project, factory: PyNoseTestFactory) :
|
||||
class PyNoseTestFactory : PyAbstractTestFactory<PyNoseTestConfiguration>() {
|
||||
override fun createTemplateConfiguration(project: Project) = PyNoseTestConfiguration(project, this)
|
||||
|
||||
override fun getId(): String = "Nosetests"
|
||||
|
||||
override fun getName(): String = PyTestFrameworkService.getSdkReadableNameByFramework(PyNames.NOSE_TEST)
|
||||
}
|
||||
|
||||
@@ -57,4 +57,6 @@ class PyTrialTestFactory : PyAbstractTestFactory<PyTrialTestConfiguration>() {
|
||||
override fun createTemplateConfiguration(project: Project): PyTrialTestConfiguration = PyTrialTestConfiguration(project, this)
|
||||
|
||||
override fun getName(): String = PyTestFrameworkService.getSdkReadableNameByFramework(PyNames.TRIAL_TEST)
|
||||
|
||||
override fun getId(): String = "Twisted Trial"
|
||||
}
|
||||
|
||||
@@ -106,4 +106,6 @@ class PyUnitTestFactory : PyAbstractTestFactory<PyUnitTestConfiguration>() {
|
||||
override fun createTemplateConfiguration(project: Project): PyUnitTestConfiguration = PyUnitTestConfiguration(project, this)
|
||||
|
||||
override fun getName(): String = PythonTestConfigurationsModel.getPythonsUnittestName()
|
||||
|
||||
override fun getId(): String = "Unittests"
|
||||
}
|
||||
|
||||
@@ -96,6 +96,12 @@ public final class PythonTestConfigurationType extends ConfigurationTypeBase {
|
||||
//noinspection SpellCheckingInspection
|
||||
return PyBundle.message("runcfg.unittest.display_name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
//noinspection SpellCheckingInspection
|
||||
return "Unittests";
|
||||
}
|
||||
}
|
||||
|
||||
private static class PythonDocTestConfigurationFactory extends PythonConfigurationFactoryBase {
|
||||
@@ -115,6 +121,12 @@ public final class PythonTestConfigurationType extends ConfigurationTypeBase {
|
||||
//noinspection SpellCheckingInspection
|
||||
return PyBundle.message("runcfg.doctest.display_name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
//noinspection SpellCheckingInspection
|
||||
return "Doctests";
|
||||
}
|
||||
}
|
||||
|
||||
private static class PythonLegacyPyTestConfigurationFactory extends PythonConfigurationFactoryBase {
|
||||
@@ -134,6 +146,12 @@ public final class PythonTestConfigurationType extends ConfigurationTypeBase {
|
||||
//noinspection SpellCheckingInspection
|
||||
return PyBundle.message("runcfg.pytest.display_name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
//noinspection SpellCheckingInspection
|
||||
return "pytest";
|
||||
}
|
||||
}
|
||||
|
||||
private static class PythonLegacyNoseTestConfigurationFactory extends PythonConfigurationFactoryBase {
|
||||
@@ -153,5 +171,11 @@ public final class PythonTestConfigurationType extends ConfigurationTypeBase {
|
||||
//noinspection SpellCheckingInspection
|
||||
return PyBundle.message("runcfg.nosetests.display_name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
//noinspection SpellCheckingInspection
|
||||
return "Nosetests";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,11 @@ public final class PyToxConfigurationFactory extends PythonConfigurationFactory
|
||||
return "Tox";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getId() {
|
||||
return "Tox";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public RunConfiguration createTemplateConfiguration(@NotNull final Project project) {
|
||||
|
||||
Reference in New Issue
Block a user