Search in sources :

Example 1 with EditSourceAction

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;
        }
    };
}
Also used : ToggleAutoScrollAction(com.intellij.openapi.diff.actions.ToggleAutoScrollAction) EditSourceAction(com.intellij.ide.actions.EditSourceAction) DiffMergeSettingsAction(com.intellij.openapi.diff.impl.settings.DiffMergeSettingsAction)

Example 2 with 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;
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI) JBLabel(com.intellij.ui.components.JBLabel) UtilKt.stream(com.intellij.util.containers.UtilKt.stream) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) JBUI(com.intellij.util.ui.JBUI) ToolWindowId(com.intellij.openapi.wm.ToolWindowId) ContentsUtil.addContent(com.intellij.util.ContentsUtil.addContent) EditSourceAction(com.intellij.ide.actions.EditSourceAction) Project(com.intellij.openapi.project.Project) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) DataManager(com.intellij.ide.DataManager) FilePath(com.intellij.openapi.vcs.FilePath) ChangesBrowserNode(com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode) TreeUIHelper(com.intellij.ui.TreeUIHelper) ChangesUtil.getNavigatableArray(com.intellij.openapi.vcs.changes.ChangesUtil.getNavigatableArray) TreeModelBuilder(com.intellij.openapi.vcs.changes.ui.TreeModelBuilder) BooleanGetter(com.intellij.openapi.util.BooleanGetter) ToolWindow(com.intellij.openapi.wm.ToolWindow) TreePath(javax.swing.tree.TreePath) Content(com.intellij.ui.content.Content) java.awt(java.awt) Objects(java.util.Objects) ChangesBrowserNodeRenderer(com.intellij.openapi.vcs.changes.ui.ChangesBrowserNodeRenderer) CommonShortcuts(com.intellij.openapi.actionSystem.CommonShortcuts) List(java.util.List) ContentFactory(com.intellij.ui.content.ContentFactory) SimpleTree(com.intellij.ui.treeStructure.SimpleTree) NotNull(org.jetbrains.annotations.NotNull) javax.swing(javax.swing) TreePath(javax.swing.tree.TreePath) Objects(java.util.Objects) ChangesBrowserNode(com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode) EditSourceAction(com.intellij.ide.actions.EditSourceAction) BorderLayoutPanel(com.intellij.util.ui.components.BorderLayoutPanel) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

EditSourceAction (com.intellij.ide.actions.EditSourceAction)2 DataManager (com.intellij.ide.DataManager)1 CommonDataKeys (com.intellij.openapi.actionSystem.CommonDataKeys)1 CommonShortcuts (com.intellij.openapi.actionSystem.CommonShortcuts)1 ToggleAutoScrollAction (com.intellij.openapi.diff.actions.ToggleAutoScrollAction)1 DiffMergeSettingsAction (com.intellij.openapi.diff.impl.settings.DiffMergeSettingsAction)1 Project (com.intellij.openapi.project.Project)1 MultiLineLabelUI (com.intellij.openapi.ui.MultiLineLabelUI)1 BooleanGetter (com.intellij.openapi.util.BooleanGetter)1 FilePath (com.intellij.openapi.vcs.FilePath)1 ChangesUtil.getNavigatableArray (com.intellij.openapi.vcs.changes.ChangesUtil.getNavigatableArray)1 ChangesBrowserNode (com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode)1 ChangesBrowserNodeRenderer (com.intellij.openapi.vcs.changes.ui.ChangesBrowserNodeRenderer)1 TreeModelBuilder (com.intellij.openapi.vcs.changes.ui.TreeModelBuilder)1 ToolWindow (com.intellij.openapi.wm.ToolWindow)1 ToolWindowId (com.intellij.openapi.wm.ToolWindowId)1 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)1 TreeUIHelper (com.intellij.ui.TreeUIHelper)1 JBLabel (com.intellij.ui.components.JBLabel)1 Content (com.intellij.ui.content.Content)1