Search in sources :

Example 11 with ISVNProperty

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

the class EditPropertyConflictsWizardPropertyPage method createControl.

public void createControl(Composite parent) {
    EditPropertyConflictsWizard wizard = (EditPropertyConflictsWizard) getWizard();
    ISVNLocalResource svnResource = wizard.getSvnResource();
    try {
        ISVNProperty[] properties = svnResource.getSvnProperties();
        for (int i = 0; i < properties.length; i++) {
            if (properties[i].getName().equals(propertyConflict.getPropertyName())) {
                propertyValue = properties[i].getValue();
                break;
            }
        }
    } catch (SVNException e) {
    }
    ISVNProperty[] remoteProperties = wizard.getRemoteProperties();
    for (int i = 0; i < remoteProperties.length; i++) {
        if (remoteProperties[i].getName().equals(propertyConflict.getPropertyName())) {
            remoteProperty = remoteProperties[i];
            break;
        }
    }
    Composite outerContainer = new Composite(parent, SWT.NONE);
    outerContainer.setLayout(new GridLayout());
    outerContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    myValueButton = new Button(outerContainer, SWT.RADIO);
    myValueButton.setText(Messages.EditPropertyConflictsWizardPropertyPage_0);
    myValueText = new Text(outerContainer, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.heightHint = 100;
    data.widthHint = 400;
    data.horizontalIndent = 30;
    data.grabExcessHorizontalSpace = true;
    myValueText.setLayoutData(data);
    if (propertyValue != null) {
        myValueText.setText(propertyValue);
    }
    incomingValueButton = new Button(outerContainer, SWT.RADIO);
    incomingValueButton.setText(Messages.EditPropertyConflictsWizardPropertyPage_1);
    incomingValueText = new Text(outerContainer, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.heightHint = 100;
    data.widthHint = 400;
    data.horizontalIndent = 30;
    data.grabExcessHorizontalSpace = true;
    incomingValueText.setLayoutData(data);
    if (remoteProperty != null) {
        incomingValueText.setText(remoteProperty.getValue());
    }
    myValueButton.setSelection(true);
    SelectionListener selectionListener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent evt) {
            if (incomingValueButton.getSelection()) {
                propertyValue = incomingValueText.getText();
            } else {
                propertyValue = myValueText.getText();
            }
        }
    };
    myValueButton.addSelectionListener(selectionListener);
    incomingValueButton.addSelectionListener(selectionListener);
    ModifyListener modifyListener = new ModifyListener() {

        public void modifyText(ModifyEvent evt) {
            if (evt.getSource() == myValueText && myValueButton.getSelection()) {
                propertyValue = myValueText.getText();
            }
            if (evt.getSource() == incomingValueText && incomingValueButton.getSelection()) {
                propertyValue = incomingValueText.getText();
            }
        }
    };
    myValueText.addModifyListener(modifyListener);
    incomingValueText.addModifyListener(modifyListener);
    setControl(outerContainer);
    setMessage(Messages.EditPropertyConflictsWizardPropertyPage_2 + propertyConflict.getPropertyName() + Messages.EditPropertyConflictsWizardPropertyPage_3);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 12 with ISVNProperty

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

the class PropertyCompareLocalResourceNode method getChildren.

public Object[] getChildren() {
    if (children == null) {
        List<Object> childList = new ArrayList<Object>();
        for (ISVNProperty property : properties) {
            if (property.getFile().getAbsolutePath().equals(resource.getLocation().toOSString())) {
                childList.add(new PropertyComparePropertyNode(property));
            }
        }
        if (recursive && resource instanceof IContainer) {
            try {
                IResource[] childResources = ((IContainer) resource).members();
                for (IResource childResource : childResources) {
                    PropertyCompareLocalResourceNode childNode = new PropertyCompareLocalResourceNode(childResource, true, properties);
                    childList.add(childNode);
                }
            } catch (CoreException e) {
                SVNUIPlugin.log(e);
            }
        }
        children = new Object[childList.size()];
        childList.toArray(children);
    }
    return children;
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ArrayList(java.util.ArrayList) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) IContainer(org.eclipse.core.resources.IContainer) IResource(org.eclipse.core.resources.IResource)

Example 13 with ISVNProperty

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

the class SVNPropertyAction method getSelectedSvnProperties.

/**
 * Returns the selected svn properties
 */
protected ISVNProperty[] getSelectedSvnProperties() {
    ArrayList resources = null;
    if (!selection.isEmpty()) {
        resources = new ArrayList();
        Iterator elements = ((IStructuredSelection) selection).iterator();
        while (elements.hasNext()) {
            Object next = elements.next();
            if (next instanceof ISVNProperty) {
                resources.add(next);
                continue;
            }
            if (next instanceof IAdaptable) {
                IAdaptable a = (IAdaptable) next;
                Object adapter = a.getAdapter(ISVNProperty.class);
                if (adapter instanceof ISVNProperty) {
                    resources.add(adapter);
                    continue;
                }
            }
        }
    }
    if (resources != null && !resources.isEmpty()) {
        ISVNProperty[] result = new ISVNProperty[resources.size()];
        resources.toArray(result);
        return result;
    }
    return new ISVNProperty[0];
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty)

Example 14 with ISVNProperty

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

the class ConfigureTagsAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    IResource[] resources = getSelectedResources();
    ISVNLocalResource[] svnResources = new ISVNLocalResource[resources.length];
    ISVNProperty lastProperty = null;
    for (int i = 0; i < resources.length; i++) {
        svnResources[i] = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
        try {
            // $NON-NLS-1$
            ISVNProperty property = svnResources[i].getSvnProperty("subclipse:tags");
            if (i > 0 && !propertiesEqual(property, lastProperty)) {
                MessageDialog.openError(getShell(), Messages.ConfigureTagsAction_1, Messages.ConfigureTagsAction_2);
                return;
            }
            lastProperty = property;
        } catch (SVNException e) {
        }
    }
    SvnWizardConfigureTagsPage configureTagsPage = new SvnWizardConfigureTagsPage(svnResources);
    SvnWizard wizard = new SvnWizard(configureTagsPage);
    SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
    wizard.setParentDialog(dialog);
    dialog.open();
}
Also used : SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) SVNException(org.tigris.subversion.subclipse.core.SVNException) SvnWizardConfigureTagsPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardConfigureTagsPage) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IResource(org.eclipse.core.resources.IResource)

Example 15 with ISVNProperty

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

the class LocalResource method getSvnProperty.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.ISVNLocalResource#getSvnProperty(java.lang.String)
   */
public ISVNProperty getSvnProperty(String name) throws SVNException {
    ISVNClientAdapter svnClient = null;
    try {
        svnClient = SVNProviderPlugin.getPlugin().getSVNClient();
        SVNProviderPlugin.disableConsoleLogging();
        ISVNProperty prop = svnClient.propertyGet(getFile(), name);
        return prop;
    } 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)

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