@Override
  protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {

    return editor.getSettings().isVariableInplaceRenameEnabled()
        && element instanceof PsiNameIdentifierOwner
        && element.getUseScope() instanceof LocalSearchScope
        && element.getLanguage() == PerlLanguage.INSTANCE
        && ((PsiNameIdentifierOwner) element).getNameIdentifier() instanceof PerlString
        && element.getContainingFile().getViewProvider().getAllFiles().size() < 2;
  }
 /**
  * Builds the complete set of elements to be renamed during the refactoring.
  *
  * @param element the base element for the refactoring.
  * @param newName the name into which the element is being renamed.
  * @param allRenames the map (from element to its new name) into which all additional elements to
  *     be renamed should be stored.
  */
 public void prepareRenaming(
     final PsiElement element, final String newName, final Map<PsiElement, String> allRenames) {
   prepareRenaming(element, newName, allRenames, element.getUseScope());
 }