use of com.perl5.lang.perl.idea.refactoring.PerlRefactoringSupportProvider in project Perl5-IDEA by Camelcade.
the class PerlMemberInplaceRenameHandler method isAvailable.
@Override
protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
PsiElement nameSuggestionContext = file.findElementAt(editor.getCaretModel().getOffset());
if (nameSuggestionContext == null && editor.getCaretModel().getOffset() > 0) {
nameSuggestionContext = file.findElementAt(editor.getCaretModel().getOffset() - 1);
}
if (element == null && LookupManager.getActiveLookup(editor) != null) {
element = PsiTreeUtil.getParentOfType(nameSuggestionContext, PsiNamedElement.class);
}
final RefactoringSupportProvider supportProvider = element == null ? null : LanguageRefactoringSupport.INSTANCE.forLanguage(element.getLanguage());
return editor.getSettings().isVariableInplaceRenameEnabled() && supportProvider instanceof PerlRefactoringSupportProvider && ((PerlRefactoringSupportProvider) supportProvider).isPerlInplaceRenameAvailable(element, nameSuggestionContext);
}
Aggregations