use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class IgnoreSynchronizeAction method getSyncInfoFilter.
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
*/
protected FastSyncInfoFilter getSyncInfoFilter() {
return new FastSyncInfoFilter() {
public boolean select(SyncInfo info) {
SyncInfoDirectionFilter filter = new SyncInfoDirectionFilter(new int[] { SyncInfo.OUTGOING });
if (!filter.select(info))
return false;
IStructuredSelection selection = getStructuredSelection();
ISynchronizeModelElement element = (ISynchronizeModelElement) selection.getFirstElement();
IResource resource = element.getResource();
if (resource == null)
return false;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
// If the resource is a IProject then the action should not be enabled.
if (svnResource.getIResource() instanceof IProject)
return false;
// If the parent is not managed there is no way to set the svn:ignore property
if (!svnResource.getParent().isManaged()) {
return false;
}
return !svnResource.getStatus().isManaged() && resource.exists();
} catch (SVNException e) {
return false;
}
}
};
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class CommentProperties method getCommentProperties.
public static CommentProperties getCommentProperties(IResource resource) throws SVNException {
CommentProperties properties = null;
IResource parent = resource;
ISVNLocalResource svnResource = null;
while (parent != null) {
svnResource = SVNWorkspaceRoot.getSVNResourceFor(parent);
if (parent instanceof IProject || (svnResource.exists() && svnResource.isManaged() && !svnResource.getStatusFromCache().isDeleted())) {
break;
}
parent = parent.getParent();
}
if (svnResource == null || !svnResource.exists() || !svnResource.isManaged() || svnResource.getStatusFromCache().isDeleted()) {
return null;
}
properties = new CommentProperties();
ISVNProperty[] commentProperties = svnResource.getPropertiesIncludingInherited(false, true, commentPropertiesFilterList);
for (ISVNProperty commentProperty : commentProperties) {
if (commentProperty.getName().equals("tsvn:logminsize")) {
int minSize = 0;
try {
minSize = Integer.parseInt(commentProperty.getValue());
} catch (Exception e) {
}
properties.setMinimumLogMessageSize(minSize);
} else if (commentProperty.getName().equals("tsvn:lockmsgminsize")) {
int minSize = 0;
try {
minSize = Integer.parseInt(commentProperty.getValue());
} catch (Exception e) {
}
properties.setMinimumLockMessageSize(minSize);
} else if (commentProperty.getName().equals("tsvn:logwidthmarker")) {
int width = 0;
try {
width = Integer.parseInt(commentProperty.getValue());
} catch (Exception e) {
}
properties.setLogWidthMarker(width);
} else if (commentProperty.getName().equals("tsvn:logtemplate")) {
properties.setLogTemplate(commentProperty.getValue());
}
}
return properties;
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class AddSynchronizeAction method getSyncInfoFilter.
protected FastSyncInfoFilter getSyncInfoFilter() {
return new FastSyncInfoFilter() {
public boolean select(SyncInfo info) {
SyncInfoDirectionFilter filter = new SyncInfoDirectionFilter(new int[] { SyncInfo.OUTGOING });
if (!filter.select(info))
return false;
IStructuredSelection selection = getStructuredSelection();
Iterator iter = selection.iterator();
while (iter.hasNext()) {
ISynchronizeModelElement element = (ISynchronizeModelElement) iter.next();
IResource resource = element.getResource();
if (resource == null)
return false;
if (resource.isLinked())
return false;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
if (svnResource.isManaged())
return false;
} catch (SVNException e) {
return false;
}
}
return true;
}
};
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class CommitAction method getUnaddedResources.
/**
* get the unadded resources in resources parameter
*/
private IResource[] getUnaddedResources(List resources, IProgressMonitor iProgressMonitor) throws SVNException {
final List unadded = new ArrayList();
final SVNException[] exception = new SVNException[] { null };
for (Iterator iter = resources.iterator(); iter.hasNext(); ) {
IResource resource = (IResource) iter.next();
if (resource.exists()) {
// visit each resource deeply
try {
resource.accept(new IResourceVisitor() {
public boolean visit(IResource aResource) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(aResource);
// skip ignored resources and their children
try {
if (svnResource.isIgnored())
return false;
// visit the children of shared resources
if (svnResource.isManaged())
return true;
if ((aResource.getType() == IResource.FOLDER) && // don't traverse into symlink folders
isSymLink(aResource))
return false;
} catch (SVNException e) {
exception[0] = e;
}
// file/folder is unshared so record it
unadded.add(aResource);
return aResource.getType() == IResource.FOLDER;
}
}, IResource.DEPTH_INFINITE, false);
} catch (CoreException e) {
throw SVNException.wrapException(e);
}
if (exception[0] != null)
throw exception[0];
}
}
if (unadded.size() > 0)
hasUnaddedResources = true;
return (IResource[]) unadded.toArray(new IResource[unadded.size()]);
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class CommitAction method onTagPath.
private boolean onTagPath(IResource[] modifiedResources) throws SVNException {
// Multiple resources selected.
if (url == null) {
IResource resource = modifiedResources[0];
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
String firstUrl = svnResource.getStatus().getUrlString();
if ((firstUrl == null) || (resource.getType() == IResource.FILE))
firstUrl = Util.getParentUrl(svnResource);
// $NON-NLS-1$
if (firstUrl.indexOf("/tags/") != -1)
return true;
} else // One resource selected.
if (url.indexOf("/tags/") != -1)
// $NON-NLS-1$
return true;
return false;
}
Aggregations