use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel in project intellij-community by JetBrains.
the class IpnbCodeCellAction method changeTypeToCode.
public void changeTypeToCode(@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 IpnbCodeCell codeCell = new IpnbCodeCell("python", cell.getSource(), null, Lists.newArrayList(), cell.getMetadata());
if (index >= 0) {
cells.set(index, codeCell);
}
filePanel.replaceComponent(selectedCellPanel, codeCell);
}
use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel in project intellij-community by JetBrains.
the class IpnbCopyCellAction 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();
copyCell(component);
}
}
use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel in project intellij-community by JetBrains.
the class IpnbCutCellAction 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();
cutCell(component);
}
}
use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel in project intellij-community by JetBrains.
the class IpnbDeleteCellAction 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();
deleteCell(component);
}
}
use of org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel in project intellij-community by JetBrains.
the class IpnbHeadingCellActionBase method changeTypeToHeading.
public void changeTypeToHeading(@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 IpnbHeadingCell heading = new IpnbHeadingCell(cell.getSource(), myLevel, cell.getMetadata());
if (index >= 0) {
cells.set(index, heading);
}
filePanel.replaceComponent(selectedCellPanel, heading);
}
Aggregations