com.intellij.refactoring.RefactoringActionHandler Java Examples
The following examples show how to use
com.intellij.refactoring.RefactoringActionHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtractIncludeAction.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void update(@Nonnull final AnActionEvent e) { super.update(e); final RefactoringActionHandler handler = getHandler(e.getDataContext()); if (handler instanceof TitledHandler) { e.getPresentation().setText(((TitledHandler) handler).getActionTitle()); } else { e.getPresentation().setText("Include File..."); } }
Example #2
Source File: InlineAction.java From consulo with Apache License 2.0 | 5 votes |
@Override protected RefactoringActionHandler getHandler(@Nonnull Language language, PsiElement element) { RefactoringActionHandler handler = super.getHandler(language, element); if (handler != null) return handler; List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language); return handlers.isEmpty() ? null : new InlineRefactoringActionHandler(); }
Example #3
Source File: BaseRefactoringAction.java From consulo with Apache License 2.0 | 5 votes |
protected boolean hasAvailableHandler(@Nonnull DataContext dataContext) { final RefactoringActionHandler handler = getHandler(dataContext); if (handler != null) { if (handler instanceof ContextAwareActionHandler) { final Editor editor = dataContext.getData(CommonDataKeys.EDITOR); final PsiFile file = dataContext.getData(CommonDataKeys.PSI_FILE); if (editor != null && file != null && !((ContextAwareActionHandler)handler).isAvailableForQuickList(editor, file, dataContext)) { return false; } } return true; } return false; }
Example #4
Source File: RefactoringQuickFix.java From consulo with Apache License 2.0 | 5 votes |
default void doFix(@Nonnull PsiElement element) { final PsiElement elementToRefactor = getElementToRefactor(element); if (elementToRefactor == null) { return; } final Consumer<DataContext> consumer = dataContext -> { dataContext = enhanceDataContext(dataContext); final RefactoringActionHandler handler = getHandler(); handler.invoke(element.getProject(), new PsiElement[] {elementToRefactor}, dataContext); }; DataManager.getInstance().getDataContextFromFocus().doWhenDone(consumer); }
Example #5
Source File: BasePlatformRefactoringAction.java From consulo with Apache License 2.0 | 5 votes |
@Override protected boolean isEnabledOnElements(@Nonnull PsiElement[] elements) { if (elements.length > 0) { Language language = elements[0].getLanguage(); RefactoringActionHandler handler = getHandler(language, elements[0]); return handler instanceof ElementsHandler && ((ElementsHandler)handler).isEnabledOnElements(elements); } return false; }
Example #6
Source File: BasePlatformRefactoringAction.java From consulo with Apache License 2.0 | 5 votes |
@Nullable protected RefactoringActionHandler getHandler(@Nonnull Language language, PsiElement element) { List<RefactoringSupportProvider> providers = LanguageRefactoringSupport.INSTANCE.allForLanguage(language); if (providers.isEmpty()) return null; if (element == null) return getRefactoringHandler(providers.get(0)); for (RefactoringSupportProvider provider : providers) { if (provider.isAvailable(element)) { return getRefactoringHandler(provider, element); } } return null; }
Example #7
Source File: IntroduceConstantAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return provider.getIntroduceConstantHandler(); }
Example #8
Source File: InlineAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return new InlineRefactoringActionHandler(); }
Example #9
Source File: PushDownAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return provider.getPushDownHandler(); }
Example #10
Source File: RenameElementAction.java From consulo with Apache License 2.0 | 4 votes |
@Override public RefactoringActionHandler getHandler(@Nonnull DataContext dataContext) { return RenameHandlerRegistry.getInstance().getRenameHandler(dataContext); }
Example #11
Source File: ExtractInterfaceAction.java From consulo with Apache License 2.0 | 4 votes |
@Nullable @Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider supportProvider) { return supportProvider.getExtractInterfaceHandler(); }
Example #12
Source File: ExtractModuleAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider supportProvider) { return supportProvider.getExtractModuleHandler(); }
Example #13
Source File: ExtractIncludeAction.java From consulo with Apache License 2.0 | 4 votes |
@Nullable protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider, PsiElement element) { PsiFile file = element.getContainingFile(); if (file == null) return null; return LanguageExtractInclude.INSTANCE.forLanguage(file.getViewProvider().getBaseLanguage()); }
Example #14
Source File: BaseRefactoringAction.java From consulo with Apache License 2.0 | 4 votes |
@Nullable protected abstract RefactoringActionHandler getHandler(@Nonnull DataContext dataContext);
Example #15
Source File: ExtractMethodAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return provider.getExtractMethodHandler(); }
Example #16
Source File: IntroduceParameterAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return provider.getIntroduceParameterHandler(); }
Example #17
Source File: ExtractSuperclassAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider supportProvider) { return supportProvider.getExtractSuperClassHandler(); }
Example #18
Source File: ChangeSignatureAction.java From consulo with Apache License 2.0 | 4 votes |
@Nullable @Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return provider.getChangeSignatureHandler(); }
Example #19
Source File: ExtractIncludeAction.java From consulo with Apache License 2.0 | 4 votes |
@Nullable @Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return null; }
Example #20
Source File: InplaceRefactoring.java From consulo with Apache License 2.0 | 4 votes |
protected boolean startsOnTheSameElement(RefactoringActionHandler handler, PsiElement element) { return getVariable() == element; }
Example #21
Source File: SafeDeleteAction.java From consulo with Apache License 2.0 | 4 votes |
@Override public RefactoringActionHandler getHandler(@Nonnull DataContext dataContext) { return new SafeDeleteHandler(); }
Example #22
Source File: MoveAction.java From consulo with Apache License 2.0 | 4 votes |
@Override public RefactoringActionHandler getHandler(@Nonnull DataContext dataContext) { return new MoveHandler(); }
Example #23
Source File: PullUpAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return provider.getPullUpHandler(); }
Example #24
Source File: IntroduceFieldAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return provider.getIntroduceFieldHandler(); }
Example #25
Source File: IntroduceVariableAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return provider.getIntroduceVariableHandler(); }
Example #26
Source File: BasePlatformRefactoringAction.java From consulo with Apache License 2.0 | 4 votes |
@Nullable protected abstract RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider);
Example #27
Source File: BasePlatformRefactoringAction.java From consulo with Apache License 2.0 | 4 votes |
@Nullable protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider, PsiElement element) { return getRefactoringHandler(provider); }
Example #28
Source File: ExtractClassAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected RefactoringActionHandler getRefactoringHandler(@Nonnull RefactoringSupportProvider provider) { return provider.getExtractClassHandler(); }
Example #29
Source File: AbstractInplaceIntroducer.java From consulo with Apache License 2.0 | 4 votes |
@Override protected boolean startsOnTheSameElement(RefactoringActionHandler handler, PsiElement element) { return super.startsOnTheSameElement(handler, element) || getLocalVariable() == element; }
Example #30
Source File: CppRefactoringSupportProvider.java From CppTools with Apache License 2.0 | 4 votes |
public RefactoringActionHandler getIntroduceConstantHandler() { return null; }