Search in sources :

Example 6 with WorkingDirNode

use of org.eclipse.egit.ui.internal.repository.tree.WorkingDirNode in project egit by eclipse.

the class RepositoriesView method getShowInElements.

private static List<Object> getShowInElements(IStructuredSelection selection) {
    List<Object> elements = new ArrayList<>();
    for (Object element : selection.toList()) {
        if (element instanceof FileNode || element instanceof FolderNode || element instanceof WorkingDirNode) {
            RepositoryTreeNode treeNode = (RepositoryTreeNode) element;
            IPath path = treeNode.getPath();
            IResource resource = ResourceUtil.getResourceForLocation(path, false);
            if (resource != null)
                elements.add(resource);
        } else if (element instanceof RepositoryNode) {
            // Can be shown in History, Reflog and Properties views
            elements.add(element);
        } else if (element instanceof RepositoryNode || element instanceof RemoteNode || element instanceof FetchNode || element instanceof PushNode || element instanceof TagNode || element instanceof RefNode) {
            // These can be shown in Properties view directly
            elements.add(element);
        }
    }
    return elements;
}
Also used : FolderNode(org.eclipse.egit.ui.internal.repository.tree.FolderNode) IPath(org.eclipse.core.runtime.IPath) ArrayList(java.util.ArrayList) RemoteNode(org.eclipse.egit.ui.internal.repository.tree.RemoteNode) RepositoryNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryNode) PushNode(org.eclipse.egit.ui.internal.repository.tree.PushNode) RefNode(org.eclipse.egit.ui.internal.repository.tree.RefNode) FetchNode(org.eclipse.egit.ui.internal.repository.tree.FetchNode) RepositoryTreeNode(org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode) WorkingDirNode(org.eclipse.egit.ui.internal.repository.tree.WorkingDirNode) FileNode(org.eclipse.egit.ui.internal.repository.tree.FileNode) IResource(org.eclipse.core.resources.IResource) TagNode(org.eclipse.egit.ui.internal.repository.tree.TagNode)

Aggregations

WorkingDirNode (org.eclipse.egit.ui.internal.repository.tree.WorkingDirNode)6 ArrayList (java.util.ArrayList)4 FolderNode (org.eclipse.egit.ui.internal.repository.tree.FolderNode)4 IPath (org.eclipse.core.runtime.IPath)3 FileNode (org.eclipse.egit.ui.internal.repository.tree.FileNode)3 RepositoryNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryNode)3 RepositoryTreeNode (org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode)3 Repository (org.eclipse.jgit.lib.Repository)3 File (java.io.File)2 Path (org.eclipse.core.runtime.Path)2 FetchNode (org.eclipse.egit.ui.internal.repository.tree.FetchNode)2 PushNode (org.eclipse.egit.ui.internal.repository.tree.PushNode)2 RefNode (org.eclipse.egit.ui.internal.repository.tree.RefNode)2 RemoteNode (org.eclipse.egit.ui.internal.repository.tree.RemoteNode)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 Comparator (java.util.Comparator)1 List (java.util.List)1