use of com.intellij.lang.LanguageCodeInsightActionHandler in project intellij-community by JetBrains.
the class OverrideMethodsHandler method invoke.
@Override
public final void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) {
if (!EditorModificationUtil.checkModificationAllowed(editor))
return;
if (!FileDocumentManager.getInstance().requestWriting(editor.getDocument(), project)) {
return;
}
Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
final LanguageCodeInsightActionHandler codeInsightActionHandler = CodeInsightActions.OVERRIDE_METHOD.forLanguage(language);
if (codeInsightActionHandler != null) {
codeInsightActionHandler.invoke(project, editor, file);
}
}
use of com.intellij.lang.LanguageCodeInsightActionHandler in project intellij-community by JetBrains.
the class DelegateMethodsAction method isValidForFile.
@Override
protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull final PsiFile file) {
Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
final LanguageCodeInsightActionHandler codeInsightActionHandler = CodeInsightActions.DELEGATE_METHODS.forLanguage(language);
if (codeInsightActionHandler != null) {
return codeInsightActionHandler.isValidFor(editor, file);
}
return false;
}
use of com.intellij.lang.LanguageCodeInsightActionHandler in project intellij-community by JetBrains.
the class PresentableActionHandlerBasedAction method getValidHandler.
@Nullable
private CodeInsightActionHandler getValidHandler(@NotNull Editor editor, @NotNull PsiFile file) {
Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
final CodeInsightActionHandler codeInsightActionHandler = getLanguageExtension().forLanguage(language);
if (codeInsightActionHandler != null) {
if (codeInsightActionHandler instanceof LanguageCodeInsightActionHandler) {
if (((LanguageCodeInsightActionHandler) codeInsightActionHandler).isValidFor(editor, file)) {
return codeInsightActionHandler;
}
} else {
return codeInsightActionHandler;
}
}
return null;
}
use of com.intellij.lang.LanguageCodeInsightActionHandler in project intellij-community by JetBrains.
the class DelegateMethodsHandler method invoke.
@Override
public final void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) {
if (!EditorModificationUtil.checkModificationAllowed(editor))
return;
if (!FileDocumentManager.getInstance().requestWriting(editor.getDocument(), project)) {
return;
}
Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
final LanguageCodeInsightActionHandler codeInsightActionHandler = CodeInsightActions.DELEGATE_METHODS.forLanguage(language);
if (codeInsightActionHandler != null) {
codeInsightActionHandler.invoke(project, editor, file);
}
}
use of com.intellij.lang.LanguageCodeInsightActionHandler in project intellij-community by JetBrains.
the class ImplementMethodsHandler method invoke.
@Override
public final void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) {
if (!EditorModificationUtil.checkModificationAllowed(editor))
return;
if (!FileDocumentManager.getInstance().requestWriting(editor.getDocument(), project)) {
return;
}
Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
final LanguageCodeInsightActionHandler codeInsightActionHandler = CodeInsightActions.IMPLEMENT_METHOD.forLanguage(language);
if (codeInsightActionHandler != null) {
codeInsightActionHandler.invoke(project, editor, file);
}
}
Aggregations