public static boolean validElement(@NotNull PsiElement element) {
   if (element instanceof PsiFile) return true;
   if (!element.isPhysical()) return false;
   final RefactoringSupportProvider provider =
       LanguageRefactoringSupport.INSTANCE.forLanguage(element.getLanguage());
   return provider.isSafeDeleteAvailable(element);
 }
Exemple #2
0
 @Override
 public boolean isSafeDeleteAvailable(PsiElement element) {
   if (!element.isWritable() || element.getContainingFile() == null) return false;
   final RefactoringSupportProvider realProvider =
       ContextProvider.getContextProvider(element).getRefactoringSupportProvider();
   return realProvider != null && realProvider.isSafeDeleteAvailable(element);
 }