Search in sources :

Example 36 with ISVNLocalResource

use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.

the class ResourceWithStatusUtil method getPropertyStatus.

public static String getPropertyStatus(IResource resource) {
    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
    String result = null;
    try {
        LocalResourceStatus status = svnResource.getStatus();
        if (status.isPropConflicted())
            // $NON-NLS-1$
            result = Policy.bind("CommitDialog.conflicted");
        else if ((svnResource.getStatus() != null) && (svnResource.getStatus().getPropStatus() != null) && (svnResource.getStatus().getPropStatus().equals(SVNStatusKind.MODIFIED)))
            // $NON-NLS-1$
            result = Policy.bind("CommitDialog.modified");
        else
            // $NON-NLS-1$
            result = "";
    } catch (TeamException e) {
        // $NON-NLS-1$
        result = "";
    }
    return result;
}
Also used : TeamException(org.eclipse.team.core.TeamException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)

Example 37 with ISVNLocalResource

use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.

the class ResourceWithStatusUtil method getStatusKind.

public static SVNStatusKind getStatusKind(IResource resource) {
    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
    SVNStatusKind statusKind = null;
    try {
        LocalResourceStatus status = svnResource.getStatus();
        if (status.isTextConflicted())
            statusKind = SVNStatusKind.CONFLICTED;
        else if (status.isAdded())
            statusKind = SVNStatusKind.ADDED;
        else if (status.isDeleted())
            statusKind = SVNStatusKind.DELETED;
        else if (status.isMissing())
            statusKind = SVNStatusKind.MISSING;
        else if (status.isReplaced())
            statusKind = SVNStatusKind.REPLACED;
        else if (status.isTextModified())
            statusKind = SVNStatusKind.MODIFIED;
        else if (!status.isManaged())
            statusKind = SVNStatusKind.UNVERSIONED;
    } catch (TeamException e) {
    }
    return statusKind;
}
Also used : TeamException(org.eclipse.team.core.TeamException) SVNStatusKind(org.tigris.subversion.svnclientadapter.SVNStatusKind) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)

Example 38 with ISVNLocalResource

use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.

the class SVNLightweightDecorator method resourceStateChanged.

/**
 * @see
 *     org.tigris.subversion.subclipse.core.IResourceStateChangeListener#resourceStateChanged(org.eclipse.core.resources.IResource[])
 */
public void resourceStateChanged(IResource[] changedResources) {
    // add depth first so that update thread processes parents first.
    // System.out.println(">> State Change Event");
    Set resourcesToUpdate = new HashSet();
    for (int i = 0; i < changedResources.length; i++) {
        IResource resource = changedResources[i];
        if (resource != null) {
            if (resource.exists()) {
                if (computeDeepDirtyCheck) {
                    IResource current = resource;
                    while ((current.getType() != IResource.ROOT) && (!resourcesToUpdate.contains(current))) {
                        resourcesToUpdate.add(current);
                        current = current.getParent();
                    }
                } else {
                    resourcesToUpdate.add(resource);
                }
            } else {
                // (We can no longer count on .svn folder updates forcing refresh)
                try {
                    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
                    if (!svnResource.isIgnored()) {
                        IResource current = resource.getParent();
                        while (current.getType() != IResource.ROOT) {
                            if (current.exists() && SVNWorkspaceRoot.getSVNResourceFor(current).isManaged()) {
                                resourcesToUpdate.add(current);
                            }
                            current = current.getParent();
                        }
                    }
                } catch (SVNException e) {
                }
            }
        }
    }
    postLabelEvent(new LabelProviderChangedEvent(this, resourcesToUpdate.toArray()));
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) SVNException(org.tigris.subversion.subclipse.core.SVNException) LabelProviderChangedEvent(org.eclipse.jface.viewers.LabelProviderChangedEvent) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IResource(org.eclipse.core.resources.IResource) HashSet(java.util.HashSet)

Example 39 with ISVNLocalResource

use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.

