Search in sources :

Example 1 with ChangesBrowserNode

use of com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode in project intellij-community by JetBrains.

the class SpecificFilesViewDialog method initData.

private void initData(@NotNull final List<VirtualFile> files) {
    final TreeState state = TreeState.createOn(myView, (ChangesBrowserNode) myView.getModel().getRoot());
    final DefaultTreeModel model = TreeModelBuilder.buildFromVirtualFiles(myProject, myView.isShowFlatten(), files);
    myView.setModel(model);
    myView.expandPath(new TreePath(((ChangesBrowserNode) model.getRoot()).getPath()));
    state.applyTo(myView);
}
Also used : TreeState(com.intellij.ide.util.treeView.TreeState) TreePath(javax.swing.tree.TreePath) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) ChangesBrowserNode(com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode)

Example 2 with ChangesBrowserNode

use of com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode in project intellij-community by JetBrains.

the class ChangesListView method updateModel.

public void updateModel(@NotNull DefaultTreeModel newModel) {
    TreeState state = TreeState.createOn(this, getRoot());
    state.setScrollToSelection(false);
    DefaultTreeModel oldModel = getModel();
    setModel(newModel);
    ChangesBrowserNode newRoot = getRoot();
    expandPath(new TreePath(newRoot.getPath()));
    state.applyTo(this, newRoot);
    expandDefaultChangeList(oldModel, newRoot);
}
Also used : TreeState(com.intellij.ide.util.treeView.TreeState) TreePath(javax.swing.tree.TreePath) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) ChangesBrowserNode(com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode)

Example 3 with ChangesBrowserNode

use of com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode 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

ChangesBrowserNode (com.intellij.openapi.vcs.changes.ui.ChangesBrowserNode)3 TreePath (javax.swing.tree.TreePath)3 TreeState (com.intellij.ide.util.treeView.TreeState)2 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)2 DataManager (com.intellij.ide.DataManager)1 EditSourceAction (com.intellij.ide.actions.EditSourceAction)1 CommonDataKeys (com.intellij.openapi.actionSystem.CommonDataKeys)1 CommonShortcuts (com.intellij.openapi.actionSystem.CommonShortcuts)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 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