Search in sources :

Example 6 with ISVNResource

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

the class AddIgnoredPatternCommand method run.

/* (non-Javadoc)
   * @see org.tigris.subversion.subclipse.core.commands.ISVNCommand#run(org.eclipse.core.runtime.IProgressMonitor)
   */
public void run(IProgressMonitor monitor) throws SVNException {
    monitor = Policy.monitorFor(monitor);
    // $NON-NLS-1$
    monitor.beginTask(null, 100);
    if (!folder.getStatus().isManaged())
        throw new SVNException(IStatus.ERROR, TeamException.UNABLE, Policy.bind("SVNTeamProvider.ErrorSettingIgnorePattern", // $NON-NLS-1$
        folder.getIResource().getFullPath().toString()));
    ISVNClientAdapter svnClient = folder.getRepository().getSVNClient();
    try {
        OperationManager.getInstance().beginOperation(svnClient);
        try {
            svnClient.addToIgnoredPatterns(folder.getFile(), pattern);
            // broadcast changes to unmanaged children - they are the only candidates for being ignored
            ISVNResource[] members = folder.members(null, ISVNFolder.UNMANAGED_MEMBERS);
            IResource[] possiblesIgnores = new IResource[members.length];
            for (int i = 0; i < members.length; i++) {
                possiblesIgnores[i] = ((ISVNLocalResource) members[i]).getIResource();
            }
            folder.refreshStatus(false);
            SVNProviderPlugin.broadcastSyncInfoChanges(possiblesIgnores, false);
            broadcastNestedFolders(possiblesIgnores);
        } catch (SVNClientException e) {
            throw SVNException.wrapException(e);
        }
    } finally {
        OperationManager.getInstance().endOperation();
        monitor.done();
        folder.getRepository().returnSVNClient(svnClient);
    }
}
Also used : SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) ISVNResource(org.tigris.subversion.subclipse.core.ISVNResource) SVNException(org.tigris.subversion.subclipse.core.SVNException) IResource(org.eclipse.core.resources.IResource) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 7 with ISVNResource

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

the class SubclipseLinkedTaskInfo method init.

