use of com.intellij.openapi.actionSystem.CustomShortcutSet 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.actionSystem.CustomShortcutSet in project intellij-community by JetBrains.
the class MultiLevelDiffTool method show.
@Override
public void show(DiffRequest request) {
Collection hints = request.getHints();
boolean shouldOpenDialog = FrameDiffTool.shouldOpenDialog(hints);
if (shouldOpenDialog) {
final DialogBuilder builder = new DialogBuilder(request.getProject());
final CompositeDiffPanel diffPanel = createPanel(request, builder.getWindow(), builder);
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());
diffPanel.setDiffRequest(request);
FrameDiffTool.showDiffDialog(builder, hints);
} else {
final FrameWrapper frameWrapper = new FrameWrapper(request.getProject(), request.getGroupKey());
final CompositeDiffPanel diffPanel = createPanel(request, frameWrapper.getFrame(), frameWrapper);
if (diffPanel == null) {
Disposer.dispose(frameWrapper);
return;
}
frameWrapper.setTitle(request.getWindowTitle());
diffPanel.setDiffRequest(request);
DiffUtil.initDiffFrame(request.getProject(), frameWrapper, diffPanel, diffPanel.getComponent());
new AnAction() {
public void actionPerformed(final AnActionEvent e) {
Disposer.dispose(frameWrapper);
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")), diffPanel.getComponent());
frameWrapper.show();
}
}
use of com.intellij.openapi.actionSystem.CustomShortcutSet in project intellij-community by JetBrains.
the class ImportUsageFilteringRuleProvider method createFilteringActions.
@Override
@NotNull
public AnAction[] createFilteringActions(@NotNull final UsageView view) {
final UsageViewImpl impl = (UsageViewImpl) view;
if (view.getPresentation().isCodeUsages()) {
final JComponent component = view.getComponent();
final ShowImportsAction showImportsAction = new ShowImportsAction(impl);
showImportsAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK)), component, view);
return new AnAction[] { showImportsAction };
} else {
return AnAction.EMPTY_ARRAY;
}
}
use of com.intellij.openapi.actionSystem.CustomShortcutSet in project intellij-community by JetBrains.
the class UsageFilteringRuleProviderImpl method createFilteringActions.
@Override
@NotNull
public AnAction[] createFilteringActions(@NotNull UsageView view) {
final UsageViewImpl impl = (UsageViewImpl) view;
if (!view.getPresentation().isCodeUsages()) {
return AnAction.EMPTY_ARRAY;
}
final JComponent component = view.getComponent();
final ShowReadAccessUsagesAction read = new ShowReadAccessUsagesAction();
read.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK)), component, impl);
final ShowWriteAccessUsagesAction write = new ShowWriteAccessUsagesAction();
write.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK)), component, impl);
return new AnAction[] { read, write };
}
use of com.intellij.openapi.actionSystem.CustomShortcutSet in project intellij-community by JetBrains.
the class UsageGroupingRuleProviderImpl method createGroupingActions.
@Override
@NotNull
public AnAction[] createGroupingActions(UsageView view) {
UsageViewImpl impl = (UsageViewImpl) view;
JComponent component = impl.getComponent();
GroupByModuleTypeAction groupByModuleTypeAction = supportsModuleRule() ? new GroupByModuleTypeAction(impl) : null;
if (groupByModuleTypeAction != null) {
groupByModuleTypeAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK)), component, impl);
}
GroupByFileStructureAction groupByFileStructureAction = createGroupByFileStructureAction(impl);
GroupByScopeAction groupByScopeAction = supportsScopesRule() ? new GroupByScopeAction(impl) : null;
GroupByPackageAction groupByPackageAction = new GroupByPackageAction(impl);
groupByPackageAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK)), component, impl);
ArrayList<AnAction> result = ContainerUtil.newArrayList();
if (view.getPresentation().isUsageTypeFilteringAvailable()) {
GroupByUsageTypeAction groupByUsageTypeAction = new GroupByUsageTypeAction(impl);
groupByUsageTypeAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_DOWN_MASK)), component, impl);
ContainerUtil.addIfNotNull(result, groupByUsageTypeAction);
ContainerUtil.addIfNotNull(result, groupByScopeAction);
ContainerUtil.addIfNotNull(result, groupByModuleTypeAction);
ContainerUtil.addIfNotNull(result, groupByPackageAction);
ContainerUtil.addIfNotNull(result, groupByFileStructureAction);
} else {
ContainerUtil.addIfNotNull(result, groupByScopeAction);
ContainerUtil.addIfNotNull(result, groupByModuleTypeAction);
ContainerUtil.addIfNotNull(result, groupByPackageAction);
ContainerUtil.addIfNotNull(result, groupByFileStructureAction);
}
return result.toArray(new AnAction[result.size()]);
}
Aggregations