mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
invert boolean: check new name to be valid identifier (IDEA-151501)
This commit is contained in:
+4
-1
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package com.intellij.refactoring.invertBoolean;
|
||||
|
||||
import com.intellij.lang.LanguageNamesValidation;
|
||||
import com.intellij.lang.findUsages.DescriptiveNameUtil;
|
||||
import com.intellij.lang.refactoring.NamesValidator;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.help.HelpManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -61,7 +63,8 @@ public class InvertBooleanDialog extends RefactoringDialog {
|
||||
protected void doAction() {
|
||||
Project project = myElement.getProject();
|
||||
final String name = myNameField.getText().trim();
|
||||
if (name.length() == 0) {
|
||||
final NamesValidator namesValidator = LanguageNamesValidation.INSTANCE.forLanguage(myElement.getLanguage());
|
||||
if (namesValidator != null && !namesValidator.isIdentifier(name, myProject)) {
|
||||
CommonRefactoringUtil.showErrorMessage(InvertBooleanHandler.REFACTORING_NAME,
|
||||
RefactoringBundle.message("please.enter.a.valid.name.for.inverted.element",
|
||||
UsageViewUtil.getType(myElement)),
|
||||
|
||||
Reference in New Issue
Block a user