use of org.intellij.plugins.markdown.ui.split.SplitFileEditor in project intellij-plugins by JetBrains.
the class BaseChangeSplitLayoutAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final SplitFileEditor splitFileEditor = MarkdownActionUtil.findSplitEditor(e);
if (splitFileEditor != null) {
if (myLayoutToSet == null) {
splitFileEditor.triggerLayoutChange();
} else {
splitFileEditor.triggerLayoutChange(myLayoutToSet);
e.getPresentation().putClientProperty(SELECTED_PROPERTY, true);
}
}
}
use of org.intellij.plugins.markdown.ui.split.SplitFileEditor in project intellij-plugins by JetBrains.
the class BaseChangeSplitLayoutAction method update.
@Override
public void update(AnActionEvent e) {
final SplitFileEditor splitFileEditor = MarkdownActionUtil.findSplitEditor(e);
e.getPresentation().setEnabled(splitFileEditor != null);
if (myLayoutToSet != null && splitFileEditor != null) {
e.getPresentation().putClientProperty(SELECTED_PROPERTY, splitFileEditor.getCurrentEditorLayout() == myLayoutToSet);
}
}
use of org.intellij.plugins.markdown.ui.split.SplitFileEditor in project intellij-plugins by JetBrains.
the class MarkdownActionUtil method findMarkdownTextEditor.
@Nullable
public static Editor findMarkdownTextEditor(AnActionEvent e) {
final SplitFileEditor splitEditor = findSplitEditor(e);
if (splitEditor == null) {
// This fallback is used primarily for testing
final PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
if (psiFile != null && psiFile.getLanguage() == MarkdownLanguage.INSTANCE && ApplicationManager.getApplication().isUnitTestMode()) {
return e.getData(CommonDataKeys.EDITOR);
} else {
return null;
}
}
if (!(splitEditor.getMainEditor() instanceof TextEditor)) {
return null;
}
final TextEditor mainEditor = (TextEditor) splitEditor.getMainEditor();
if (!mainEditor.getComponent().isVisible()) {
return null;
}
return mainEditor.getEditor();
}
Aggregations