Search in sources :

Example 1 with ISVNProperty

use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.

the class SVNMoveDeleteHook method getDeferFileDelete.

// Get the DeferFileDelete Property for selected resource.
private boolean getDeferFileDelete(IResource resource) {
    ISVNProperty property = null;
    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
    ISVNLocalResource parent = svnResource;
    try {
        while (parent != null) {
            if (parent.isManaged()) {
                break;
            }
            parent = parent.getParent();
        }
        if (parent == null || !parent.isManaged()) {
            return false;
        }
        ISVNProperty[] deferFileDeleteProperties = parent.getPropertiesIncludingInherited(false, true, deferFileDeleteFilterList);
        if (deferFileDeleteProperties != null && deferFileDeleteProperties.length > 0) {
            return deferFileDeleteProperties[0].getValue().equalsIgnoreCase("true");
        }
    } catch (SVNException e) {
        return false;
    }
    return false;
}
Also used : ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource)

Example 2 with ISVNProperty

use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.

the class LocalResource method getPropertiesIncludingInherited.

public ISVNProperty[] getPropertiesIncludingInherited(boolean includeEmptyProperties, boolean includeClosestOnly, List<String> filterProperties) throws SVNException {
    ISVNClientAdapter svnClient = null;
    try {
        svnClient = SVNProviderPlugin.getPlugin().getSVNClient();
        SVNProviderPlugin.disableConsoleLogging();
        ISVNProperty[] properties = svnClient.getPropertiesIncludingInherited(getFile(), includeEmptyProperties, includeClosestOnly, filterProperties);
        return properties;
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        SVNProviderPlugin.enableConsoleLogging();
        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(svnClient);
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 3 with ISVNProperty

use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.

the class LocalResource method getSvnProperties.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.ISVNLocalResource#getSvnProperties()
   */
public ISVNProperty[] getSvnProperties() throws SVNException {
    ISVNClientAdapter svnClient = null;
    try {
        svnClient = getRepository().getSVNClient();
        ISVNProperty[] properties = svnClient.getProperties(getFile());
        return properties;
    } catch (SVNClientException e) {
        throw SVNException.wrapException(e);
    } finally {
        getRepository().returnSVNClient(svnClient);
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 4 with ISVNProperty

use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.

the class AliasManager method getAliases.

private Alias[] getAliases(IResource resource, boolean checkParents) {
    ArrayList<Alias> aliases = new ArrayList<Alias>();
    if (resource != null) {
        ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
        try {
            if (svnResource.isManaged()) {
                ISVNProperty property = null;
                // $NON-NLS-1$
                property = svnResource.getSvnProperty("subclipse:tags");
                if (property != null && property.getValue() != null)
                    getAliases(aliases, property.getValue(), svnResource.getUrl().toString());
                if (checkParents) {
                    IResource checkResource = resource;
                    while (checkResource.getParent() != null) {
                        checkResource = checkResource.getParent();
                        Alias[] parentAliases = getAliases(checkResource, false);
                        for (Alias parentAlias : parentAliases) {
                            if (aliases.contains(parentAlias)) {
                                Alias checkAlias = (Alias) aliases.get(aliases.indexOf(parentAlias));
                                if (parentAlias.getRevision() < checkAlias.getRevision()) {
                                    aliases.remove(checkAlias);
                                    aliases.add(parentAlias);
                                }
                            } else
                                aliases.add(parentAlias);
                        }
                    }
                }
            }
        } catch (SVNException e) {
        }
    }
    Alias[] aliasArray = new Alias[aliases.size()];
    aliases.toArray(aliasArray);
    return aliasArray;
}
Also used : ArrayList(java.util.ArrayList) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IResource(org.eclipse.core.resources.IResource)

Example 5 with ISVNProperty

use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.

the class SVNHistoryPage method tagsPropertySet.

private boolean tagsPropertySet(IResource resource) {
    if (resource == null)
        return false;
    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
    try {
        if (svnResource.isManaged()) {
            ISVNProperty property = null;
            // $NON-NLS-1$
            property = svnResource.getSvnProperty("subclipse:tags");
            if (property != null && property.getValue() != null)
                return true;
        }
    } catch (SVNException e) {
    }
    IResource checkResource = resource;
    while (checkResource.getParent() != null) {
        checkResource = checkResource.getParent();
        if (checkResource.getParent() == null)
            return false;
        svnResource = SVNWorkspaceRoot.getSVNResourceFor(checkResource);
        try {
            if (svnResource.isManaged()) {
                ISVNProperty property = null;
                // $NON-NLS-1$
                property = svnResource.getSvnProperty("subclipse:tags");
                if (property != null && property.getValue() != null)
                    return true;
            }
        } catch (SVNException e) {
        }
    }
    return false;
}
Also used : ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IResource(org.eclipse.core.resources.IResource)

Aggregations

ISVNProperty (org.tigris.subversion.svnclientadapter.ISVNProperty)30 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)13 SVNException (org.tigris.subversion.subclipse.core.SVNException)11 ArrayList (java.util.ArrayList)9 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)8 IResource (org.eclipse.core.resources.IResource)7 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)5 CoreException (org.eclipse.core.runtime.CoreException)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 TeamException (org.eclipse.team.core.TeamException)4 Iterator (java.util.Iterator)3 List (java.util.List)3 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 IToolBarManager (org.eclipse.jface.action.IToolBarManager)2 Document (org.eclipse.jface.text.Document)2 ISelection (org.eclipse.jface.viewers.ISelection)2 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2