Java Code Examples for org.tigris.subversion.svnclientadapter.SVNNodeKind#DIR

The following examples show how to use org.tigris.subversion.svnclientadapter.SVNNodeKind#DIR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CreateFolderAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isEnabled() {
    Browser browser = getBrowser();
    if(browser == null) {
        return false;
    }        
    if(browser.getExplorerManager().getRootContext() == Node.EMPTY) {
        return false;
    }
    Node[] nodes = getBrowser().getSelectedNodes();
    if(nodes.length != 1) {
        return false;
    }
    return nodes[0] instanceof RepositoryPathNode && 
           ((RepositoryPathNode) nodes[0]).getEntry().getSvnNodeKind() == SVNNodeKind.DIR;
}
 
Example 2
Source File: SwitchToAction.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean validateInput(File root, RepositoryFile toRepositoryFile) {
    boolean ret = false;
    SvnClient client;
    try {                   
        client = Subversion.getInstance().getClient(toRepositoryFile.getRepositoryUrl());
        ISVNInfo info = client.getInfo(toRepositoryFile.getFileUrl());
        if(info.getNodeKind() == SVNNodeKind.DIR && root.isFile()) {
            SvnClientExceptionHandler.annotate(NbBundle.getMessage(SwitchToAction.class, "LBL_SwitchFileToFolderError"));
            ret = false;
        } else if(info.getNodeKind() == SVNNodeKind.FILE && root.isDirectory()) {
            SvnClientExceptionHandler.annotate(NbBundle.getMessage(SwitchToAction.class, "LBL_SwitchFolderToFileError"));
            ret = false;
        } else {
            ret = true;
        }
    } catch (SVNClientException ex) {
        SvnClientExceptionHandler.notifyException(ex, true, true);
        return ret;
    }                            
    return ret;
}
 
Example 3
Source File: RepositoryPathNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private RepositoryPathNode(BrowserClient client, RepositoryPathEntry entry, boolean repositoryFolder) {
    super(entry.getSvnNodeKind() == SVNNodeKind.DIR ? new RepositoryPathChildren(client) : Children.LEAF);
    this.entry = entry;
    this.client = client;
    this.repositoryFolder = repositoryFolder;
    initProperties();
}
 
Example 4
Source File: RepositoryPathNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon(int type) {
    if (entry.getSvnNodeKind() == SVNNodeKind.DIR) {
        return getTreeFolderIcon(false);
    } else {
        return super.getIcon(type);
    }
}
 
Example 5
Source File: RepositoryPathNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Image getOpenedIcon(int type) {
    if (entry.getSvnNodeKind() == SVNNodeKind.DIR) {
        return getTreeFolderIcon(true);
    } else {
        return super.getOpenedIcon(type);
    }
}
 
Example 6
Source File: JhlConverter.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public static SVNNodeKind convertNodeKind(org.apache.subversion.javahl.types.NodeKind javahlNodeKind) {
	if (javahlNodeKind == null) {
		return null;
	}
    switch(javahlNodeKind) {
        case dir  : return SVNNodeKind.DIR; 
        case file : return SVNNodeKind.FILE; 
        case none : return SVNNodeKind.NONE; 
        case unknown : return SVNNodeKind.UNKNOWN;
        default: {
        	log.severe("unknown node kind :"+javahlNodeKind);
        	return SVNNodeKind.UNKNOWN; // should never go here
        }
    }
}
 
Example 7
Source File: FileInformation.java    From netbeans with Apache License 2.0 4 votes vote down vote up
FileInformation(int status, ISVNStatus entry) {
    this(status, 0, entry, entry.getNodeKind() == SVNNodeKind.DIR);
}
 
Example 8
Source File: Browser.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public List<RepositoryPathNode.RepositoryPathEntry> listRepositoryPath(final RepositoryPathNode.RepositoryPathEntry entry, SvnProgressSupport support) throws SVNClientException {

    List<RepositoryPathNode.RepositoryPathEntry> ret = new ArrayList<RepositoryPathNode.RepositoryPathEntry>();

    synchronized (supportList) {
        if(cancelled) {
            support.cancel();
            return ret;
        }
        supportList.add(support);
    }

    try {

        if(entry.getSvnNodeKind().equals(SVNNodeKind.FILE)) {
            return ret; // nothing to do...
        }

        Subversion subversion = Subversion.getInstance();
        SVNUrl svnUrl = this.repositoryRoot.getRepositoryUrl();
        SvnClient client = (username != null)
                           ? subversion.getClient(svnUrl, username, password, support)
                           : subversion.getClient(svnUrl, support);
        if(support.isCanceled()) {
            return null;
        }

        ISVNDirEntry[] dirEntries = client.getList(
                                        entry.getRepositoryFile().getFileUrl(),
                                        entry.getRepositoryFile().getRevision(),
                                        false
                                    );

        if(dirEntries == null || dirEntries.length == 0) {
            return ret; // nothing to do...
        }
        for (ISVNDirEntry dirEntry : dirEntries) {
            if(support.isCanceled()) {
                return null;
            }
            if( dirEntry.getNodeKind()==SVNNodeKind.DIR ||                  // directory or
                    (dirEntry.getNodeKind()==SVNNodeKind.FILE &&                // (file and show_files_allowed)
                    ((mode & BROWSER_SHOW_FILES) == BROWSER_SHOW_FILES)) )
            {
                RepositoryFile repositoryFile = new RepositoryFile(
                        entry.getRepositoryFile().getRepositoryUrl(),
                        entry.getRepositoryFile().getFileUrl().appendPath(dirEntry.getPath()),
                        dirEntry.getLastChangedRevision());
                RepositoryPathNode.RepositoryPathEntry e =
                        new RepositoryPathNode.RepositoryPathEntry(
                        repositoryFile,
                        dirEntry.getNodeKind(),
                        dirEntry.getLastChangedRevision(),
                        dirEntry.getLastChangedDate(),
                        dirEntry.getLastCommitAuthor());
                ret.add(e);
            }
        }

    } catch (SVNClientException ex) {
        if(SvnClientExceptionHandler.isWrongURLInRevision(ex.getMessage())) {
            // is not a folder in the repository
            return null;
        } else {
            support.annotate(ex);
            throw ex;
        }
    }
    finally {
        synchronized (supportList) {
            supportList.remove(support);
        }
    }

    return ret;
}
 
Example 9
Source File: RepositoryPathNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static RepositoryPathNode createDelayedExpandNode(BrowserClient client, RepositoryFile file) {
    return new DelayedExpandNode(client, new RepositoryPathEntry(file, SVNNodeKind.DIR, new SVNRevision(0), null, ""), true);
}