com.intellij.codeInsight.CodeInsightActionHandler Java Examples
The following examples show how to use
com.intellij.codeInsight.CodeInsightActionHandler.
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: ShowQuickDocInfoAction.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new CodeInsightActionHandler() { @RequiredUIAccess @Override public void invoke(@Nonnull Project project, @Nonnull Editor editor, @Nonnull PsiFile file) { DocumentationManager.getInstance(project).showJavaDocInfo(editor, file, LookupManager.getActiveLookup(editor) == null); } @Override public boolean startInWriteAction() { return false; } }; }
Example #2
Source File: ServiceGenerateAction.java From idea-php-symfony2-plugin with MIT License | 6 votes |
@NotNull @Override protected CodeInsightActionHandler getHandler() { return new CodeInsightActionHandler() { @Override public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile psiFile) { if(invokePhpClass(project, editor)) { return; } if(isValidForFile(psiFile) && invokeFile(project, editor)) { return; } } @Override public boolean startInWriteAction() { return false; } }; }
Example #3
Source File: CodeInsightAction.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess public void actionPerformedImpl(@Nonnull final Project project, final Editor editor) { if (editor == null) return; //final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); final PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project); if (psiFile == null) return; final CodeInsightActionHandler handler = getHandler(); PsiElement elementToMakeWritable = handler.getElementToMakeWritable(psiFile); if (elementToMakeWritable != null && !(EditorModificationUtil.checkModificationAllowed(editor) && FileModificationService.getInstance().preparePsiElementsForWrite(elementToMakeWritable))) { return; } CommandProcessor.getInstance().executeCommand(project, () -> { final Runnable action = () -> { if (!ApplicationManager.getApplication().isHeadlessEnvironment() && !editor.getContentComponent().isShowing()) return; handler.invoke(project, editor, psiFile); }; if (handler.startInWriteAction()) { ApplicationManager.getApplication().runWriteAction(action); } else { action.run(); } }, getCommandName(), DocCommandGroupId.noneGroupId(editor.getDocument()), editor.getDocument()); }
Example #4
Source File: GotoSuperAction.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void invoke(@Nonnull final Project project, @Nonnull Editor editor, @Nonnull PsiFile file) { PsiDocumentManager.getInstance(project).commitAllDocuments(); int offset = editor.getCaretModel().getOffset(); final Language language = PsiUtilCore.getLanguageAtOffset(file, offset); final CodeInsightActionHandler codeInsightActionHandler = CodeInsightActions.GOTO_SUPER.forLanguage(language); if (codeInsightActionHandler != null) { codeInsightActionHandler.invoke(project, editor, file); } }
Example #5
Source File: OnEventGenerateAction.java From litho with Apache License 2.0 | 5 votes |
public static CodeInsightActionHandler createHandler( EventChooser eventChooser, OnEventGeneratedListener onEventGeneratedListener) { return new OnEventGenerateHandler( eventChooser, (project, originalOnEventMethod, context) -> { if (ApplicationManager.getApplication().isUnitTestMode()) { return originalOnEventMethod; } final OnEventChangeSignatureDialog onEventMethodSignatureChooser = new OnEventChangeSignatureDialog(project, originalOnEventMethod, context); onEventMethodSignatureChooser.show(); return onEventMethodSignatureChooser.getMethod(); }, onEventGeneratedListener); }
Example #6
Source File: ServiceArgumentGenerateAction.java From idea-php-symfony2-plugin with MIT License | 5 votes |
@NotNull @Override protected CodeInsightActionHandler getHandler() { return new CodeInsightActionHandler() { @Override public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile psiFile) { XmlTag serviceTag = getMatchXmlTag(editor, psiFile); if(serviceTag == null) { return; } if(!ServiceActionUtil.isValidXmlParameterInspectionService(serviceTag)) { HintManager.getInstance().showErrorHint(editor, "Sry, not supported service definition"); return; } List<String> args = ServiceActionUtil.getXmlMissingArgumentTypes(serviceTag, true, new ContainerCollectionResolver.LazyServiceCollector(project)); if (args.size() == 0) { return; } ServiceActionUtil.fixServiceArgument(args, serviceTag); } @Override public boolean startInWriteAction() { return true; } }; }
Example #7
Source File: DoctrineClassGeneratorAction.java From idea-php-annotation-plugin with MIT License | 5 votes |
@NotNull @Override protected CodeInsightActionHandler getHandler() { return new CodeInsightActionHandler() { @Override public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { int offset = editor.getCaretModel().getOffset(); if(offset <= 0) { return; } PsiElement psiElement = file.findElementAt(offset); if(psiElement == null) { return; } if(!PlatformPatterns.psiElement().inside(PhpClass.class).accepts(psiElement)) { return; } PhpClass phpClass = PsiTreeUtil.getParentOfType(psiElement, PhpClass.class); if(phpClass == null) { return; } // insert ORM alias execute(editor, phpClass, file); } @Override public boolean startInWriteAction() { return true; } }; }
Example #8
Source File: UnwrapAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler(){ return new UnwrapHandler(); }
Example #9
Source File: GotoTypeDeclarationAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return this; }
Example #10
Source File: GotoSuperAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return this; }
Example #11
Source File: ImplementMethodsAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new ImplementMethodsHandler(); }
Example #12
Source File: DelegateMethodsAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new DelegateMethodsHandler(); }
Example #13
Source File: OverrideMethodsAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new OverrideMethodsHandler(); }
Example #14
Source File: SurroundWithAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler(){ return new SurroundWithHandler(); }
Example #15
Source File: AutoIndentLinesAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new AutoIndentLinesHandler(); }
Example #16
Source File: ShowErrorDescriptionAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new ShowErrorDescriptionHandler(shouldShowDescription ? width : 0, myRequestFocus); }
Example #17
Source File: GotoNextErrorAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new GotoNextErrorHandler(true); }
Example #18
Source File: GotoPreviousErrorAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new GotoNextErrorHandler(false); }
Example #19
Source File: MethodDownAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new MethodDownHandler(); }
Example #20
Source File: FillParagraphAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new Handler(); }
Example #21
Source File: EmacsStyleIndentAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new Handler(); }
Example #22
Source File: ListTemplatesAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new ListTemplatesHandler(); }
Example #23
Source File: SurroundWithTemplateAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new SurroundWithTemplateHandler(); }
Example #24
Source File: ExpandDocCommentsAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler(){ return new CollapseExpandDocCommentsHandler(true); }
Example #25
Source File: CollapseDocCommentsAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler(){ return new CollapseExpandDocCommentsHandler(false); }
Example #26
Source File: CollapseSelectionAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new CollapseSelectionHandler(); }
Example #27
Source File: ShowIntentionActionsAction.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected CodeInsightActionHandler getHandler() { return new ShowIntentionActionsHandler(); }
Example #28
Source File: GotoTestOrCodeAction.java From consulo with Apache License 2.0 | 4 votes |
@Override @Nonnull protected CodeInsightActionHandler getHandler(){ return new GotoTestOrCodeHandler(); }
Example #29
Source File: InnerBuilderAction.java From innerbuilder with Apache License 2.0 | 4 votes |
@NotNull @Override protected CodeInsightActionHandler getHandler() { return handler; }
Example #30
Source File: InjectAction.java From android-butterknife-zelezny with Apache License 2.0 | 4 votes |
@SuppressWarnings("unused") public InjectAction(CodeInsightActionHandler handler) { super(handler); }