Search in sources :

Example 6 with ISVNProperty

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

the class SVNHistoryPage method tagsPropertySet.

private boolean tagsPropertySet(ISVNRemoteResource resource) {
    ISVNClientAdapter client = null;
    try {
        client = SVNProviderPlugin.getPlugin().getSVNClient();
        ISVNProperty property = null;
        SVNProviderPlugin.disableConsoleLogging();
        // $NON-NLS-1$
        property = client.propertyGet(resource.getUrl(), "subclipse:tags");
        if (property != null && property.getValue() != null) {
            SVNProviderPlugin.enableConsoleLogging();
            return true;
        }
        ISVNRemoteResource checkResource = resource;
        while (checkResource.getParent() != null) {
            checkResource = checkResource.getParent();
            // $NON-NLS-1$
            property = client.propertyGet(checkResource.getUrl(), "subclipse:tags");
            if (property != null && property.getValue() != null) {
                SVNProviderPlugin.enableConsoleLogging();
                return true;
            }
        }
    } catch (Exception e) {
        SVNProviderPlugin.enableConsoleLogging();
    } finally {
        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
    }
    return false;
}
Also used : ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) CoreException(org.eclipse.core.runtime.CoreException) SVNException(org.tigris.subversion.subclipse.core.SVNException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) ParseException(java.text.ParseException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 7 with ISVNProperty

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

the class SVNPropertyPage method getStatus.

private void getStatus() {
    ISVNRepositoryLocation repository = null;
    ISVNClientAdapter svnClient = null;
    try {
        IResource resource = (IResource) getElement();
        SVNTeamProvider svnProvider = (SVNTeamProvider) RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId());
        if (svnProvider == null)
            return;
        svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
        if (svnResource == null)
            return;
        status = svnResource.getStatus();
        if (status != null && !status.isIgnored()) {
            repository = svnResource.getRepository();
            svnClient = repository.getSVNClient();
            ISVNInfo info = svnClient.getInfoFromWorkingCopy(svnResource.getFile());
            urlCopiedFrom = info.getCopyUrl();
            revision = svnResource.getRevision();
            lockOwnerText = status.getLockOwner();
            lockCommentText = status.getLockComment();
            if (status.getLockCreationDate() != null)
                lockDateText = status.getLockCreationDate().toString();
            if (!status.isAdded()) {
                try {
                    info = svnClient.getInfo(status.getUrl());
                } catch (Exception e) {
                }
            }
            // Get lock information from server if svn:needs-lock property is set
            if (info != null && status.getLockOwner() == null && status.getUrlString() != null) {
                ISVNProperty prop = svnResource.getSvnProperty("svn:needs-lock");
                if (prop != null) {
                    lockOwnerText = info.getLockOwner();
                    if (info.getLockCreationDate() != null)
                        lockDateText = info.getLockCreationDate().toString();
                    lockCommentText = info.getLockComment();
                }
            }
        }
    } catch (Exception e) {
        SVNUIPlugin.log(new Status(IStatus.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, "Property Exception", // $NON-NLS-1$
        e));
    } finally {
        if (repository != null) {
            repository.returnSVNClient(svnClient);
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) Status(org.eclipse.core.runtime.Status) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) SVNTeamProvider(org.tigris.subversion.subclipse.core.SVNTeamProvider) ISVNInfo(org.tigris.subversion.svnclientadapter.ISVNInfo) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) IResource(org.eclipse.core.resources.IResource) TeamException(org.eclipse.team.core.TeamException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 8 with ISVNProperty

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

the class ProjectProperties method getProjectProperties.

private static ProjectProperties getProjectProperties(File file, ISVNLocalResource svnResource) throws SVNException {
    if (file == null)
        return null;
    ISVNLocalResource parent = svnResource;
    while (parent != null) {
        if (parent.exists() && parent.isManaged() && !parent.getStatusFromCache().isDeleted()) {
            break;
        }
        parent = parent.getParent();
    }
    if (parent == null || !parent.exists() || !parent.isManaged() || parent.getStatusFromCache().isDeleted()) {
        return null;
    }
    String message = null;
    String logregex = null;
    String label = null;
    String url = null;
    boolean number = false;
    boolean warnifnoissue = false;
    boolean append = true;
    ISVNProperty[] bugtraqProperties = parent.getPropertiesIncludingInherited(false, true, propertyFilterList);
    for (ISVNProperty prop : bugtraqProperties) {
        if (prop.getName().equals("bugtraq:message")) {
            message = prop.getValue();
        } else if (prop.getName().equals("bugtraq:logregex")) {
            logregex = prop.getValue();
        } else if (prop.getName().equals("bugtraq:label")) {
            label = prop.getValue();
        } else if (prop.getName().equals("bugtraq:url")) {
            url = resolveUrl(prop.getValue(), svnResource);
        } else if (prop.getName().equals("bugtraq:number")) {
            number = prop.getValue().equalsIgnoreCase("true");
        } else if (prop.getName().equals("bugtraq:warnifnoissue")) {
            warnifnoissue = prop.getValue().equalsIgnoreCase("true");
        } else if (prop.getName().equals("bugtraq:append")) {
            append = prop.getValue().equalsIgnoreCase("true");
        }
    }
    ProjectProperties projectProperties = null;
    if (message != null || logregex != null) {
        projectProperties = new ProjectProperties();
        projectProperties.setMessage(message);
        projectProperties.setLogregex(logregex);
        if (label != null) {
            projectProperties.setLabel(label);
        }
        projectProperties.setUrl(url);
        projectProperties.setNumber(number);
        projectProperties.setWarnIfNoIssue(warnifnoissue);
        projectProperties.setAppend(append);
    }
    return projectProperties;
}
Also used : ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource)

