private void doTestInplaceRename(final String newName) throws Exception { configureByFile(BASE_PATH + "/" + getTestName(false) + ".java"); final PsiElement element = TargetElementUtil .findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED); assertNotNull(element); assertTrue("In-place rename not allowed for " + element, JavaRefactoringSupportProvider.mayRenameInplace(element, null)); CodeInsightTestUtil.doInlineRename(new VariableInplaceRenameHandler(), newName, getEditor(), element); checkResultByFile(BASE_PATH + getTestName(false) + "_after.java"); }
private void doTestInplaceRename(final String newName) throws Exception { configureByFile(BASE_PATH + "/" + getTestName(false) + ".java"); final PsiElement element = TargetElementUtilBase.findTargetElement(myEditor, TargetElementUtilBase.ELEMENT_NAME_ACCEPTED | TargetElementUtilBase.REFERENCED_ELEMENT_ACCEPTED); assertNotNull(element); assertTrue("In-place rename not allowed for " + element, JavaRefactoringSupportProvider.mayRenameInplace(element, null)); CodeInsightTestUtil.doInlineRename(new VariableInplaceRenameHandler(), newName, getEditor(), element); checkResultByFile(BASE_PATH + getTestName(false) + "_after.java"); }
@Override public boolean value(final PsiElement element) { return JavaRefactoringSupportProvider.isDisableRefactoringForLightElement(element) || element instanceof PsiJavaFile && // !JspPsiUtil.isInJspFile(element) && !JavaProjectRootsUtil.isOutsideSourceRoot((PsiFile) element) && ((PsiJavaFile) element).getClasses().length > 0; }
@Override public PsiElement findTargetMember(PsiElement element) { PsiElement target = findTargetImpl(element); if(JavaRefactoringSupportProvider.isDisableRefactoringForLightElement(target)) { return null; } return target; }
private void doTestInplaceRename(final String newName) throws Exception { configureByFile(BASE_PATH + "/" + getTestName(false) + ".java"); final PsiElement element = TargetElementUtil.findTargetElement(myEditor, ContainerUtil.newHashSet(TargetElementUtilEx.ELEMENT_NAME_ACCEPTED, TargetElementUtilEx.REFERENCED_ELEMENT_ACCEPTED)); assertNotNull(element); assertTrue("In-place rename not allowed for " + element, JavaRefactoringSupportProvider.mayRenameInplace(element, null)); CodeInsightTestUtil.doInlineRename(new VariableInplaceRenameHandler(), newName, getEditor(), element); checkResultByFile(BASE_PATH + getTestName(false) + "_after.java"); }