Search in sources :

Example 1 with RepositoryTreeNode

use of org.jetbrains.idea.svn.dialogs.RepositoryTreeNode in project intellij-community by JetBrains.

the class KeepingExpandedExpander method onBeforeRefresh.

public void onBeforeRefresh(final RepositoryTreeNode node) {
    mySelectionExpander.onBeforeRefresh(node);
    myThirdLevel = new HashMap<>();
    myExpanded = new ArrayList<>();
    final Enumeration<TreeNode> children = node.children();
    while (children.hasMoreElements()) {
        final TreeNode treeNode = children.nextElement();
        if (treeNode instanceof RepositoryTreeNode) {
            final RepositoryTreeNode repositoryNode = (RepositoryTreeNode) treeNode;
            final List<TreeNode> thirdLevelChildren = repositoryNode.getAllAlreadyLoadedChildren();
            final String nodeName = repositoryNode.getSVNDirEntry().getName();
            if (!thirdLevelChildren.isEmpty()) {
                final boolean selfExpanded = myBrowser.isExpanded(repositoryNode);
                myThirdLevel.put(nodeName, new ChildrenData(selfExpanded, thirdLevelChildren, repositoryNode.getChildrenLoadState()));
                if (selfExpanded) {
                    myExpanded.addAll(myBrowser.getExpandedSubTree(repositoryNode));
                }
            }
        }
    }
}
Also used : RepositoryTreeNode(org.jetbrains.idea.svn.dialogs.RepositoryTreeNode) TreeNode(javax.swing.tree.TreeNode) RepositoryTreeNode(org.jetbrains.idea.svn.dialogs.RepositoryTreeNode)

Example 2 with RepositoryTreeNode

use of org.jetbrains.idea.svn.dialogs.RepositoryTreeNode in project intellij-community by JetBrains.

the class KeepingExpandedExpander method onAfterRefresh.

public void onAfterRefresh(final RepositoryTreeNode node) {
    final Enumeration<TreeNode> children = node.children();
    while (children.hasMoreElements()) {
        final RepositoryTreeNode treeNode = (RepositoryTreeNode) children.nextElement();
        final String name = treeNode.getSVNDirEntry().getName();
        final ChildrenData thirdLevelLoaded = myThirdLevel.get(name);
        if (thirdLevelLoaded != null) {
            treeNode.setAlienChildren(thirdLevelLoaded.getChildren(), thirdLevelLoaded.getChildrenState());
            if (thirdLevelLoaded.isExpanded()) {
                myBrowser.expandNode(treeNode);
            }
        }
    }
    for (TreeNode expandedNode : myExpanded) {
        myBrowser.expandNode(expandedNode);
    }
    mySelectionExpander.onAfterRefresh(node);
}
Also used : RepositoryTreeNode(org.jetbrains.idea.svn.dialogs.RepositoryTreeNode) TreeNode(javax.swing.tree.TreeNode) RepositoryTreeNode(org.jetbrains.idea.svn.dialogs.RepositoryTreeNode)

Example 3 with RepositoryTreeNode

use of org.jetbrains.idea.svn.dialogs.RepositoryTreeNode in project intellij-community by JetBrains.

the class Loader method refreshNode.

protected void refreshNode(@NotNull RepositoryTreeNode node, @NotNull List<DirectoryEntry> data, @NotNull Expander expander) {
    RepositoryTreeNode existingNode = findExistingNode(node);
    if (existingNode != null) {
        expander.onBeforeRefresh(existingNode);
        existingNode.setChildren(data, getNodeLoadState());
        expander.onAfterRefresh(existingNode);
    }
}
Also used : RepositoryTreeNode(org.jetbrains.idea.svn.dialogs.RepositoryTreeNode)

Example 4 with RepositoryTreeNode

use of org.jetbrains.idea.svn.dialogs.RepositoryTreeNode in project intellij-community by JetBrains.

the class AbstractOpeningExpander method onAfterRefresh.

public void onAfterRefresh(final RepositoryTreeNode node) {
    myKeepingExpander.onAfterRefresh(node);
    if (node.isLeaf()) {
        return;
    }
    final String myUrl = node.getURL().toString();
    final ExpandVariants expandVariant = expandNode(myUrl);
    if (ExpandVariants.DO_NOTHING.equals(expandVariant)) {
        return;
    }
    // then expanded
    myBrowser.expandNode(node);
    if (ExpandVariants.EXPAND_AND_EXIT.equals(expandVariant)) {
        removeSelf();
    } else {
        final Enumeration children = node.children();
        while (children.hasMoreElements()) {
            final TreeNode treeNode = (TreeNode) children.nextElement();
            if (treeNode instanceof RepositoryTreeNode) {
                final RepositoryTreeNode repositoryTreeNode = (RepositoryTreeNode) treeNode;
                final String childUrl = repositoryTreeNode.getURL().toString();
                if (checkChild(childUrl)) {
                    if ((mySelectionPath != null) && (mySelectionPath.equals(childUrl))) {
                        myBrowser.setSelectedNode(repositoryTreeNode);
                    }
                    repositoryTreeNode.reload(this, false);
                    return;
                }
            }
        }
        removeSelf();
    }
}
Also used : Enumeration(java.util.Enumeration) RepositoryTreeNode(org.jetbrains.idea.svn.dialogs.RepositoryTreeNode) TreeNode(javax.swing.tree.TreeNode) RepositoryTreeNode(org.jetbrains.idea.svn.dialogs.RepositoryTreeNode)

Example 5 with RepositoryTreeNode

use of org.jetbrains.idea.svn.dialogs.RepositoryTreeNode in project intellij-community by JetBrains.

the class DiffOptionsDialog method update.

private void update() {
    RepositoryTreeNode baseNode = myBrowser.getSelectedNode();
    if (baseNode == null) {
        myErrorLabel.setText(SvnBundle.message("diff.options.no.url.error"));
        getOKAction().setEnabled(false);
        return;
    }
    if (myURL.equals(getTargetURL())) {
        myErrorLabel.setText(SvnBundle.message("diff.options.same.url.error"));
        getOKAction().setEnabled(false);
        return;
    }
    if (myUnifiedDiffButton.isSelected() && (myFileBrowser.getText().length() == 0 || getTargetFile().getParentFile() == null)) {
        myErrorLabel.setText(SvnBundle.message("diff.options.no.patch.file.error"));
        getOKAction().setEnabled(false);
        return;
    }
    myErrorLabel.setText(" ");
    getOKAction().setEnabled(true);
}
Also used : RepositoryTreeNode(org.jetbrains.idea.svn.dialogs.RepositoryTreeNode)

Aggregations

RepositoryTreeNode (org.jetbrains.idea.svn.dialogs.RepositoryTreeNode)6 TreeNode (javax.swing.tree.TreeNode)3 Enumeration (java.util.Enumeration)1 SVNException (org.tmatesoft.svn.core.SVNException)1 SVNURL (org.tmatesoft.svn.core.SVNURL)1