use of com.intellij.openapi.actionSystem.DataContext 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);
}
}
use of com.intellij.openapi.actionSystem.DataContext 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);
}
}
use of com.intellij.openapi.actionSystem.DataContext 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());
}
}
use of com.intellij.openapi.actionSystem.DataContext 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());
}
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class IpnbPasteCellAction 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 component = ((IpnbFileEditor) editor).getIpnbFilePanel();
pasteCell(component);
}
}
Aggregations