mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
keep track of whether the name of a run configuration was changed by the user on the platform level; introduce LocatableConfigurationBase class for this purpose; deprecate getGeneratedName() and replace its usages with suggestedName(); delete implementations of isGeneratedName() which are now redundant
This commit is contained in:
@@ -205,11 +205,6 @@ public class AppletConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
|
||||
}
|
||||
}
|
||||
|
||||
public String getGeneratedName() {
|
||||
if (MAIN_CLASS_NAME == null) return null;
|
||||
return JavaExecutionUtil.getPresentableClassName(MAIN_CLASS_NAME, getConfigurationModule());
|
||||
}
|
||||
|
||||
public RefactoringElementListener getRefactoringElementListener(final PsiElement element) {
|
||||
if (HTML_USED) return null;
|
||||
return RefactoringListeners.getClassOrPackageListener(element, new RefactoringListeners.SingleClassConfigurationAccessor(this));
|
||||
@@ -219,15 +214,8 @@ public class AppletConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
|
||||
return getConfigurationModule().findClass(MAIN_CLASS_NAME);
|
||||
}
|
||||
|
||||
public void setGeneratedName() {
|
||||
setName(getGeneratedName());
|
||||
}
|
||||
|
||||
public boolean isGeneratedName() {
|
||||
return Comparing.equal(getName(), getGeneratedName());
|
||||
}
|
||||
|
||||
public String suggestedName() {
|
||||
if (MAIN_CLASS_NAME == null) return null;
|
||||
return ProgramRunnerUtil.shortenName(JavaExecutionUtil.getShortClassName(MAIN_CLASS_NAME), 0);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class AppletConfigurationProducer extends JavaRuntimeConfigurationProduce
|
||||
final AppletConfiguration configuration = (AppletConfiguration)settings.getConfiguration();
|
||||
configuration.MAIN_CLASS_NAME = JavaExecutionUtil.getRuntimeQualifiedName(myPsiClass);
|
||||
configuration.setModule(myPsiClass.isValid() ? ModuleUtilCore.findModuleForPsiElement(myPsiClass) : null);
|
||||
configuration.setName(configuration.getGeneratedName());
|
||||
configuration.setGeneratedName();
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
||||
+2
-23
@@ -32,7 +32,6 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.options.SettingsEditorGroup;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
@@ -95,19 +94,6 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
return group;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getGeneratedName() {
|
||||
if (MAIN_CLASS_NAME == null) {
|
||||
return null;
|
||||
}
|
||||
return JavaExecutionUtil.getPresentableClassName(MAIN_CLASS_NAME, getConfigurationModule());
|
||||
}
|
||||
|
||||
public void setGeneratedName() {
|
||||
setName(getGeneratedName());
|
||||
}
|
||||
|
||||
public RefactoringElementListener getRefactoringElementListener(final PsiElement element) {
|
||||
final RefactoringElementListener listener = RefactoringListeners.
|
||||
getClassOrPackageListener(element, new RefactoringListeners.SingleClassConfigurationAccessor(this));
|
||||
@@ -119,18 +105,11 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
return getConfigurationModule().findClass(MAIN_CLASS_NAME);
|
||||
}
|
||||
|
||||
public boolean isGeneratedName() {
|
||||
if (MAIN_CLASS_NAME == null || MAIN_CLASS_NAME.length() == 0) {
|
||||
return JavaExecutionUtil.isNewName(getName());
|
||||
}
|
||||
return Comparing.equal(getName(), getGeneratedName());
|
||||
}
|
||||
|
||||
public String suggestedName() {
|
||||
if (MAIN_CLASS_NAME == null || MAIN_CLASS_NAME.length() == 0) {
|
||||
return getName();
|
||||
return null;
|
||||
}
|
||||
return ProgramRunnerUtil.shortenName(JavaExecutionUtil.getShortClassName(MAIN_CLASS_NAME), 6) + ".main()";
|
||||
return ProgramRunnerUtil.shortenName(JavaExecutionUtil.getShortClassName(MAIN_CLASS_NAME), 6);
|
||||
}
|
||||
|
||||
public void setMainClassName(final String qualifiedName) {
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ public class ApplicationConfigurationProducer extends JavaRuntimeConfigurationPr
|
||||
RunnerAndConfigurationSettings settings = cloneTemplateConfiguration(project, context);
|
||||
final ApplicationConfiguration configuration = (ApplicationConfiguration)settings.getConfiguration();
|
||||
configuration.MAIN_CLASS_NAME = JavaExecutionUtil.getRuntimeQualifiedName(aClass);
|
||||
configuration.setName(configuration.getGeneratedName());
|
||||
configuration.setGeneratedName();
|
||||
setupConfigurationModule(context, configuration);
|
||||
JavaRunConfigurationExtensionManager.getInstance().extendCreatedConfiguration(configuration, location);
|
||||
return settings;
|
||||
|
||||
Reference in New Issue
Block a user