Search in sources :

Example 26 with ISVNProperty

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;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty)

Example 27 with ISVNProperty

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);
    }
}
Also used : IFile(org.eclipse.core.resources.IFile) CoreException(org.eclipse.core.runtime.CoreException) SaveAsDialog(org.eclipse.ui.dialogs.SaveAsDialog) ByteArrayInputStream(java.io.ByteArrayInputStream) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 28 with ISVNProperty

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;
}
Also used : ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource)

Example 29 with ISVNProperty

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;
}
Also used : ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) SVNException(org.tigris.subversion.subclipse.core.SVNException) TeamException(org.eclipse.team.core.TeamException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 30 with ISVNProperty

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;
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) TableColumn(org.eclipse.swt.widgets.TableColumn) Date(java.util.Date) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

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