the class ChooseUrlDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    // $NON-NLS-1$
    getShell().setText(Policy.bind("ChooseUrlDialog.title"));
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    if (message != null) {
        Label messageLabel = new Label(composite, SWT.NONE);
        messageLabel.setText(message);
    }
    if (multipleSelect)
        treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
    else
        treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    contentProvider = new RemoteContentProvider();
    contentProvider.setIncludeBranchesAndTags(includeBranchesAndTags);
    contentProvider.setResource(resource);
    treeViewer.setContentProvider(contentProvider);
    if (foldersOnly)
        treeViewer.addFilter(RepositoryFilters.FOLDERS_ONLY);
    // treeViewer.setLabelProvider(new WorkbenchLabelProvider());
    treeViewer.setLabelProvider(new RemoteLabelProvider());
    ISVNRepositoryLocation repository = null;
    if (repositoryLocation == null) {
        if (resource == null)
            treeViewer.setInput(new AllRootsElement());
        else {
            ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
            try {
                LocalResourceStatus status = svnResource.getStatus();
                if (status != null) {
                    repository = svnResource.getStatus().getRepository();
                }
            } catch (SVNException e1) {
            }
            if (repository == null) {
                repository = svnResource.getRepository();
            }
            if (!repository.getUrl().toString().equals(repository.getRepositoryRoot().toString())) {
                RepositoryRootFolder rootFolder = new RepositoryRootFolder(repository, repository.getRepositoryRoot(), repository.getRootFolder().getRevision());
                contentProvider.setRootFolder(rootFolder);
            }
        }
    } else {
        repository = repositoryLocation;
    }
    if (repository == null)
        treeViewer.setInput(new AllRootsElement());
    else {
        try {
            repository.validateConnection(new NullProgressMonitor());
            treeViewer.setInput(repository);
        } catch (SVNException e) {
            MessageDialog.openError(getShell(), Policy.bind("ChooseUrlDialog.title"), e.getMessage());
            saveLocation = false;
            cancelPressed();
            return composite;
        }
    }
    GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
    data.heightHint = LIST_HEIGHT_HINT;
    data.widthHint = LIST_WIDTH_HINT;
    treeViewer.getControl().setLayoutData(data);
    // when F5 is pressed, refresh
    treeViewer.getControl().addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent event) {
            if (event.keyCode == SWT.F5) {
                refreshAction.run();
            }
        }
    });
    treeViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent e) {
            okPressed();
        }
    });
    // Create the popup menu
    MenuManager menuMgr = new MenuManager();
    Tree tree = treeViewer.getTree();
    Menu menu = menuMgr.createContextMenu(tree);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            manager.add(newFolderAction);
            if (!treeViewer.getSelection().isEmpty())
                manager.add(deleteFolderAction);
            manager.add(refreshAction);
        }
    });
    menuMgr.setRemoveAllWhenShown(true);
    tree.setMenu(menu);
    // set F1 help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.CHOOSE_URL_DIALOG);
    return composite;
}
Also used : RepositoryRootFolder(org.tigris.subversion.subclipse.core.resources.RepositoryRootFolder) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) KeyAdapter(org.eclipse.swt.events.KeyAdapter) Label(org.eclipse.swt.widgets.Label) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IMenuListener(org.eclipse.jface.action.IMenuListener) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) RemoteContentProvider(org.tigris.subversion.subclipse.ui.repository.model.RemoteContentProvider) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) AllRootsElement(org.tigris.subversion.subclipse.ui.repository.model.AllRootsElement) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Tree(org.eclipse.swt.widgets.Tree) Menu(org.eclipse.swt.widgets.Menu) IMenuManager(org.eclipse.jface.action.IMenuManager) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)

Example 40 with ISVNLocalResource

use of org.tigris.subversion.subclipse.core.ISVNLocalResource 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)

Aggregations

ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)120 IResource (org.eclipse.core.resources.IResource)77 SVNException (org.tigris.subversion.subclipse.core.SVNException)76 ArrayList (java.util.ArrayList)39 CoreException (org.eclipse.core.runtime.CoreException)24 Iterator (java.util.Iterator)20 IFile (org.eclipse.core.resources.IFile)20 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)20 InvocationTargetException (java.lang.reflect.InvocationTargetException)18 List (java.util.List)18 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)18 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)17 LocalResourceStatus (org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)17 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)17 File (java.io.File)16 TeamException (org.eclipse.team.core.TeamException)16 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)15 ISynchronizeModelElement (org.eclipse.team.ui.synchronize.ISynchronizeModelElement)14 IContainer (org.eclipse.core.resources.IContainer)13 SyncInfo (org.eclipse.team.core.synchronize.SyncInfo)11