use of com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class StudyShowHintAction method showHintPopUp.
private static void showHintPopUp(Project project, StudyState studyState, Editor editor, StudyToolWindow hintComponent) {
final JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(hintComponent, hintComponent).setDimensionServiceKey(project, "StudyHint", false).setResizable(true).setMovable(true).setRequestFocus(true).setTitle(studyState.getTask().getName()).createPopup();
Disposer.register(popup, hintComponent);
final Component focusOwner = IdeFocusManager.getInstance(project).getFocusOwner();
DataContext dataContext = DataManager.getInstance().getDataContext(focusOwner);
PopupPositionManager.positionPopupInBestPosition(popup, editor, dataContext);
}
use of com.intellij.openapi.actionSystem.DataContext 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 com.intellij.openapi.actionSystem.DataContext in project intellij-community by JetBrains.
the class IpnbHeadingCellActionBase 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) {
changeTypeToHeading((IpnbFileEditor) editor);
}
}
use of com.intellij.openapi.actionSystem.DataContext 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 com.intellij.openapi.actionSystem.DataContext 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);
}
}
Aggregations