private void init() {
    TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager();
    String[] urls = null;
    ProjectProperties props = null;
    try {
        if (resource != null) {
            props = ProjectProperties.getProjectProperties(resource);
        } else if (logEntry != null) {
            ISVNResource svnres = logEntry.getResource();
            if (svnres != null) {
                if (svnres.getResource() != null) {
                    props = ProjectProperties.getProjectProperties(svnres.getResource());
                } else {
                    ISVNClientAdapter client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
                    SVNProviderPlugin.disableConsoleLogging();
                    ISVNProperty[] properties = client.getProperties(svnres.getUrl());
                    SVNProviderPlugin.enableConsoleLogging();
                    for (int i = 0; i < properties.length; i++) {
                        ISVNProperty property = properties[i];
                        if ("bugtraq:url".equals(property.getName())) {
                            repositoryUrl = SubclipseTeamPlugin.getRepository(property.getValue(), repositoryManager).getRepositoryUrl();
                        // comments?
                        }
                    }
                }
            }
        }
    } catch (Exception ex) {
        // ignore?
        SVNProviderPlugin.enableConsoleLogging();
    }
    if (props != null) {
        if (repositoryUrl == null) {
            repositoryUrl = SubclipseTeamPlugin.getRepository(props.getUrl(), repositoryManager).getRepositoryUrl();
        }
        urls = props.getLinkList(getText()).getUrls();
    }
    if (urls == null || urls.length == 0) {
        urls = ProjectProperties.getUrls(getText()).getUrls();
    }
    if (urls != null && urls.length > 0) {
        taskFullUrl = urls[0];
    }
}
Also used : TaskRepositoryManager(org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager) ISVNResource(org.tigris.subversion.subclipse.core.ISVNResource) ProjectProperties(org.tigris.subversion.subclipse.ui.settings.ProjectProperties) ISVNProperty(org.tigris.subversion.svnclientadapter.ISVNProperty) TeamException(org.eclipse.team.core.TeamException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 8 with ISVNResource

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

the class ShowDifferencesAsUnifiedDiffAction method execute.

// 
// private IResource localResource;
// 
// public void setLocalResource(IResource localResource) {
// this.localResource = localResource;
// }
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    pegRevision1 = null;
    pegRevision2 = null;
    String fromRevision = null;
    String toRevision = null;
    ISVNResource[] selectedResources = getSelectedRemoteResources();
    SVNUrl fromUrl = null;
    SVNUrl toUrl = null;
    if (selectedResources == null || (selectedResources.length == 0)) {
        Object[] selectedObjects = selection.toArray();
        if (selectedObjects[0] instanceof ILogEntry) {
            selectedResources = new ISVNResource[2];
            selectedResources[0] = ((ILogEntry) selectedObjects[0]).getResource();
            fromRevision = ((ILogEntry) selectedObjects[0]).getRevision().toString();
            ILogEntry logEntry1 = (ILogEntry) selectedObjects[0];
            RemoteResource remoteResource;
            IResource resource1 = logEntry1.getResource().getResource();
            if (resource1 != null) {
                try {
                    ISVNRemoteResource baseResource = SVNWorkspaceRoot.getBaseResourceFor(resource1);
                    if (baseResource != null) {
                        pegRevision1 = baseResource.getLastChangedRevision();
                    }
                } catch (Exception e) {
                }
            }
            if (logEntry1.getResource().getResource() instanceof IContainer) {
                remoteResource = new RemoteFolder(logEntry1.getResource().getRepository(), logEntry1.getResource().getUrl(), logEntry1.getRevision());
            } else {
                remoteResource = new RemoteFile(logEntry1.getResource().getRepository(), logEntry1.getResource().getUrl(), logEntry1.getRevision());
            }
            fromUrl = remoteResource.getUrl();
            if (selectedObjects.length > 1) {
                selectedResources[1] = ((ILogEntry) selectedObjects[1]).getResource();
                toRevision = ((ILogEntry) selectedObjects[1]).getRevision().toString();
                ILogEntry logEntry2 = (ILogEntry) selectedObjects[1];
                IResource resource2 = logEntry2.getResource().getResource();
                if (resource2 != null) {
                    try {
                        ISVNRemoteResource baseResource = SVNWorkspaceRoot.getBaseResourceFor(resource2);
                        if (baseResource != null) {
                            pegRevision2 = baseResource.getLastChangedRevision();
                        }
                    } catch (Exception e) {
                    }
                }
                if (logEntry2.getResource().getResource() instanceof IContainer) {
                    remoteResource = new RemoteFolder(logEntry2.getResource().getRepository(), logEntry2.getResource().getUrl(), logEntry2.getRevision());
                } else {
                    remoteResource = new RemoteFile(logEntry2.getResource().getRepository(), logEntry2.getResource().getUrl(), logEntry2.getRevision());
                }
                toUrl = remoteResource.getUrl();
            } else {
                int from = Integer.parseInt(fromRevision);
                from--;
                toRevision = Integer.toString(from);
                toUrl = remoteResource.getUrl();
            }
        }
    } else {
        if (selectedResources[0] instanceof ISVNRemoteResource)
            fromRevision = ((ISVNRemoteResource) selectedResources[0]).getRevision().toString();
        if (selectedResources.length > 1 && selectedResources[1] instanceof ISVNRemoteResource)
            toRevision = ((ISVNRemoteResource) selectedResources[1]).getRevision().toString();
    }
    if (pegRevision1 == null) {
        pegRevision1 = SVNRevision.HEAD;
    }
    if (pegRevision2 == null) {
        pegRevision2 = pegRevision1;
    }
    DifferencesDialog dialog = new DifferencesDialog(getShell(), null, selectedResources, new SVNRevision[] { pegRevision1, pegRevision2 }, getTargetPart());
    dialog.setUsePegRevision(usePegRevision);
    dialog.setFromUrl(fromUrl);
    dialog.setToUrl(toUrl);
    IResource localResource = null;
    IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
    if (part instanceof GenericHistoryView) {
        IHistoryPage historyPage = ((GenericHistoryView) part).getHistoryPage();
        if (historyPage instanceof SVNHistoryPage) {
            localResource = ((SVNHistoryPage) historyPage).getResource();
        }
    }
    dialog.setLocalResource(localResource);
    // $NON-NLS-1$
    if (!fromRevision.equals("HEAD"))
        dialog.setFromRevision(fromRevision);
    if (toRevision != null && !toRevision.equals("HEAD"))
        // $NON-NLS-1$
        dialog.setToRevision(toRevision);
    dialog.open();
}
Also used : ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) RemoteResource(org.tigris.subversion.subclipse.core.resources.RemoteResource) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) RemoteFolder(org.tigris.subversion.subclipse.core.resources.RemoteFolder) ISVNResource(org.tigris.subversion.subclipse.core.ISVNResource) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) GenericHistoryView(org.eclipse.team.internal.ui.history.GenericHistoryView) IHistoryPage(org.eclipse.team.ui.history.IHistoryPage) DifferencesDialog(org.tigris.subversion.subclipse.ui.dialogs.DifferencesDialog) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) SVNHistoryPage(org.tigris.subversion.subclipse.ui.history.SVNHistoryPage) IContainer(org.eclipse.core.resources.IContainer) IResource(org.eclipse.core.resources.IResource) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Aggregations

ISVNResource (org.tigris.subversion.subclipse.core.ISVNResource)8 ArrayList (java.util.ArrayList)3 IResource (org.eclipse.core.resources.IResource)3 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)3 SVNException (org.tigris.subversion.subclipse.core.SVNException)3 ILogEntry (org.tigris.subversion.subclipse.core.history.ILogEntry)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 IContainer (org.eclipse.core.resources.IContainer)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 TeamException (org.eclipse.team.core.TeamException)2 ProjectProperties (org.tigris.subversion.subclipse.ui.settings.ProjectProperties)2 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)2 IFolder (org.eclipse.core.resources.IFolder)1 IWorkspaceRunnable (org.eclipse.core.resources.IWorkspaceRunnable)1 CoreException (org.eclipse.core.runtime.CoreException)1 Path (org.eclipse.core.runtime.Path)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 TaskRepositoryManager (org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager)1