use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel in project intellij-community by JetBrains.
the class IpnbAddCellAboveAction 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();
addCell(component);
}
}
use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel in project intellij-community by JetBrains.
the class IpnbMarkdownCellAction method changeTypeToMarkdown.
public void changeTypeToMarkdown(@NotNull final IpnbFileEditor editor) {
final IpnbFilePanel filePanel = editor.getIpnbFilePanel();
final IpnbEditablePanel selectedCellPanel = filePanel.getSelectedCellPanel();
if (selectedCellPanel == null)
return;
final IpnbEditableCell cell = selectedCellPanel.getCell();
final List<IpnbCell> cells = filePanel.getIpnbFile().getCells();
final int index = cells.indexOf(selectedCellPanel.getCell());
final IpnbMarkdownCell markdownCell = new IpnbMarkdownCell(cell.getSource(), cell.getMetadata());
if (index >= 0) {
cells.set(index, markdownCell);
}
filePanel.replaceComponent(selectedCellPanel, markdownCell);
}
use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel in project intellij-community by JetBrains.
the class IpnbMergeCellAboveAction 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.hasPrevCell(cell);
e.getPresentation().setEnabled(isEnabled);
}
}
use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel 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);
}
}
use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel 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);
}
}
Aggregations