use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.
the class SVNHistoryPage method tagsPropertySet.
private boolean tagsPropertySet(ISVNRemoteResource resource) {
ISVNClientAdapter client = null;
try {
client = SVNProviderPlugin.getPlugin().getSVNClient();
ISVNProperty property = null;
SVNProviderPlugin.disableConsoleLogging();
// $NON-NLS-1$
property = client.propertyGet(resource.getUrl(), "subclipse:tags");
if (property != null && property.getValue() != null) {
SVNProviderPlugin.enableConsoleLogging();
return true;
}
ISVNRemoteResource checkResource = resource;
while (checkResource.getParent() != null) {
checkResource = checkResource.getParent();
// $NON-NLS-1$
property = client.propertyGet(checkResource.getUrl(), "subclipse:tags");
if (property != null && property.getValue() != null) {
SVNProviderPlugin.enableConsoleLogging();
return true;
}
}
} catch (Exception e) {
SVNProviderPlugin.enableConsoleLogging();
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
return false;
}
use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.
the class SVNPropertyPage method getStatus.
private void getStatus() {
ISVNRepositoryLocation repository = null;
ISVNClientAdapter svnClient = null;
try {
IResource resource = (IResource) getElement();
SVNTeamProvider svnProvider = (SVNTeamProvider) RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId());
if (svnProvider == null)
return;
svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
if (svnResource == null)
return;
status = svnResource.getStatus();
if (status != null && !status.isIgnored()) {
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
ISVNInfo info = svnClient.getInfoFromWorkingCopy(svnResource.getFile());
urlCopiedFrom = info.getCopyUrl();
revision = svnResource.getRevision();
lockOwnerText = status.getLockOwner();
lockCommentText = status.getLockComment();
if (status.getLockCreationDate() != null)
lockDateText = status.getLockCreationDate().toString();
if (!status.isAdded()) {
try {
info = svnClient.getInfo(status.getUrl());
} catch (Exception e) {
}
}
// Get lock information from server if svn:needs-lock property is set
if (info != null && status.getLockOwner() == null && status.getUrlString() != null) {
ISVNProperty prop = svnResource.getSvnProperty("svn:needs-lock");
if (prop != null) {
lockOwnerText = info.getLockOwner();
if (info.getLockCreationDate() != null)
lockDateText = info.getLockCreationDate().toString();
lockCommentText = info.getLockComment();
}
}
}
} catch (Exception e) {
SVNUIPlugin.log(new Status(IStatus.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, "Property Exception", // $NON-NLS-1$
e));
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
}
use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.
the class ProjectProperties method getProjectProperties.
private static ProjectProperties getProjectProperties(File file, ISVNLocalResource svnResource) throws SVNException {
if (file == null)
return null;
ISVNLocalResource parent = svnResource;
while (parent != null) {
if (parent.exists() && parent.isManaged() && !parent.getStatusFromCache().isDeleted()) {
break;
}
parent = parent.getParent();
}
if (parent == null || !parent.exists() || !parent.isManaged() || parent.getStatusFromCache().isDeleted()) {
return null;
}
String message = null;
String logregex = null;
String label = null;
String url = null;
boolean number = false;
boolean warnifnoissue = false;
boolean append = true;
ISVNProperty[] bugtraqProperties = parent.getPropertiesIncludingInherited(false, true, propertyFilterList);
for (ISVNProperty prop : bugtraqProperties) {
if (prop.getName().equals("bugtraq:message")) {
message = prop.getValue();
} else if (prop.getName().equals("bugtraq:logregex")) {
logregex = prop.getValue();
} else if (prop.getName().equals("bugtraq:label")) {
label = prop.getValue();
} else if (prop.getName().equals("bugtraq:url")) {
url = resolveUrl(prop.getValue(), svnResource);
} else if (prop.getName().equals("bugtraq:number")) {
number = prop.getValue().equalsIgnoreCase("true");
} else if (prop.getName().equals("bugtraq:warnifnoissue")) {
warnifnoissue = prop.getValue().equalsIgnoreCase("true");
} else if (prop.getName().equals("bugtraq:append")) {
append = prop.getValue().equalsIgnoreCase("true");
}
}
ProjectProperties projectProperties = null;
if (message != null || logregex != null) {
projectProperties = new ProjectProperties();
projectProperties.setMessage(message);
projectProperties.setLogregex(logregex);
if (label != null) {
projectProperties.setLabel(label);
}
projectProperties.setUrl(url);
projectProperties.setNumber(number);
projectProperties.setWarnIfNoIssue(warnifnoissue);
projectProperties.setAppend(append);
}
return projectProperties;
}
use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.
the class UnversionedCustomProperty method getSvnRevisionProperties.
public static UnversionedCustomProperty[] getSvnRevisionProperties(final ISVNRemoteResource remoteResource, final SVNRevision revision, final SVNRevision peg, final boolean customOnly) throws SVNException {
SVNUrl url = remoteResource.getUrl();
ISVNProperty[] props = getSvnRevisionProperties(url, revision, peg);
List temp = new ArrayList();
for (int i = 0; i < props.length; i++) {
final String name = props[i].getName();
final String value = props[i].getValue();
// TODO: pull these from svnPropertyTypes prefixes rather than hardcoding
if (customOnly && (name.startsWith("svn:") || name.startsWith("bugtraq:") || name.startsWith("tsvn:")))
continue;
UnversionedCustomProperty ucp = new UnversionedCustomProperty(name, value);
temp.add(ucp);
}
UnversionedCustomProperty[] ret = new UnversionedCustomProperty[temp.size()];
int i = 0;
Iterator iter = temp.iterator();
while (iter.hasNext()) {
ret[i++] = (UnversionedCustomProperty) iter.next();
}
return ret;
}
use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.
the class SvnPropertiesView method contributeActions.
/**
* Adds the action contributions for this view.
*/
public void contributeActions() {
// Contribute actions to popup menu for the table
MenuManager menuMgr = new MenuManager();
Menu menu = menuMgr.createContextMenu(tableViewer.getTable());
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager menuMgr) {
fillTableMenu(menuMgr);
}
});
menuMgr.setRemoveAllWhenShown(true);
tableViewer.getTable().setMenu(menu);
getSite().registerContextMenu(menuMgr, tableViewer);
// Create the local tool bar
IActionBars actionBars = getViewSite().getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getDeletePropertyAction());
IToolBarManager tbm = actionBars.getToolBarManager();
tbm.add(getRefreshAction());
tbm.update(false);
// set F1 help
PlatformUI.getWorkbench().getHelpSystem().setHelp(tableViewer.getControl(), IHelpContextIds.PROPERTIES_VIEW);
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent e) {
getModifyPropertyAction().run();
}
});
// set the selectionchanged listener for the table
// updates property value when selection changes
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (selection == null || !(selection instanceof IStructuredSelection)) {
// $NON-NLS-1$
textViewer.setDocument(new Document(""));
return;
}
IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() != 1) {
// $NON-NLS-1$
textViewer.setDocument(new Document(""));
return;
}
ISVNProperty property = (ISVNProperty) ss.getFirstElement();
textViewer.setDocument(new Document(property.getValue()));
}
});
tableViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent event) {
if (event.character == SWT.DEL && event.stateMask == 0) {
getDeletePropertyAction().run();
}
}
});
}
Aggregations