Package org.eclipse.egit.ui.internal.repository.tree

Examples of org.eclipse.egit.ui.internal.repository.tree.RefNode


    try {
      if (refName.startsWith(Constants.R_HEADS)) {
        Ref ref = repo.getRef(refName);
        if (ref == null)
          return false;
        node = new RefNode(localBranches, repo, ref);
      } else if (refName.startsWith(Constants.R_REMOTES)) {
        Ref ref = repo.getRef(refName);
        if (ref == null)
          return false;
        node = new RefNode(remoteBranches, repo, ref);
      } else if (Constants.HEAD.equals(refName)) {
        Ref ref = repo.getRef(refName);
        if (ref == null)
          return false;
        node = new AdditionalRefNode(references, repo, ref);
      } else {
        String mappedRef = Activator.getDefault().getRepositoryUtil()
            .mapCommitToRef(repo, refName, false);
        if (mappedRef != null
            && mappedRef.startsWith(Constants.R_REMOTES)) {
          Ref ref = repo.getRef(mappedRef);
          if (ref == null)
            return false;
          node = new RefNode(remoteBranches, repo, ref);
        } else if (mappedRef != null
            && mappedRef.startsWith(Constants.R_TAGS)) {
          Ref ref = repo.getRef(mappedRef);
          if (ref == null)
            return false;
View Full Code Here


      TreeSelection selection) {
    Iterator selIterator = selection.iterator();
    while (selIterator.hasNext()) {
      Object sel = selIterator.next();
      if (sel instanceof RefNode) {
        RefNode node = (RefNode) sel;
        String refName = node.getObject().getName();
        if (!refName.startsWith(R_HEADS)
            && !refName.startsWith(R_REMOTES))
          return false;
        if (isCurrentBranch(refName))
          return false;
View Full Code Here

    IStructuredSelection selection = (IStructuredSelection) branchTree.getSelection();
    for (Object sel : selection.toArray()) {
      if (!(sel instanceof RefNode))
        continue;

      RefNode node = (RefNode) sel;
      Ref ref = node.getObject();
      selectedRefs.add(ref);
      selected.add(ref.getName());
    }

    boolean enabled = !selected.isEmpty()
View Full Code Here

          for (IPath path : hierNode.getChildPaths()) {
            children.add(new BranchHierarchyNode(node, node
                .getRepository(), path));
          }
          for (Ref ref : hierNode.getChildRefs()) {
            children.add(new RefNode(node, node.getRepository(),
                ref));
          }
        } catch (Exception e) {
          return handleException(e, node);
        }
        return children.toArray();
      } else {
        List<RepositoryTreeNode<Ref>> refs = new ArrayList<RepositoryTreeNode<Ref>>();
        try {
          for (Entry<String, Ref> refEntry : getRefs(repo, Constants.R_HEADS).entrySet()) {
            if (!refEntry.getValue().isSymbolic())
              refs.add(new RefNode(node, repo, refEntry
                  .getValue()));
          }
        } catch (Exception e) {
          return handleException(e, node);
        }
        return refs.toArray();
      }
    }

    case REMOTETRACKING: {
      if (branchHierarchyMode) {
        BranchHierarchyNode hierNode = new BranchHierarchyNode(node,
            repo, new Path(Constants.R_REMOTES));
        List<RepositoryTreeNode> children = new ArrayList<RepositoryTreeNode>();
        try {
          for (IPath path : hierNode.getChildPaths()) {
            children.add(new BranchHierarchyNode(node, node
                .getRepository(), path));
          }
          for (Ref ref : hierNode.getChildRefs()) {
            children.add(new RefNode(node, node.getRepository(),
                ref));
          }
        } catch (Exception e) {
          return handleException(e, node);
        }
        return children.toArray();
      } else {
        List<RepositoryTreeNode<Ref>> refs = new ArrayList<RepositoryTreeNode<Ref>>();
        try {
          for (Entry<String, Ref> refEntry : getRefs(repo, Constants.R_REMOTES).entrySet()) {
            if (!refEntry.getValue().isSymbolic())
              refs.add(new RefNode(node, repo, refEntry
                  .getValue()));
          }
        } catch (Exception e) {
          return handleException(e, node);
        }

        return refs.toArray();
      }
    }

    case BRANCHHIERARCHY: {
      BranchHierarchyNode hierNode = (BranchHierarchyNode) node;
      List<RepositoryTreeNode> children = new ArrayList<RepositoryTreeNode>();
      try {
        for (IPath path : hierNode.getChildPaths()) {
          children.add(new BranchHierarchyNode(node, node
              .getRepository(), path));
        }
        for (Ref ref : hierNode.getChildRefs()) {
          children.add(new RefNode(node, node.getRepository(), ref));
        }
      } catch (IOException e) {
        return handleException(e, node);
      }
      return children.toArray();
View Full Code Here

        if (branch.getLeaf().getObjectId().equals(commit))
          availableBranches.add(branch);
      }
      RepositoryNode repoNode = new RepositoryNode(null, repo);
      for (Ref ref : availableBranches)
        nodes.add(new RefNode(repoNode, repo, ref));

    } catch (IOException e) {
      // ignore here
    }
    return nodes;
View Full Code Here

*/
public class RenameBranchCommand extends
    RepositoriesViewCommandHandler<RefNode> {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    final List<RefNode> nodes = getSelectedNodes(event);
    RefNode refNode = nodes.get(0);

    Shell shell = getShell(event);
    new BranchRenameDialog(shell, refNode.getRepository(), refNode.getObject()).open();
    return null;
  }
View Full Code Here

public class ConfigureBranchCommand extends
    RepositoriesViewCommandHandler<RefNode> {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    final List<RefNode> nodes = getSelectedNodes(event);
    if (nodes.size() == 1) {
      RefNode node = nodes.get(0);
      String branchName = Repository.shortenRefName(node.getObject()
          .getName());
      BranchConfigurationDialog dlg = new BranchConfigurationDialog(
          getShell(event), branchName, node.getRepository());
      dlg.open();
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.ui.internal.repository.tree.RefNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.