Search in sources :

Example 11 with IpnbFileEditor

use of org.jetbrains.plugins.ipnb.editor.IpnbFileEditor in project intellij-community by JetBrains.

the class IpnbMergeCellAboveAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final DataContext context = e.getDataContext();
    final IpnbFileEditor ipnbEditor = IpnbFileEditor.DATA_KEY.getData(context);
    if (ipnbEditor != null) {
        final IpnbFilePanel ipnbFilePanel = ipnbEditor.getIpnbFilePanel();
        mergeCell(ipnbFilePanel);
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) IpnbFilePanel(org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel) IpnbFileEditor(org.jetbrains.plugins.ipnb.editor.IpnbFileEditor)

Example 12 with IpnbFileEditor

use of org.jetbrains.plugins.ipnb.editor.IpnbFileEditor in project intellij-community by JetBrains.

the class IpnbMergeCellBelowAction method update.

@Override
public void update(AnActionEvent e) {
    final DataContext context = e.getDataContext();
    final IpnbFileEditor ipnbEditor = IpnbFileEditor.DATA_KEY.getData(context);
    if (ipnbEditor != null) {
        final IpnbFilePanel ipnbFilePanel = ipnbEditor.getIpnbFilePanel();
        final IpnbEditablePanel cell = ipnbFilePanel.getSelectedCellPanel();
        final boolean isEnabled = cell != null && ipnbFilePanel.hasNextCell(cell);
        e.getPresentation().setEnabled(isEnabled);
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) IpnbFilePanel(org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel) IpnbFileEditor(org.jetbrains.plugins.ipnb.editor.IpnbFileEditor) IpnbEditablePanel(org.jetbrains.plugins.ipnb.editor.panels.IpnbEditablePanel)

Example 13 with IpnbFileEditor

use of org.jetbrains.plugins.ipnb.editor.IpnbFileEditor in project intellij-community by JetBrains.

the class IpnbMergeCellBelowAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final DataContext context = e.getDataContext();
    final IpnbFileEditor ipnbEditor = IpnbFileEditor.DATA_KEY.getData(context);
    if (ipnbEditor != null) {
        final IpnbFilePanel ipnbFilePanel = ipnbEditor.getIpnbFilePanel();
        mergeCell(ipnbFilePanel);
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) IpnbFilePanel(org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel) IpnbFileEditor(org.jetbrains.plugins.ipnb.editor.IpnbFileEditor)

Example 14 with IpnbFileEditor

use of org.jetbrains.plugins.ipnb.editor.IpnbFileEditor in project intellij-community by JetBrains.

the class IpnbMoveCellDownAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    final DataContext context = event.getDataContext();
    final FileEditor editor = PlatformDataKeys.FILE_EDITOR.getData(context);
    if (editor instanceof IpnbFileEditor) {
        final IpnbFilePanel ipnbFilePanel = ((IpnbFileEditor) editor).getIpnbFilePanel();
        CommandProcessor.getInstance().executeCommand(ipnbFilePanel.getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> ipnbFilePanel.moveCell(true)), "Ipnb.moveCell", new Object());
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) FileEditor(com.intellij.openapi.fileEditor.FileEditor) IpnbFileEditor(org.jetbrains.plugins.ipnb.editor.IpnbFileEditor) IpnbFilePanel(org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel) IpnbFileEditor(org.jetbrains.plugins.ipnb.editor.IpnbFileEditor)

Example 15 with IpnbFileEditor

use of org.jetbrains.plugins.ipnb.editor.IpnbFileEditor in project intellij-community by JetBrains.

the class IpnbMoveCellUpAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    final DataContext context = event.getDataContext();
    final FileEditor editor = PlatformDataKeys.FILE_EDITOR.getData(context);
    if (editor instanceof IpnbFileEditor) {
        final IpnbFilePanel ipnbFilePanel = ((IpnbFileEditor) editor).getIpnbFilePanel();
        CommandProcessor.getInstance().executeCommand(ipnbFilePanel.getProject(), new Runnable() {

            public void run() {
                ApplicationManager.getApplication().runWriteAction(new Runnable() {

                    public void run() {
                        ipnbFilePanel.moveCell(false);
                    }
                });
            }
        }, "Ipnb.moveCell", new Object());
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) FileEditor(com.intellij.openapi.fileEditor.FileEditor) IpnbFileEditor(org.jetbrains.plugins.ipnb.editor.IpnbFileEditor) IpnbFilePanel(org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel) IpnbFileEditor(org.jetbrains.plugins.ipnb.editor.IpnbFileEditor)

Aggregations

IpnbFileEditor (org.jetbrains.plugins.ipnb.editor.IpnbFileEditor)27 DataContext (com.intellij.openapi.actionSystem.DataContext)23 IpnbFilePanel (org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel)19 FileEditor (com.intellij.openapi.fileEditor.FileEditor)14 IpnbEditablePanel (org.jetbrains.plugins.ipnb.editor.panels.IpnbEditablePanel)3 Editor (com.intellij.openapi.editor.Editor)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 IpnbCodePanel (org.jetbrains.plugins.ipnb.editor.panels.code.IpnbCodePanel)2 IpnbCodeSourcePanel (org.jetbrains.plugins.ipnb.editor.panels.code.IpnbCodeSourcePanel)2 Disposable (com.intellij.openapi.Disposable)1 CustomShortcutSet (com.intellij.openapi.actionSystem.CustomShortcutSet)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 EditorMouseAdapter (com.intellij.openapi.editor.event.EditorMouseAdapter)1 EditorMouseEvent (com.intellij.openapi.editor.event.EditorMouseEvent)1 Project (com.intellij.openapi.project.Project)1 IpnbConnectionManager (org.jetbrains.plugins.ipnb.configuration.IpnbConnectionManager)1 IpnbConnection (org.jetbrains.plugins.ipnb.protocol.IpnbConnection)1