Search in sources :

Example 6 with LocalResourceStatus

use of org.tigris.subversion.subclipse.core.resources.LocalResourceStatus in project subclipse by subclipse.

the class SVNHistoryPage method inputSet.

public boolean inputSet() {
    Object input = getInput();
    if (input instanceof IResource) {
        IResource res = (IResource) input;
        RepositoryProvider teamProvider = RepositoryProvider.getProvider(res.getProject(), SVNProviderPlugin.getTypeId());
        if (teamProvider != null) {
            try {
                ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(res);
                LocalResourceStatus localResourceStatus = (localResource != null) ? localResource.getStatus() : null;
                if (localResource != null && localResourceStatus.isManaged() && (!localResourceStatus.isAdded() || localResourceStatus.isCopied())) {
                    this.resource = res;
                    this.remoteResource = localResource.getBaseResource();
                    this.projectProperties = ProjectProperties.getProjectProperties(res);
                    boolean includeBugs = projectProperties != null;
                    boolean includeTags = tagsPropertySet(res);
                    if (includeTags != this.includeTags || this.includeBugs != includeBugs) {
                        this.includeTags = includeTags;
                        this.includeBugs = includeBugs;
                        refreshTable();
                    }
                    this.historyTableProvider.setRemoteResource(this.remoteResource);
                    this.historyTableProvider.setProjectProperties(this.projectProperties);
                    if (historySearchViewerFilter != null) {
                        // HistorySearchViewerFilter[] filters = { historySearchViewerFilter };
                        // this.tableHistoryViewer.setFilters(filters);
                        this.tableHistoryViewer.resetFilters();
                        this.tableHistoryViewer.addFilter(historySearchViewerFilter);
                        historySearchDialog = new HistorySearchDialog(getSite().getShell(), remoteResource);
                        historySearchDialog.setSearchAll(false);
                        historySearchDialog.setStartRevision(historySearchViewerFilter.getStartRevision());
                        historySearchDialog.setEndRevision(historySearchViewerFilter.getEndRevision());
                        historySearchViewerFilter = null;
                        getClearSearchAction().setEnabled(true);
                    } else {
                        this.tableHistoryViewer.resetFilters();
                        getClearSearchAction().setEnabled(false);
                    }
                    this.tableHistoryViewer.setInput(this.remoteResource);
                    // setTitleToolTip(baseResource.getRepositoryRelativePath());
                    return true;
                }
            } catch (TeamException e) {
                SVNUIPlugin.openError(getSite().getShell(), null, null, e);
            }
        }
    } else if (input instanceof ISVNRemoteResource) {
        this.resource = null;
        this.remoteResource = (ISVNRemoteResource) input;
        boolean includeTags = tagsPropertySet(remoteResource);
        if (includeTags != this.includeTags) {
            this.includeTags = includeTags;
            refreshTable();
        }
        try {
            this.projectProperties = ProjectProperties.getProjectProperties(this.remoteResource);
        } catch (SVNException e) {
            if (!e.operationInterrupted()) {
                SVNUIPlugin.openError(getSite().getShell(), null, null, e);
            }
        }
        boolean includeBugs = projectProperties != null;
        if (includeTags != this.includeTags || this.includeBugs != includeBugs) {
            this.includeTags = includeTags;
            this.includeBugs = includeBugs;
            refreshTable();
        }
        this.historyTableProvider.setRemoteResource(this.remoteResource);
        this.historyTableProvider.setProjectProperties(this.projectProperties);
        if (historySearchViewerFilter != null) {
            // HistorySearchViewerFilter[] filters = { historySearchViewerFilter };
            // this.tableHistoryViewer.setFilters(filters);
            this.tableHistoryViewer.resetFilters();
            this.tableHistoryViewer.addFilter(historySearchViewerFilter);
            historySearchDialog = new HistorySearchDialog(getSite().getShell(), remoteResource);
            historySearchDialog.setSearchAll(false);
            historySearchDialog.setStartRevision(historySearchViewerFilter.getStartRevision());
            historySearchDialog.setEndRevision(historySearchViewerFilter.getEndRevision());
            historySearchViewerFilter = null;
            getClearSearchAction().setEnabled(true);
        } else {
            this.tableHistoryViewer.resetFilters();
            getClearSearchAction().setEnabled(false);
        }
        this.tableHistoryViewer.setInput(this.remoteResource);
        // setTitleToolTip(remoteResource.getRepositoryRelativePath());
        return true;
    }
    return false;
}
Also used : TeamException(org.eclipse.team.core.TeamException) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNException(org.tigris.subversion.subclipse.core.SVNException) RepositoryProvider(org.eclipse.team.core.RepositoryProvider) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) HistorySearchDialog(org.tigris.subversion.subclipse.ui.dialogs.HistorySearchDialog) IResource(org.eclipse.core.resources.IResource)

Example 7 with LocalResourceStatus

use of org.tigris.subversion.subclipse.core.resources.LocalResourceStatus in project subclipse by subclipse.

the class ResourceWithStatusUtil method getStatus.

public static String getStatus(IResource resource) {
    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
    String result = null;
    try {
        LocalResourceStatus status = svnResource.getStatus();
        if (// $NON-NLS-1$
        status.isTextConflicted())
            // $NON-NLS-1$
            result = Policy.bind("CommitDialog.conflicted");
        else if (// $NON-NLS-1$
        status.isAdded())
            // $NON-NLS-1$
            result = Policy.bind("CommitDialog.added");
        else if (// $NON-NLS-1$
        status.isDeleted())
            // $NON-NLS-1$
            result = Policy.bind("CommitDialog.deleted");
        else if (// $NON-NLS-1$
        status.isMissing())
            // $NON-NLS-1$
            result = Policy.bind("CommitDialog.missing");
        else if (// $NON-NLS-1$
        status.isReplaced())
            // $NON-NLS-1$
            result = Policy.bind("CommitDialog.replaced");
        else if (status.isTextModified())
            // $NON-NLS-1$
            result = Policy.bind("CommitDialog.modified");
        else if (// $NON-NLS-1$
        !status.isManaged())
            // $NON-NLS-1$
            result = Policy.bind("CommitDialog.unversioned");
        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 8 with LocalResourceStatus

use of org.tigris.subversion.subclipse.core.resources.LocalResourceStatus 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 9 with LocalResourceStatus

use of org.tigris.subversion.subclipse.core.resources.LocalResourceStatus 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 10 with LocalResourceStatus

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

Aggregations

LocalResourceStatus (org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)26 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)17 IResource (org.eclipse.core.resources.IResource)12 SVNException (org.tigris.subversion.subclipse.core.SVNException)12 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)7 CoreException (org.eclipse.core.runtime.CoreException)6 TeamException (org.eclipse.team.core.TeamException)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 ArrayList (java.util.ArrayList)4 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)4 File (java.io.File)3 List (java.util.List)2 IContainer (org.eclipse.core.resources.IContainer)2 IFile (org.eclipse.core.resources.IFile)2 IProject (org.eclipse.core.resources.IProject)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 Path (org.eclipse.core.runtime.Path)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 OperationManager (org.tigris.subversion.subclipse.core.client.OperationManager)2 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)2