Example 9 with ISVNProperty

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

the class UnversionedCustomProperty method getSvnRevisionProperties.

public static UnversionedCustomProperty[] getSvnRevisionProperties(final ISVNRemoteResource remoteResource, final SVNRevision revision, final SVNRevision peg, final boolean customOnly) throws SVNException {
    SVNUrl url = remoteResource.getUrl();
    ISVNProperty[] props = getSvnRevisionProperties(url, revision, peg);
    List temp = new ArrayList();
    for (int i = 0; i < props.length; i++) {
        final String name = props[i].getName();
        final String value = props[i].getValue();
        // TODO: pull these from svnPropertyTypes prefixes rather than hardcoding
        if (customOnly && (name.startsWith("svn:") || name.startsWith("bugtraq:") || name.startsWith("tsvn:")))
            continue;
        UnversionedCustomProperty ucp = new UnversionedCustomProperty(name, value);
        temp.add(ucp);
    }
    UnversionedCustomProperty[] ret = new UnversionedCustomProperty[temp.size()];
    int i = 0;
    Iterator iter = temp.iterator();
    while (iter.hasNext()) {
        ret[i++] = (UnversionedCustomProperty) iter.next();
    }
    return ret;
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty)

Example 10 with ISVNProperty

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

the class SvnPropertiesView method contributeActions.

/**
 * Adds the action contributions for this view.
 */
public void contributeActions() {
    // Contribute actions to popup menu for the table
    MenuManager menuMgr = new MenuManager();
    Menu menu = menuMgr.createContextMenu(tableViewer.getTable());
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager menuMgr) {
            fillTableMenu(menuMgr);
        }
    });
    menuMgr.setRemoveAllWhenShown(true);
    tableViewer.getTable().setMenu(menu);
    getSite().registerContextMenu(menuMgr, tableViewer);
    // Create the local tool bar
    IActionBars actionBars = getViewSite().getActionBars();
    actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getDeletePropertyAction());
    IToolBarManager tbm = actionBars.getToolBarManager();
    tbm.add(getRefreshAction());
    tbm.update(false);
    // set F1 help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(tableViewer.getControl(), IHelpContextIds.PROPERTIES_VIEW);
    tableViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent e) {
            getModifyPropertyAction().run();
        }
    });
    // set the selectionchanged listener for the table
    // updates property value when selection changes
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            if (selection == null || !(selection instanceof IStructuredSelection)) {
                // $NON-NLS-1$
                textViewer.setDocument(new Document(""));
                return;
            }
            IStructuredSelection ss = (IStructuredSelection) selection;
            if (ss.size() != 1) {
                // $NON-NLS-1$
                textViewer.setDocument(new Document(""));
                return;
            }
            ISVNProperty property = (ISVNProperty) ss.getFirstElement();
            textViewer.setDocument(new Document(property.getValue()));
        }
    });
    tableViewer.getControl().addKeyListener(new KeyAdapter() {

        public void keyReleased(KeyEvent event) {
            if (event.character == SWT.DEL && event.stateMask == 0) {
                getDeletePropertyAction().run();
            }
        }
    });
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) KeyAdapter(org.eclipse.swt.events.KeyAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) Document(org.eclipse.jface.text.Document) IMenuListener(org.eclipse.jface.action.IMenuListener) KeyEvent(org.eclipse.swt.events.KeyEvent) IToolBarManager(org.eclipse.jface.action.IToolBarManager) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) ISelection(org.eclipse.jface.viewers.ISelection) Menu(org.eclipse.swt.widgets.Menu) IMenuManager(org.eclipse.jface.action.IMenuManager) IActionBars(org.eclipse.ui.IActionBars)

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