use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.
the class UnversionedCustomProperty method stripNonCustom.
private static ISVNProperty[] stripNonCustom(final ISVNProperty[] propsIn) {
List temp = new ArrayList();
for (int i = 0; i < propsIn.length; i++) {
String name = propsIn[i].getName();
if (name.startsWith("svn:") || name.startsWith("bugtraq:") || name.startsWith("tsvn:"))
continue;
temp.add(propsIn[i]);
}
ISVNProperty[] ret = new ISVNProperty[temp.size()];
int i = 0;
Iterator iter = temp.iterator();
while (iter.hasNext()) {
ret[i++] = (ISVNProperty) iter.next();
}
return ret;
}
use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.
the class SVNPropertySaveAction method execute.
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.ui.actions.SVNAction#execute(org.eclipse.jface.action.IAction)
*/
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
ISVNProperty svnProperty = getSelectedSvnProperties()[0];
SaveAsDialog dialog = new SaveAsDialog(getShell());
if (dialog.open() != SaveAsDialog.OK)
return;
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(dialog.getResult());
try {
ByteArrayInputStream is = new ByteArrayInputStream(svnProperty.getData());
file.create(is, true, null);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.
the class HistoryDialog method tagsPropertySet.
private boolean tagsPropertySet(IResource res) {
if (res == null)
return false;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(res);
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;
}
use of org.tigris.subversion.svnclientadapter.ISVNProperty in project subclipse by subclipse.
the class HistoryDialog method tagsPropertySet.
private boolean tagsPropertySet(ISVNRemoteResource res) {
ISVNClientAdapter client = null;
try {
client = SVNProviderPlugin.getPlugin().getSVNClient();
ISVNProperty property = null;
SVNProviderPlugin.disableConsoleLogging();
// $NON-NLS-1$
property = client.propertyGet(res.getUrl(), "subclipse:tags");
SVNProviderPlugin.enableConsoleLogging();
if (property != null && property.getValue() != null)
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 RemoteResourcePropertiesDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
ISVNClientAdapter client = null;
try {
client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
SVNProviderPlugin.disableConsoleLogging();
svnInfo = client.getInfo(remoteResource.getUrl());
properties = client.getProperties(remoteResource.getUrl(), SVNRevision.HEAD, SVNRevision.HEAD, false);
SVNProviderPlugin.enableConsoleLogging();
} catch (Exception e) {
errorMessage = e.getMessage();
SVNProviderPlugin.enableConsoleLogging();
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
});
// $NON-NLS-1$
getShell().setText(Policy.bind("RemoteResourcePropertiesDialog.title"));
Composite composite = new Composite(parent, SWT.NULL);
GridLayout gridLayout = new GridLayout();
gridLayout.marginTop = 5;
gridLayout.marginWidth = 10;
gridLayout.numColumns = 2;
composite.setLayout(gridLayout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
if (svnInfo == null) {
Text errorText = new Text(composite, SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
data.widthHint = 600;
data.heightHint = 100;
errorText.setLayoutData(data);
errorText.setEditable(false);
errorText.setText(errorMessage);
errorText.setBackground(composite.getBackground());
return composite;
}
Label urlLabel = new Label(composite, SWT.NONE);
urlLabel.setText(Policy.bind("RemoteResourcePropertiesDialog.url"));
Text urlText = new Text(composite, SWT.READ_ONLY);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
data.widthHint = 600;
urlText.setLayoutData(data);
urlText.setEditable(false);
urlText.setText(remoteResource.getUrl().toString());
urlText.setBackground(composite.getBackground());
Label authorLabel = new Label(composite, SWT.NONE);
authorLabel.setText(Policy.bind("RemoteResourcePropertiesDialog.author"));
Text authorText = new Text(composite, SWT.READ_ONLY);
authorText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
authorText.setEditable(false);
if (svnInfo.getLastCommitAuthor() != null)
authorText.setText(svnInfo.getLastCommitAuthor());
authorText.setBackground(composite.getBackground());
Label revisionLabel = new Label(composite, SWT.NONE);
revisionLabel.setText(Policy.bind("RemoteResourcePropertiesDialog.revision"));
Text revisionText = new Text(composite, SWT.READ_ONLY);
revisionText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
revisionText.setEditable(false);
if (svnInfo.getLastChangedRevision() != null)
revisionText.setText(svnInfo.getLastChangedRevision().toString());
revisionText.setBackground(composite.getBackground());
Label dateLabel = new Label(composite, SWT.NONE);
dateLabel.setText(Policy.bind("RemoteResourcePropertiesDialog.date"));
Text dateText = new Text(composite, SWT.READ_ONLY);
dateText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
dateText.setEditable(false);
if (svnInfo.getLastChangedDate() != null)
dateText.setText(svnInfo.getLastChangedDate().toString());
dateText.setBackground(composite.getBackground());
if (remoteResource instanceof ISVNRemoteFile) {
String lockOwner = null;
try {
lockOwner = svnInfo.getLockOwner();
} catch (Exception e) {
}
if (lockOwner != null) {
Label lockOwnerLabel = new Label(composite, SWT.NONE);
lockOwnerLabel.setText(Policy.bind("RemoteResourcePropertiesDialog.lockOwner"));
Text lockOwnerText = new Text(composite, SWT.READ_ONLY);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
data.widthHint = 600;
lockOwnerText.setLayoutData(data);
lockOwnerText.setEditable(false);
lockOwnerText.setText(svnInfo.getLockOwner());
lockOwnerText.setBackground(composite.getBackground());
}
Date lockCreationDate = null;
try {
lockCreationDate = svnInfo.getLockCreationDate();
} catch (Exception e) {
}
if (lockCreationDate != null) {
Label lockCreatedLabel = new Label(composite, SWT.NONE);
lockCreatedLabel.setText(Policy.bind("RemoteResourcePropertiesDialog.lockCreated"));
Text lockCreatedText = new Text(composite, SWT.READ_ONLY);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
data.widthHint = 600;
lockCreatedText.setLayoutData(data);
lockCreatedText.setEditable(false);
lockCreatedText.setText(svnInfo.getLockCreationDate().toString());
lockCreatedText.setBackground(composite.getBackground());
}
String lockComment = null;
try {
lockComment = svnInfo.getLockComment();
} catch (Exception e) {
}
if (lockComment != null) {
Label lockCommentLabel = new Label(composite, SWT.NONE);
lockCommentLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
lockCommentLabel.setText(Policy.bind("RemoteResourcePropertiesDialog.lockComment"));
Text lockCommentText = new Text(composite, SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY);
GridData lockCommentTextData = new GridData(SWT.FILL, SWT.FILL, true, false);
lockCommentTextData.heightHint = 100;
lockCommentTextData.widthHint = 600;
lockCommentText.setLayoutData(lockCommentTextData);
lockCommentText.setEditable(false);
lockCommentText.setText(svnInfo.getLockComment());
lockCommentText.setBackground(composite.getBackground());
}
}
SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
GridData gd_sashForm = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
gd_sashForm.heightHint = 244;
sashForm.setLayoutData(gd_sashForm);
final Table table = new Table(sashForm, SWT.FULL_SELECTION | SWT.BORDER);
final Text text = new Text(sashForm, SWT.V_SCROLL | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.WRAP);
final TableViewer viewer = new TableViewer(table);
viewer.setUseHashlookup(true);
TableLayout tableLayout = new TableLayout();
for (int i = 0; i < columnHeaders.length; i++) {
tableLayout.addColumnData(columnLayouts[i]);
TableColumn tc = new TableColumn(table, SWT.NONE, i);
tc.setResizable(columnLayouts[i].resizable);
tc.setText(columnHeaders[i]);
}
table.setLayout(tableLayout);
table.setLinesVisible(true);
table.setHeaderVisible(true);
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
ISVNProperty property = (ISVNProperty) selection.getFirstElement();
text.setText(property.getValue());
}
});
GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
gd_table.verticalIndent = 5;
gd_table.heightHint = 150;
table.setLayoutData(gd_table);
viewer.setContentProvider(new RemoteResourceContentProvider());
viewer.setLabelProvider(new RemoteResourceLabelProvider());
viewer.setInput(remoteResource);
sashForm.setWeights(new int[] { 128, 113 });
// set f1 help
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.REMOTE_RESOURCE_PROPERTIES_DIALOG);
return composite;
}
Aggregations