diff options
author | Michael Valenta | 2006-01-08 04:00:24 +0000 |
---|---|---|
committer | Michael Valenta | 2006-01-08 04:00:24 +0000 |
commit | eae76b9ed9e0b5919bf22d6f51695575d2ddac8a (patch) | |
tree | 1418217e764bb1cbac214eb9e153ee4b267c7de3 | |
parent | a3e49cc3e451aa88091d4fb8d9b8d18540f9416c (diff) | |
download | eclipse.platform.team-eae76b9ed9e0b5919bf22d6f51695575d2ddac8a.tar.gz eclipse.platform.team-eae76b9ed9e0b5919bf22d6f51695575d2ddac8a.tar.xz eclipse.platform.team-eae76b9ed9e0b5919bf22d6f51695575d2ddac8a.zip |
*** empty log message ***
9 files changed, 206 insertions, 124 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java index 4772f063f..820c22106 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java @@ -78,6 +78,13 @@ public class IgnoreAction extends WorkspaceTraversalAction { return CVSUIMessages.IgnoreAction_1; } + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings() + */ + public boolean consultModelsForMappings() { + return false; + } + } protected void execute(final IAction action) throws InvocationTargetException, InterruptedException { diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java index 70e988f10..18366be8f 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java @@ -20,7 +20,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.mapping.IResourceMappingScope; import org.eclipse.team.core.subscribers.Subscriber; import org.eclipse.team.core.subscribers.SubscriberResourceMappingContext; import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; @@ -37,37 +36,9 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction { * within a CVS managed project. * @return the selected mappings that contain resources * within a CVS managed project - * - * @deprecated should use getOperationInput() instead */ protected ResourceMapping[] getCVSResourceMappings() { - ResourceMapping[] selectedMappings = getSelectedResourceMappings(CVSProviderPlugin.getTypeId()); -// try { -// IResourceMappingScope scope = new ScopeGenerator().prepareScope("CVS Operation", selectedMappings, getResourceMappingContext(), new NullProgressMonitor()); -// if (scope.hasAdditionalMappings()) { -// return showAllMappings(scope); -// } -// } catch (CoreException e) { -// CVSUIPlugin.log(e); -// } - return selectedMappings; - } - - private ResourceMapping[] showAllMappings(final IResourceMappingScope scope) { -// final boolean[] canceled = new boolean[] { false }; -// getShell().getDisplay().syncExec(new Runnable() { -// public void run() { -// AdditionalMappingsDialog dialog = new AdditionalMappingsDialog(getShell(), "Participating Elements", scope); -// int result = dialog.open(); -// canceled[0] = result != Window.OK; -// } -// -// }); -// -// if (canceled[0]) { -// return new ResourceMapping[0]; -// } - return scope.getMappings(); + return getSelectedResourceMappings(CVSProviderPlugin.getTypeId()); } protected static IResource[] getRootTraversalResources(ResourceMapping[] mappings, ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { @@ -135,6 +106,13 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction { return (IResource[]) projects.toArray(new IResource[projects.size()]); } + /** + * + * @param mappings + * @return + * + * @deprecated need to find a better way to do this + */ public static boolean isLogicalModel(ResourceMapping[] mappings) { for (int i = 0; i < mappings.length; i++) { ResourceMapping mapping = mappings[i]; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java index 6638faa70..f0551ce11 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java @@ -10,9 +10,12 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui.operations; +import java.lang.reflect.InvocationTargetException; + import org.eclipse.core.resources.*; import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.core.runtime.*; +import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.window.Window; import org.eclipse.osgi.util.NLS; import org.eclipse.team.core.TeamException; @@ -29,6 +32,7 @@ import org.eclipse.team.internal.ccvs.ui.actions.CVSAction; import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager; import org.eclipse.team.internal.ccvs.ui.tags.BranchPromptDialog; import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; /** * Perform a CVS branch operaiton @@ -53,45 +57,57 @@ public class BranchOperation extends RepositoryProviderOperation { * @see org.eclipse.team.ui.TeamOperation#shouldRun() */ protected boolean shouldRun() { - try { - IResource[] resources = getTraversalRoots(); - boolean allSticky = areAllResourcesSticky(resources); - String initialVersionName = calculateInitialVersionName(resources,allSticky); - final BranchPromptDialog dialog = new BranchPromptDialog(getShell(), - CVSUIMessages.BranchWizard_title, - resources, - allSticky, - initialVersionName); - if (dialog.open() != Window.OK) return false; - - // Capture the dialog info in local variables - final String tagString = dialog.getBranchTagName(); - update = dialog.getUpdate(); - branchTag = new CVSTag(tagString, CVSTag.BRANCH); - - // Only set the root version tag if the name from the dialog differs from the initial name - String versionString = dialog.getVersionTagName(); - if (versionString != null - && (initialVersionName == null || !versionString.equals(initialVersionName))) { - rootVersionTag = new CVSTag(versionString, CVSTag.VERSION); - } - - // For non-projects determine if the tag being loaded is the same as the resource's parent - // If it's not, warn the user that they will be mixing tags - if (update) { - try { - if(!CVSAction.checkForMixingTags(getShell(), resources, branchTag)) { - return false; - } - } catch (CVSException e) { - CVSUIPlugin.log(e); - } - } - return super.shouldRun(); - } catch (CoreException e) { - CVSUIPlugin.openError(getShell(), null, null, e, CVSUIPlugin.PERFORM_SYNC_EXEC); - return false; - } + try { + PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + try { + buildScope(monitor); + } catch (CVSException e) { + throw new InvocationTargetException(e); + } + } + }); + } catch (InvocationTargetException e1) { + CVSUIPlugin.openError(getShell(), null, null, e1); + } catch (InterruptedException e1) { + throw new OperationCanceledException(); + } + + IResource[] resources = getTraversalRoots(); + boolean allSticky = areAllResourcesSticky(resources); + String initialVersionName = calculateInitialVersionName(resources,allSticky); + final BranchPromptDialog dialog = new BranchPromptDialog(getShell(), + CVSUIMessages.BranchWizard_title, + resources, + allSticky, + initialVersionName); + if (dialog.open() != Window.OK) return false; + + // Capture the dialog info in local variables + final String tagString = dialog.getBranchTagName(); + update = dialog.getUpdate(); + branchTag = new CVSTag(tagString, CVSTag.BRANCH); + + // Only set the root version tag if the name from the dialog differs from the initial name + String versionString = dialog.getVersionTagName(); + if (versionString != null + && (initialVersionName == null || !versionString.equals(initialVersionName))) { + rootVersionTag = new CVSTag(versionString, CVSTag.VERSION); + } + + // For non-projects determine if the tag being loaded is the same as the resource's parent + // If it's not, warn the user that they will be mixing tags + if (update) { + try { + if(!CVSAction.checkForMixingTags(getShell(), resources, branchTag)) { + return false; + } + } catch (CVSException e) { + CVSUIPlugin.log(e); + } + } + return super.shouldRun(); } /* (non-Javadoc) diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java index 34b83fb31..41de654e1 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheTreeContentsOperation.java @@ -46,6 +46,9 @@ public abstract class CacheTreeContentsOperation extends SingleCommandOperation this.tree = tree; } + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], boolean, org.eclipse.core.runtime.IProgressMonitor) + */ protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException { IResource[] files = getFilesWithUncachedContents(resources, recurse); if (files.length > 0) @@ -139,6 +142,9 @@ public abstract class CacheTreeContentsOperation extends SingleCommandOperation return (ICVSResource[]) result.toArray(new ICVSResource[result.size()]); } + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.team.internal.ccvs.core.ICVSResource[], boolean, org.eclipse.core.runtime.IProgressMonitor) + */ protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException { return Command.UPDATE.execute( session, @@ -149,14 +155,23 @@ public abstract class CacheTreeContentsOperation extends SingleCommandOperation monitor); } + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#getLocalOptions(boolean) + */ protected LocalOption[] getLocalOptions(boolean recurse) { return Update.IGNORE_LOCAL_CHANGES.addTo(super.getLocalOptions(recurse)); } + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider) + */ protected String getTaskName(CVSTeamProvider provider) { return NLS.bind(CVSUIMessages.CacheTreeContentsOperation_0, new String[] {provider.getProject().getName()}); } + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName() + */ protected String getTaskName() { return CVSUIMessages.CacheTreeContentsOperation_1; } @@ -164,5 +179,12 @@ public abstract class CacheTreeContentsOperation extends SingleCommandOperation protected IResourceDiffTree getTree() { return tree; } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings() + */ + public boolean consultModelsForMappings() { + return false; + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java index 9ba6334a5..af780427f 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java @@ -318,5 +318,12 @@ public abstract class DiffOperation extends SingleCommandOperation { return super.getLocalRoot(provider); } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings() + */ + public boolean consultModelsForMappings() { + return false; + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java index e5efa96bc..2704ba7d2 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DisconnectOperation.java @@ -80,5 +80,12 @@ public class DisconnectOperation extends RepositoryProviderOperation { // Do not run in the background return false; } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings() + */ + public boolean consultModelsForMappings() { + return false; + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java index 87c0aba66..338e1326b 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RepositoryProviderOperation.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui.operations; +import java.lang.reflect.InvocationTargetException; import java.util.*; import org.eclipse.core.resources.IProject; @@ -20,6 +21,7 @@ import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.jface.action.IAction; import org.eclipse.team.core.RepositoryProvider; import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.mapping.IResourceMappingScope; import org.eclipse.team.internal.ccvs.core.*; import org.eclipse.team.internal.ccvs.core.client.Command; import org.eclipse.team.internal.ccvs.core.client.Session; @@ -27,6 +29,7 @@ import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; import org.eclipse.team.internal.ccvs.ui.Policy; +import org.eclipse.team.ui.operations.ResourceMappingOperation; import org.eclipse.ui.IWorkbenchPart; /** @@ -34,7 +37,8 @@ import org.eclipse.ui.IWorkbenchPart; */ public abstract class RepositoryProviderOperation extends CVSOperation { - private ResourceMapping[] mappers; + private IResourceMappingScope scope; + private final ResourceMapping[] selectedMappings; /** * Interface that is available to sublcasses which identifies @@ -175,9 +179,9 @@ public abstract class RepositoryProviderOperation extends CVSOperation { this(part, asResourceMappers(resources)); } - public RepositoryProviderOperation(IWorkbenchPart part, ResourceMapping[] mappers) { + public RepositoryProviderOperation(IWorkbenchPart part, ResourceMapping[] selectedMappings) { super(part); - this.mappers = mappers; + this.selectedMappings = selectedMappings; } /* (non-Javadoc) @@ -186,6 +190,7 @@ public abstract class RepositoryProviderOperation extends CVSOperation { public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException { try { monitor.beginTask(null, 100); + buildScope(monitor); Map table = getProviderTraversalMapping(Policy.subMonitorFor(monitor, 30)); execute(table, Policy.subMonitorFor(monitor, 30)); } catch (CoreException e) { @@ -195,7 +200,34 @@ public abstract class RepositoryProviderOperation extends CVSOperation { } } - private void execute(Map providerTraversal, IProgressMonitor monitor) throws CVSException, InterruptedException { + public IResourceMappingScope buildScope(IProgressMonitor monitor) throws InterruptedException, CVSException { + if (scope == null) { + ResourceMappingOperation op = new ResourceMappingOperation(getPart(), selectedMappings, getResourceMappingContext()) { + /* (non-Javadoc) + * @see org.eclipse.team.ui.operations.ResourceMappingOperation#execute(org.eclipse.core.runtime.IProgressMonitor) + */ + protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + // No need to do anything. We just wanted to build the scope + } + /* (non-Javadoc) + * @see org.eclipse.team.ui.operations.ResourceMappingOperation#consultModelsWhenGeneratingScope() + */ + protected boolean consultModelsWhenGeneratingScope() { + return RepositoryProviderOperation.this.consultModelsForMappings(); + } + }; + // Run the operation to build the scope + try { + op.run(monitor); + } catch (InvocationTargetException e) { + throw CVSException.wrapException(e); + } + scope = op.getScope(); + } + return scope; + } + + private void execute(Map providerTraversal, IProgressMonitor monitor) throws CVSException, InterruptedException { Set keySet = providerTraversal.keySet(); monitor.beginTask(null, keySet.size() * 1000); Iterator iterator = keySet.iterator(); @@ -272,10 +304,11 @@ public abstract class RepositoryProviderOperation extends CVSOperation { */ private Map getProviderTraversalMapping(IProgressMonitor monitor) throws CoreException { Map result = new HashMap(); - for (int j = 0; j < mappers.length; j++) { - ResourceMapping mapper = mappers[j]; - IProject[] projects = mapper.getProjects(); - ResourceTraversal[] traversals = mapper.getTraversals(getResourceMappingContext(), monitor); + ResourceMapping[] mappings = scope.getMappings(); + for (int j = 0; j < mappings.length; j++) { + ResourceMapping mapping = mappings[j]; + IProject[] projects = mapping.getProjects(); + ResourceTraversal[] traversals = scope.getTraversals(mapping); for (int k = 0; k < projects.length; k++) { IProject project = projects[k]; RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()); @@ -406,10 +439,11 @@ public abstract class RepositoryProviderOperation extends CVSOperation { /** * Return the root resources for all the traversals of this operation. + * Tis method may only be invoked after {@link #buildScope(IProgressMonitor) }. * @return the root resources for all the traversals of this operation * @throws CoreException */ - protected IResource[] getTraversalRoots() throws CoreException { + protected IResource[] getTraversalRoots() { List result = new ArrayList(); ResourceTraversal[] traversals = getTraversals(); for (int i = 0; i < traversals.length; i++) { @@ -419,12 +453,21 @@ public abstract class RepositoryProviderOperation extends CVSOperation { return (IResource[]) result.toArray(new IResource[result.size()]); } - public ResourceTraversal[] getTraversals() throws CoreException { - List traversals = new ArrayList(); - for (int i = 0; i < mappers.length; i++) { - ResourceMapping mapper = mappers[i]; - traversals.addAll(Arrays.asList(mapper.getTraversals(ResourceMappingContext.LOCAL_CONTEXT, null))); - } - return (ResourceTraversal[]) traversals.toArray(new ResourceTraversal[traversals.size()]); + /** + * Return the traversals that will be used by this operation. + * This method can only be called after {@link #buildScope(IProgressMonitor) }. + * @return the traversals that will be used by this operation + * @throws CoreException + */ + public ResourceTraversal[] getTraversals() { + return scope.getTraversals(); + } + + public boolean consultModelsForMappings() { + return true; } + + public ResourceMapping[] getSelectedMappings() { + return selectedMappings; + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java index f2e063225..75e594afc 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/TagOperation.java @@ -11,9 +11,9 @@ package org.eclipse.team.internal.ccvs.ui.operations; import java.lang.reflect.InvocationTargetException; -import java.util.HashSet; -import java.util.Set; +import java.util.*; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.core.runtime.*; @@ -153,32 +153,32 @@ public class TagOperation extends RepositoryProviderOperation implements ITagOpe } private ICVSResource[] getCVSResources() { - try { - IResource[] resources = getTraversalRoots(); - ICVSResource[] cvsResources = new ICVSResource[resources.length]; - for (int i = 0; i < resources.length; i++) { - cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]); - } - return cvsResources; - } catch (CoreException e) { - CVSUIPlugin.log(e); - return new ICVSResource[0]; + IResource[] resources = getTraversalRoots(); + ICVSResource[] cvsResources = new ICVSResource[resources.length]; + for (int i = 0; i < resources.length; i++) { + cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]); } + return cvsResources; } /* (non-Javadoc) * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTagSource() */ public TagSource getTagSource() { - try { - return TagSource.create(getTraversalRoots()); - } catch (CoreException e) { - CVSUIPlugin.log(e); - return null; - } + return TagSource.create(getProjects()); } - protected boolean isReportableError(IStatus status) { + private IProject[] getProjects() { + ResourceMapping[] mappings = getSelectedMappings(); + Set projects = new HashSet(); + for (int i = 0; i < mappings.length; i++) { + ResourceMapping mapping = mappings[i]; + projects.addAll(Arrays.asList(mapping.getProjects())); + } + return (IProject[]) projects.toArray(new IProject[projects.size()]); + } + + protected boolean isReportableError(IStatus status) { return super.isReportableError(status) || status.getCode() == CVSStatus.TAG_ALREADY_EXISTS; } @@ -187,11 +187,6 @@ public class TagOperation extends RepositoryProviderOperation implements ITagOpe * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#isEmpty() */ public boolean isEmpty() { - try { - return getTraversals().length == 0; - } catch (CoreException e) { - CVSUIPlugin.log(e); - return true; - } + return getSelectedMappings().length == 0; } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java index 1d9a0f9d0..b60881f40 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java @@ -15,12 +15,12 @@ import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.core.resources.mapping.ResourceTraversal; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.*; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.swt.widgets.Shell; import org.eclipse.team.core.IFileContentManager; import org.eclipse.team.core.Team; +import org.eclipse.team.internal.ccvs.core.CVSException; import org.eclipse.team.internal.ccvs.core.ICVSFile; import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.ui.*; @@ -33,18 +33,25 @@ public class AddWizard extends ResizableWizard { private final IFile[] unknowns; private CommitWizardFileTypePage fFileTypePage; - public static void run(Shell shell, AddOperation op) throws InvocationTargetException, InterruptedException { - try { - // Prompt if there are files of unknown type being added - IFile[] unknowns = getUnaddedWithUnknownFileType(op.getTraversals()); - if (unknowns.length == 0) { - op.run(); - } else { - AddWizard wizard = new AddWizard(op, unknowns); - ResizableWizard.open(shell, wizard); - } - } catch (CoreException e) { - throw new InvocationTargetException(e); + public static void run(Shell shell, final AddOperation op) throws InvocationTargetException, InterruptedException { + // Prompt if there are files of unknown type being added + PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + try { + op.buildScope(monitor); + } catch (CVSException e) { + throw new InvocationTargetException(e); + } + } + }); + + IFile[] unknowns = getUnaddedWithUnknownFileType(op.getTraversals()); + if (unknowns.length == 0) { + op.run(); + } else { + AddWizard wizard = new AddWizard(op, unknowns); + ResizableWizard.open(shell, wizard); } } |