use of com.intellij.ide.actions.EditSourceAction in project intellij-community by JetBrains.
the class DiffPanelImpl method createToolbar.
private DiffRequest.ToolbarAddons createToolbar() {
return new DiffRequest.ToolbarAddons() {
public void customize(DiffToolbar toolbar) {
ActionManager actionManager = ActionManager.getInstance();
toolbar.addAction(actionManager.getAction("DiffPanel.Toolbar"));
toolbar.addSeparator();
toolbar.addAction(new ToggleAutoScrollAction());
toolbar.addSeparator();
toolbar.addAction(actionManager.getAction("ContextHelp"));
toolbar.addAction(getEditSourceAction());
toolbar.addSeparator();
toolbar.addAction(new DiffMergeSettingsAction(Arrays.asList(getEditor1(), getEditor2()), ServiceManager.getService(myProject, DiffToolSettings.class)));
}
@NotNull
private AnAction getEditSourceAction() {
AnAction editSourceAction = new EditSourceAction();
editSourceAction.getTemplatePresentation().setIcon(AllIcons.Actions.EditSource);
editSourceAction.getTemplatePresentation().setText(ActionsBundle.actionText("EditSource"));
editSourceAction.getTemplatePresentation().setDescription(ActionsBundle.actionText("EditSource"));
editSourceAction.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myPanel, DiffPanelImpl.this);
return editSourceAction;
}
};
}
use of com.intellij.ide.actions.EditSourceAction in project intellij-community by JetBrains.
the class IntersectingLocalChangesPanel method createPanel.
@NotNull
private BorderLayoutPanel createPanel(@NotNull JLabel label, @NotNull JTree tree) {
BorderLayoutPanel panel = JBUI.Panels.simplePanel();
panel.setBackground(UIUtil.getTextFieldBackground());
panel.addToTop(label).addToCenter(tree);
new EditSourceAction().registerCustomShortcutSet(CommonShortcuts.getEditSource(), panel);
DataManager.registerDataProvider(panel, dataId -> {
if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
return getNavigatableArray(myProject, stream(tree.getSelectionPaths()).map(TreePath::getLastPathComponent).map(node -> (ChangesBrowserNode<?>) node).flatMap(ChangesBrowserNode::getFilePathsUnderStream).map(FilePath::getVirtualFile).filter(Objects::nonNull).distinct());
}
return null;
});
return panel;
}
Aggregations