mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
postpone create from template checks (IDEA-69877)
This commit is contained in:
@@ -84,11 +84,6 @@ public class CreateClassAction extends JavaCreateTemplateInPackageAction<PsiClas
|
||||
return createdElement.getLBrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCheckCreate(PsiDirectory dir, String className, String templateName) throws IncorrectOperationException {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(dir, className);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postProcess(PsiClass createdElement, String templateName, Map<String, String> customProperties) {
|
||||
super.postProcess(createdElement, templateName, customProperties);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.ide.actions;
|
||||
import com.intellij.psi.JavaDirectoryService;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -32,9 +31,4 @@ public abstract class JavaCreateTemplateInPackageAction<T extends PsiElement> ex
|
||||
protected boolean checkPackageExists(PsiDirectory directory) {
|
||||
return JavaDirectoryService.getInstance().getPackage(directory) != null;
|
||||
}
|
||||
|
||||
protected void doCheckCreate(PsiDirectory dir, String className, String templateName) throws IncorrectOperationException {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(dir, className);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class JavaDirectoryServiceImpl extends JavaDirectoryService {
|
||||
String name,
|
||||
String templateName,
|
||||
boolean askToDefineVariables) throws IncorrectOperationException {
|
||||
checkCreateClassOrInterface(dir, name);
|
||||
//checkCreateClassOrInterface(dir, name);
|
||||
|
||||
FileTemplate template = FileTemplateManager.getInstance().getInternalTemplate(templateName);
|
||||
|
||||
@@ -152,7 +152,7 @@ public class JavaDirectoryServiceImpl extends JavaDirectoryService {
|
||||
LOG.error(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (element == null) return null;
|
||||
final PsiJavaFile file = (PsiJavaFile)element.getContainingFile();
|
||||
PsiClass[] classes = file.getClasses();
|
||||
if (classes.length < 1) {
|
||||
|
||||
@@ -49,8 +49,6 @@ public abstract class CreateElementActionBase extends AnAction {
|
||||
@NotNull
|
||||
protected abstract PsiElement[] invokeDialog(Project project, PsiDirectory directory);
|
||||
|
||||
protected abstract void checkBeforeCreate(String newName, PsiDirectory directory) throws IncorrectOperationException;
|
||||
|
||||
/**
|
||||
* @return created elements. Never null.
|
||||
*/
|
||||
@@ -136,11 +134,6 @@ public abstract class CreateElementActionBase extends AnAction {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkBeforeCreate(String newName) throws IncorrectOperationException {
|
||||
CreateElementActionBase.this.checkBeforeCreate(newName, myDirectory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement[] create(String newName) throws Exception {
|
||||
return CreateElementActionBase.this.create(newName, myDirectory);
|
||||
|
||||
@@ -50,7 +50,6 @@ public abstract class ElementCreator {
|
||||
myErrorTitle = errorTitle;
|
||||
}
|
||||
|
||||
protected abstract void checkBeforeCreate(String newName) throws IncorrectOperationException;
|
||||
protected abstract PsiElement[] create(String newName) throws Exception;
|
||||
protected abstract String getActionName(String newName);
|
||||
|
||||
@@ -61,14 +60,6 @@ public abstract class ElementCreator {
|
||||
return PsiElement.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
try {
|
||||
checkBeforeCreate(inputString);
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
Messages.showMessageDialog(myProject, CreateElementActionBase.filterMessage(e.getMessage()), myErrorTitle, Messages.getErrorIcon());
|
||||
return PsiElement.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
final Exception[] exception = new Exception[1];
|
||||
final SmartPsiElementPointer[][] myCreatedElements = {null};
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -67,10 +66,6 @@ public class CreateFileAction extends CreateElementActionBase implements DumbAwa
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkBeforeCreate(String newName, PsiDirectory directory) throws IncorrectOperationException {
|
||||
directory.checkCreateFile(getFileName(newName));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected PsiElement[] create(String newName, PsiDirectory directory) throws Exception {
|
||||
return new PsiElement[]{directory.createFile(getFileName(newName))};
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.ide.fileTemplates.FileTemplateUtil;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -78,16 +77,4 @@ public abstract class CreateFileFromTemplateAction extends CreateFromTemplateAct
|
||||
final FileTemplate template = FileTemplateManager.getInstance().getInternalTemplate(templateName);
|
||||
return createFileFromTemplate(name, template, dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkBeforeCreate(String name, String templateName, PsiDirectory dir) {
|
||||
final FileTemplate template = FileTemplateManager.getInstance().getInternalTemplate(templateName);
|
||||
if (template != null) {
|
||||
String extension = FileUtil.getExtension(name);
|
||||
if (!extension.equals(template.getExtension())) {
|
||||
name = name + '.' + extension;
|
||||
}
|
||||
}
|
||||
super.checkBeforeCreate(name, templateName, dir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,10 +113,6 @@ public class CreateFileFromTemplateDialog extends DialogWrapper {
|
||||
final Ref<T> created = Ref.create(null);
|
||||
myDialog.getKindCombo().setSelectedName(selectedTemplateName);
|
||||
myDialog.myCreator = new ElementCreator(myProject, errorTitle) {
|
||||
@Override
|
||||
protected void checkBeforeCreate(String newName) throws IncorrectOperationException {
|
||||
creator.checkBeforeCreate(newName, myDialog.getKindCombo().getSelectedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PsiElement[] create(String newName) throws Exception {
|
||||
@@ -157,7 +153,6 @@ public class CreateFileFromTemplateDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
public interface FileCreator<T> {
|
||||
void checkBeforeCreate(@NotNull String name, @NotNull String templateName) throws IncorrectOperationException;
|
||||
|
||||
@Nullable
|
||||
T createFile(@NotNull String name, @NotNull String templateName);
|
||||
|
||||
@@ -64,9 +64,6 @@ public abstract class CreateFromTemplateAction<T extends PsiElement> extends AnA
|
||||
final Ref<String> selectedTemplateName = Ref.create(null);
|
||||
final T createdElement =
|
||||
builder.show(getErrorTitle(), getDefaultTemplateName(dir), new CreateFileFromTemplateDialog.FileCreator<T>() {
|
||||
public void checkBeforeCreate(@NotNull String name, @NotNull String templateName) {
|
||||
CreateFromTemplateAction.this.checkBeforeCreate(name, templateName, dir);
|
||||
}
|
||||
|
||||
public T createFile(@NotNull String name, @NotNull String templateName) {
|
||||
selectedTemplateName.set(templateName);
|
||||
@@ -90,10 +87,6 @@ public abstract class CreateFromTemplateAction<T extends PsiElement> extends AnA
|
||||
@Nullable
|
||||
protected abstract T createFile(String name, String templateName, PsiDirectory dir);
|
||||
|
||||
protected void checkBeforeCreate(String name, String templateName, PsiDirectory dir) {
|
||||
dir.checkCreateFile(name);
|
||||
}
|
||||
|
||||
protected abstract void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder);
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -46,12 +46,7 @@ public abstract class CreateTemplateInPackageAction<T extends PsiElement> extend
|
||||
@Override
|
||||
@Nullable
|
||||
protected T createFile(String name, String templateName, PsiDirectory dir) {
|
||||
return checkOrCreate(name, dir, templateName, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkBeforeCreate(String name, String templateName, PsiDirectory dir) {
|
||||
checkOrCreate(name, dir, templateName, true);
|
||||
return checkOrCreate(name, dir, templateName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -82,7 +77,7 @@ public abstract class CreateTemplateInPackageAction<T extends PsiElement> extend
|
||||
protected abstract boolean checkPackageExists(PsiDirectory directory);
|
||||
|
||||
@Nullable
|
||||
private T checkOrCreate(String newName, PsiDirectory directory, String templateName, boolean check) throws IncorrectOperationException {
|
||||
private T checkOrCreate(String newName, PsiDirectory directory, String templateName) throws IncorrectOperationException {
|
||||
PsiDirectory dir = directory;
|
||||
String className = newName;
|
||||
|
||||
@@ -99,11 +94,6 @@ public abstract class CreateTemplateInPackageAction<T extends PsiElement> extend
|
||||
PsiDirectory subDir = dir.findSubdirectory(name);
|
||||
|
||||
if (subDir == null) {
|
||||
if (check) {
|
||||
dir.checkCreateSubdirectory(name);
|
||||
return null;
|
||||
}
|
||||
|
||||
subDir = dir.createSubdirectory(name);
|
||||
}
|
||||
|
||||
@@ -113,15 +103,9 @@ public abstract class CreateTemplateInPackageAction<T extends PsiElement> extend
|
||||
className = names[names.length - 1];
|
||||
}
|
||||
|
||||
if (check) {
|
||||
doCheckCreate(dir, className, templateName);
|
||||
return null;
|
||||
}
|
||||
return doCreate(dir, className, templateName);
|
||||
}
|
||||
|
||||
protected abstract void doCheckCreate(PsiDirectory dir, String className, String templateName) throws IncorrectOperationException;
|
||||
|
||||
@Nullable
|
||||
protected abstract T doCreate(final PsiDirectory dir, final String className, String templateName) throws IncorrectOperationException;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.intellij.openapi.ui.InputValidator;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import org.jetbrains.android.resourceManagers.ResourceManager;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
@@ -51,11 +50,6 @@ public class CreateResourceDirectoryAction extends CreateElementActionBase {
|
||||
return new MyInputValidator(project, resDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkBeforeCreate(String newName, PsiDirectory directory) throws IncorrectOperationException {
|
||||
directory.checkCreateSubdirectory(newName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected PsiElement[] create(String newName, PsiDirectory directory) throws Exception {
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.android.resourceManagers.ResourceManager;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -131,11 +130,6 @@ public class CreateResourceFileAction extends CreateElementActionBase {
|
||||
return new MyInputValidator(project, resSubdir);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkBeforeCreate(String newName, PsiDirectory directory) throws IncorrectOperationException {
|
||||
directory.checkCreateFile(newName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected PsiElement[] create(String newName, PsiDirectory directory) throws Exception {
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.xml.XmlDocument;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.PsiNavigateUtil;
|
||||
import com.intellij.xml.refactoring.XmlTagInplaceRenamer;
|
||||
import org.jetbrains.android.AndroidFileTemplateProvider;
|
||||
@@ -89,11 +88,6 @@ public class CreateTypedResourceFileAction extends CreateElementActionBase {
|
||||
return validator.getCreatedElements();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkBeforeCreate(String name, PsiDirectory directory) throws IncorrectOperationException {
|
||||
directory.checkCreateFile(AndroidFileTemplateProvider.getFileNameByNewElementName(name));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected PsiElement[] create(String newName, PsiDirectory directory) throws Exception {
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import org.jetbrains.android.AndroidFileTemplateProvider;
|
||||
import org.jetbrains.android.dom.manifest.Action;
|
||||
@@ -78,10 +77,6 @@ public class NewAndroidComponentDialog extends DialogWrapper {
|
||||
init();
|
||||
setTitle(AndroidBundle.message("android.new.component.action.command.name"));
|
||||
myCreator = new ElementCreator(module.getProject(), CommonBundle.getErrorTitle()) {
|
||||
@Override
|
||||
protected void checkBeforeCreate(String newName) throws IncorrectOperationException {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(directory, newName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PsiElement[] create(String newName) throws Exception {
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.jetbrains.idea.devkit.actions;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.psi.JavaDirectoryService;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -44,11 +43,6 @@ public abstract class GenerateClassAndPatchPluginXmlActionBase extends GenerateP
|
||||
return validator.getCreatedElements();
|
||||
}
|
||||
|
||||
protected void checkBeforeCreate(String newName, PsiDirectory directory) throws IncorrectOperationException {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(directory, newName);
|
||||
super.checkBeforeCreate(newName, directory);
|
||||
}
|
||||
|
||||
protected abstract ComponentType getComponentType();
|
||||
|
||||
public void patchPluginXml(XmlFile pluginXml, PsiClass klass) throws IncorrectOperationException {
|
||||
|
||||
@@ -73,44 +73,6 @@ public abstract class GeneratePluginClassAction extends CreateElementActionBase
|
||||
if (pluginXml != null) myFilesToPatch.add(pluginXml);
|
||||
}
|
||||
|
||||
protected void checkBeforeCreate(String newName, PsiDirectory directory) throws IncorrectOperationException {
|
||||
final Project project = directory.getProject();
|
||||
final Module module = getModule(directory);
|
||||
|
||||
if (module != null) {
|
||||
if (ModuleType.get(module) == PluginModuleType.getInstance()) {
|
||||
addPluginModule(module);
|
||||
} else {
|
||||
final List<Module> candidateModules = PluginModuleType.getCandidateModules(module);
|
||||
final Iterator<Module> it = candidateModules.iterator();
|
||||
while (it.hasNext()) {
|
||||
Module m = it.next();
|
||||
if (PluginModuleType.getPluginXml(m) == null) it.remove();
|
||||
}
|
||||
|
||||
if (candidateModules.size() == 1) {
|
||||
addPluginModule(candidateModules.get(0));
|
||||
} else {
|
||||
final ChooseModulesDialog dialog = new ChooseModulesDialog(project, candidateModules, getTemplatePresentation().getDescription());
|
||||
dialog.show();
|
||||
if (!dialog.isOK()) {
|
||||
// create() should return CANCELED now
|
||||
return;
|
||||
} else {
|
||||
final List<Module> modules = dialog.getSelectedModules();
|
||||
for (Module m : modules) {
|
||||
addPluginModule(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (myFilesToPatch.size() == 0) {
|
||||
throw new IncorrectOperationException(DevKitBundle.message("error.no.plugin.xml"));
|
||||
}
|
||||
}
|
||||
|
||||
public void update(final AnActionEvent e) {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
@@ -161,7 +123,46 @@ public abstract class GeneratePluginClassAction extends CreateElementActionBase
|
||||
return fileIndex.getModuleForFile(vFile);
|
||||
}
|
||||
|
||||
@NotNull protected PsiElement[] create(String newName, PsiDirectory directory) throws Exception {
|
||||
@NotNull
|
||||
protected PsiElement[] create(String newName, PsiDirectory directory) throws Exception {
|
||||
final Project project = directory.getProject();
|
||||
final Module module = getModule(directory);
|
||||
|
||||
if (module != null) {
|
||||
if (ModuleType.get(module) == PluginModuleType.getInstance()) {
|
||||
addPluginModule(module);
|
||||
}
|
||||
else {
|
||||
final List<Module> candidateModules = PluginModuleType.getCandidateModules(module);
|
||||
final Iterator<Module> it = candidateModules.iterator();
|
||||
while (it.hasNext()) {
|
||||
Module m = it.next();
|
||||
if (PluginModuleType.getPluginXml(m) == null) it.remove();
|
||||
}
|
||||
|
||||
if (candidateModules.size() == 1) {
|
||||
addPluginModule(candidateModules.get(0));
|
||||
}
|
||||
else {
|
||||
final ChooseModulesDialog dialog = new ChooseModulesDialog(project, candidateModules, getTemplatePresentation().getDescription());
|
||||
dialog.show();
|
||||
if (!dialog.isOK()) {
|
||||
// create() should return CANCELED now
|
||||
return CANCELED;
|
||||
}
|
||||
else {
|
||||
final List<Module> modules = dialog.getSelectedModules();
|
||||
for (Module m : modules) {
|
||||
addPluginModule(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (myFilesToPatch.size() == 0) {
|
||||
throw new IncorrectOperationException(DevKitBundle.message("error.no.plugin.xml"));
|
||||
}
|
||||
if (myFilesToPatch.size() == 0) {
|
||||
// user canceled module selection
|
||||
return CANCELED;
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.jetbrains.idea.devkit.actions;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.psi.JavaDirectoryService;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -50,11 +49,6 @@ public class NewActionAction extends GeneratePluginClassAction {
|
||||
return PsiElement.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
protected void checkBeforeCreate(String newName, PsiDirectory directory) throws IncorrectOperationException {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(directory, newName);
|
||||
super.checkBeforeCreate(newName, directory);
|
||||
}
|
||||
|
||||
protected String getClassTemplateName() {
|
||||
return "Action.java";
|
||||
}
|
||||
|
||||
@@ -23,10 +23,8 @@ import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.psi.JavaDirectoryService;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.util.GroovyUtils;
|
||||
@@ -77,8 +75,4 @@ public abstract class NewGroovyActionBase extends CreateElementActionBase {
|
||||
protected String getErrorTitle() {
|
||||
return CommonBundle.getErrorTitle();
|
||||
}
|
||||
|
||||
protected void checkBeforeCreate(String newName, PsiDirectory directory) throws IncorrectOperationException {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(directory, newName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,11 +63,6 @@ public class NewScriptAction extends JavaCreateTemplateInPackageAction<GroovyFil
|
||||
return createdFile.getLastChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doCheckCreate(PsiDirectory dir, String className, String templateName) throws IncorrectOperationException {
|
||||
dir.checkCreateFile(className + "." + extractExtension(templateName));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected GroovyFile doCreate(PsiDirectory directory, String newName, String templateName) throws IncorrectOperationException {
|
||||
PsiFile file =
|
||||
@@ -85,4 +80,4 @@ public class NewScriptAction extends JavaCreateTemplateInPackageAction<GroovyFil
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,10 +86,6 @@ public final class CreateDialogAction extends AbstractCreateFormAction {
|
||||
return UIDesignerBundle.message("command.create.dialog");
|
||||
}
|
||||
|
||||
protected void checkBeforeCreate(final String newName, final PsiDirectory directory) throws IncorrectOperationException {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(directory, newName);
|
||||
}
|
||||
|
||||
protected String getErrorTitle() {
|
||||
return UIDesignerBundle.message("error.cannot.create.dialog");
|
||||
}
|
||||
|
||||
@@ -76,12 +76,6 @@ public class CreateFormAction extends AbstractCreateFormAction {
|
||||
return validator.getCreatedElements();
|
||||
}
|
||||
|
||||
protected void checkBeforeCreate(String newName, PsiDirectory directory) throws IncorrectOperationException {
|
||||
if (myLastClassName != null) {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(directory, myLastClassName);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected PsiElement[] create(String newName, PsiDirectory directory) throws Exception {
|
||||
PsiElement createdFile;
|
||||
|
||||
Reference in New Issue
Block a user