use of com.intellij.openapi.diff.impl.DiffPanelImpl in project intellij-community by JetBrains.
the class FocusOppositePaneAction method update.
@Override
public void update(final AnActionEvent e) {
final DiffPanelImpl diffPanel = DiffPanelImpl.fromDataContext(e.getDataContext());
e.getPresentation().setEnabled(diffPanel != null);
}
use of com.intellij.openapi.diff.impl.DiffPanelImpl in project intellij-community by JetBrains.
the class FrameDiffTool method createDiffPanelIfShouldShow.
/*public static void createEditableDiffFrame(final DiffRequest request) {
final FrameWrapper frameWrapper = new FrameWrapper(request.getProject(), request.getGroupKey());
DiffPanelImpl diffPanel = createDiffPanelIfShouldShow(request, frameWrapper.getFrame(), frameWrapper);
if (diffPanel == null) return;
diffPanel.setPatchAppliedApproximately();
frameWrapper.setTitle(request.getWindowTitle());
final DialogBuilder builder = new DialogBuilder(request.getProject());
builder.setCenterPanel(diffPanel.getComponent());
builder.setPreferedFocusComponent(diffPanel.getPreferredFocusedComponent());
final JPanel panel = new JPanel(new BorderLayout());
panel.add(builder.getCenterPanel(), BorderLayout.CENTER);
panel.add(builder.getDialogWrapper().get);
DiffUtil.initDiffFrame(frameWrapper, diffPanel);
new AnAction() {
public void actionPerformed(final AnActionEvent e) {
frameWrapper.getFrame().dispose();
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")),
diffPanel.getComponent());
frameWrapper.show();
}*/
@Nullable
private DiffPanelImpl createDiffPanelIfShouldShow(DiffRequest request, Window window, @NotNull Disposable parentDisposable, final boolean showMessage) {
DiffPanelImpl diffPanel = createDiffPanelImpl(request, window, parentDisposable);
if (checkNoDifferenceAndNotify(diffPanel, request, window, showMessage)) {
Disposer.dispose(diffPanel);
diffPanel = null;
}
return diffPanel;
}
use of com.intellij.openapi.diff.impl.DiffPanelImpl in project intellij-community by JetBrains.
the class FrameDiffTool method show.
public void show(DiffRequest request) {
Collection hints = request.getHints();
boolean shouldOpenDialog = shouldOpenDialog(hints);
if (shouldOpenDialog) {
final DialogBuilder builder = new DialogBuilder(request.getProject());
DiffPanelImpl diffPanel = createDiffPanelIfShouldShow(request, builder.getWindow(), builder, true);
if (diffPanel == null) {
Disposer.dispose(builder);
return;
}
final Runnable onOkRunnable = request.getOnOkRunnable();
if (onOkRunnable != null) {
builder.setOkOperation(() -> {
builder.getDialogWrapper().close(0);
onOkRunnable.run();
});
} else {
builder.removeAllActions();
}
builder.setCenterPanel(diffPanel.getComponent());
builder.setPreferredFocusComponent(diffPanel.getPreferredFocusedComponent());
builder.setTitle(request.getWindowTitle());
builder.setDimensionServiceKey(request.getGroupKey());
new AnAction() {
public void actionPerformed(final AnActionEvent e) {
builder.getDialogWrapper().close(0);
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")), diffPanel.getComponent());
showDiffDialog(builder, hints);
} else {
final FrameWrapper frameWrapper = new FrameWrapper(request.getProject(), request.getGroupKey());
DiffPanelImpl diffPanel = createDiffPanelIfShouldShow(request, frameWrapper.getFrame(), frameWrapper, true);
if (diffPanel == null) {
Disposer.dispose(frameWrapper);
return;
}
frameWrapper.setTitle(request.getWindowTitle());
DiffUtil.initDiffFrame(diffPanel.getProject(), frameWrapper, diffPanel, diffPanel.getComponent());
new AnAction() {
public void actionPerformed(final AnActionEvent e) {
frameWrapper.getFrame().dispose();
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")), diffPanel.getComponent());
frameWrapper.show();
}
}
use of com.intellij.openapi.diff.impl.DiffPanelImpl in project intellij-community by JetBrains.
the class FocusOppositePaneAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final DiffPanelImpl diffPanel = DiffPanelImpl.fromDataContext(e.getDataContext());
assert diffPanel != null;
diffPanel.focusOppositeSide();
}
Aggregations