diff --git a/java/java-impl/src/com/intellij/lang/java/JavaRefactoringSupportProvider.java b/java/java-impl/src/com/intellij/lang/java/JavaRefactoringSupportProvider.java index 3b41f40e8fa0..7c62f3d89c92 100644 --- a/java/java-impl/src/com/intellij/lang/java/JavaRefactoringSupportProvider.java +++ b/java/java-impl/src/com/intellij/lang/java/JavaRefactoringSupportProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -67,7 +67,7 @@ public class JavaRefactoringSupportProvider extends RefactoringSupportProvider { @Override public boolean isMemberInplaceRenameAvailable(@NotNull PsiElement elementToRename, @Nullable PsiElement context) { - return elementToRename instanceof PsiMember; + return elementToRename instanceof PsiMember || elementToRename instanceof PsiJavaModule; } @Override diff --git a/java/java-impl/src/com/intellij/refactoring/rename/RenameJavaModuleProcessor.java b/java/java-impl/src/com/intellij/refactoring/rename/RenameJavaModuleProcessor.java new file mode 100644 index 000000000000..92774bebd2fe --- /dev/null +++ b/java/java-impl/src/com/intellij/refactoring/rename/RenameJavaModuleProcessor.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2017 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. + */ +package com.intellij.refactoring.rename; + +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiJavaModule; +import org.jetbrains.annotations.NotNull; + +public class RenameJavaModuleProcessor extends RenamePsiElementProcessor { + @Override + public boolean canProcessElement(@NotNull PsiElement element) { + return element instanceof PsiJavaModule; + } +} \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java index fc0cc1209a07..e32196ace4f5 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/inplace/MemberInplaceRenamer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -16,6 +16,7 @@ package com.intellij.refactoring.rename.inplace; import com.intellij.codeInsight.TargetElementUtil; +import com.intellij.lang.Language; import com.intellij.lang.findUsages.DescriptiveNameUtil; import com.intellij.lang.injection.InjectedLanguageManager; import com.intellij.openapi.application.ApplicationManager; @@ -42,6 +43,7 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.refactoring.RefactoringBundle; import com.intellij.refactoring.rename.RenameProcessor; import com.intellij.refactoring.rename.RenamePsiElementProcessor; +import com.intellij.refactoring.rename.RenameUtil; import com.intellij.refactoring.rename.naming.AutomaticRenamerFactory; import com.intellij.refactoring.util.TextOccurrencesUtil; import com.intellij.usageView.UsageViewUtil; @@ -128,6 +130,11 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer { return null; } + @Override + protected boolean isIdentifier(String newName, Language language) { + return RenameUtil.isValidName(myProject, myElementToRename, newName); + } + @Override protected Collection collectRefs(SearchScope referencesSearchScope) { final ArrayList references = new ArrayList<>(super.collectRefs(referencesSearchScope)); @@ -323,4 +330,4 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer { } } } -} +} \ No newline at end of file diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml index 16675dc9443a..3bd8818f2682 100644 --- a/resources/src/META-INF/IdeaPlugin.xml +++ b/resources/src/META-INF/IdeaPlugin.xml @@ -1614,6 +1614,7 @@ +