diff --git a/java/openapi/src/com/intellij/util/xml/actions/CreateClassMappingAction.java b/java/openapi/src/com/intellij/util/xml/actions/CreateClassMappingAction.java index adb265765aa5..7d489cca4bb3 100644 --- a/java/openapi/src/com/intellij/util/xml/actions/CreateClassMappingAction.java +++ b/java/openapi/src/com/intellij/util/xml/actions/CreateClassMappingAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.xml.actions; import com.intellij.ide.util.ClassFilter; @@ -50,7 +36,7 @@ public abstract class CreateClassMappingAction extends Cre } @Override - protected DomElement createElement(final T context, final Editor editor, PsiFile file, final Project project) { + protected void createElement(final T context, final Editor editor, PsiFile file, final Project project) { PsiClass selectedClass; if (!ApplicationManager.getApplication().isUnitTestMode()) { PsiClass baseClass = getBaseClass(context, project, myBaseClass); @@ -67,13 +53,12 @@ public abstract class CreateClassMappingAction extends Cre else { selectedClass = getBaseClass(context, project, myBaseClass == null ? CommonClassNames.JAVA_LANG_OBJECT : myBaseClass); } - if (selectedClass == null) return null; + if (selectedClass == null) return; - return createElement(context, editor, file, project, selectedClass); + createElement(context, editor, file, project, selectedClass); } - @Nullable - protected DomElement createElement(final T context, + protected void createElement(final T context, final Editor editor, final PsiFile file, final Project project, @@ -81,7 +66,6 @@ public abstract class CreateClassMappingAction extends Cre final Map map = new HashMap<>(); map.put("CLASS_NAME", selectedClass.getQualifiedName()); WriteCommandAction.writeCommandAction(project, file).run(() -> DomTemplateRunner.getInstance(project).runTemplate(createElement(context), myTemplate, editor, map)); - return null; } protected @NlsContexts.DialogTitle String getChooserTitle() { diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/CreateDomElementAction.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/CreateDomElementAction.java index ff77f9760093..da4aae693793 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/CreateDomElementAction.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/CreateDomElementAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util.xml.ui.actions.generate; import com.intellij.codeInsight.actions.SimpleCodeInsightAction; @@ -42,11 +28,10 @@ public abstract class CreateDomElementAction extends Simpl @Override public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { - DomElement element = createElement(getContextElement(editor), editor, file, project); + createElement(getContextElement(editor), editor, file, project); } - @Nullable - protected abstract DomElement createElement(T context, Editor editor, PsiFile file, Project project); + protected abstract void createElement(T context, Editor editor, PsiFile file, Project project); @Override protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {