diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions')
23 files changed, 534 insertions, 534 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java index 9625232ce..994318bf7 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java @@ -30,19 +30,19 @@ import org.eclipse.team.internal.ccvs.ui.wizards.AddWizard; * container is selected, its children are recursively added. */ public class AddAction extends WorkspaceTraversalAction { - + @Override public void execute(IAction action) throws InterruptedException, InvocationTargetException { - if (!promptForAddOfIgnored()) return; - if (!promptForAdd()) return; - AddOperation op = new AddOperation(getTargetPart(), getCVSResourceMappings()); - AddWizard.run(getShell(), op); + if (!promptForAddOfIgnored()) return; + if (!promptForAdd()) return; + AddOperation op = new AddOperation(getTargetPart(), getCVSResourceMappings()); + AddWizard.run(getShell(), op); } /* * Prompt the user to avoid accidental adding a resource to version control */ - private boolean promptForAdd() { + private boolean promptForAdd() { return MessageDialog.openQuestion(getShell(), CVSUIMessages.AddAction_confirmAddingResourcesTitle, CVSUIMessages.AddAction_confirmAddingResourcesMessage); @@ -52,8 +52,8 @@ public class AddAction extends WorkspaceTraversalAction { * Prompt whether explicitly selected ignored resources should be added */ private boolean promptForAddOfIgnored() { - // Prompt if any of the traversal roots are ignored - // TODO: What about non-root resources that are part of the model but would be ignored? + // Prompt if any of the traversal roots are ignored + // TODO: What about non-root resources that are part of the model but would be ignored? IResource[] resources = getSelectedResourcesWithOverlap(); boolean prompt = false; for (int i = 0; i < resources.length; i++) { diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java index 01f7cba49..18d5ae8e3 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java @@ -32,30 +32,30 @@ public class BranchAction extends WorkspaceTraversalAction { @Override public void execute(IAction action) throws InvocationTargetException, InterruptedException { ResourceMapping[] resourceMappings = getCVSResourceMappings(); - if (resourceMappings == null || resourceMappings.length == 0) { - // Could be a sync element tat is selected - IResource[] resources = getSelectedResources(); - resourceMappings = getResourceMappings(resources); - } - if (resourceMappings == null || resourceMappings.length == 0) { - // Nothing is select so just return - return; - } - new BranchOperation(getTargetPart(), resourceMappings).run(); + if (resourceMappings == null || resourceMappings.length == 0) { + // Could be a sync element tat is selected + IResource[] resources = getSelectedResources(); + resourceMappings = getResourceMappings(resources); + } + if (resourceMappings == null || resourceMappings.length == 0) { + // Nothing is select so just return + return; + } + new BranchOperation(getTargetPart(), resourceMappings).run(); } private ResourceMapping[] getResourceMappings(IResource[] resources) { List<ResourceMapping> mappings = new ArrayList<>(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - Object o = getAdapter(resource, ResourceMapping.class); - if (o instanceof ResourceMapping) { - ResourceMapping mapping = (ResourceMapping) o; - mappings.add(mapping); - } - } - return mappings.toArray(new ResourceMapping[mappings.size()]); - } + for (int i = 0; i < resources.length; i++) { + IResource resource = resources[i]; + Object o = getAdapter(resource, ResourceMapping.class); + if (o instanceof ResourceMapping) { + ResourceMapping mapping = (ResourceMapping) o; + mappings.add(mapping); + } + } + return mappings.toArray(new ResourceMapping[mappings.size()]); + } @Override public String getId() { diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java index 525167a46..4b1d51fe8 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java @@ -166,17 +166,17 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg @Override public void dispose() { super.dispose(); - IWorkbenchWindow window = getWindow(); - if (window != null) { - IPartService partService = window.getPartService(); - if (partService != null) - partService.removePartListener(retargetAction); - } - - if(retargetAction != null) { - retargetAction.dispose(); - retargetAction = null; - } + IWorkbenchWindow window = getWindow(); + if (window != null) { + IPartService partService = window.getPartService(); + if (partService != null) + partService.removePartListener(retargetAction); + } + + if(retargetAction != null) { + retargetAction.dispose(); + retargetAction = null; + } } @Override @@ -593,23 +593,23 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg /* * @see org.eclipse.team.internal.ui.actions.TeamAction#getSelectedResources() */ - protected final IResource[] getSelectedResourcesWithOverlap() { - IStructuredSelection selection = getSelection(); - CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection()); - if (props == null) { - return Utils.getContributedResources(selection.toArray()); - } - return props.getAllSelectedResources(); - } - + protected final IResource[] getSelectedResourcesWithOverlap() { + IStructuredSelection selection = getSelection(); + CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection()); + if (props == null) { + return Utils.getContributedResources(selection.toArray()); + } + return props.getAllSelectedResources(); + } + @Override protected final IResource[] getSelectedResources() { IStructuredSelection selection = getSelection(); - CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection()); - if (props == null) { - return CVSActionSelectionProperties.getNonOverlapping(Utils.getContributedResources(selection.toArray())); - } - return props.getNonoverlappingSelectedResources(); + CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection()); + if (props == null) { + return CVSActionSelectionProperties.getNonOverlapping(Utils.getContributedResources(selection.toArray())); + } + return props.getNonoverlappingSelectedResources(); } @Override @@ -633,16 +633,16 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg public boolean isHandled() { return true; } - - protected final ICVSResource getCVSResourceFor(IResource resource) { - CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection()); - if (props == null) { - return CVSWorkspaceRoot.getCVSResourceFor(resource); - } - return props.getCVSResourceFor(resource); - } + + protected final ICVSResource getCVSResourceFor(IResource resource) { + CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection()); + if (props == null) { + return CVSWorkspaceRoot.getCVSResourceFor(resource); + } + return props.getCVSResourceFor(resource); + } - public static CVSTag getAccurateFileTag(ICVSResource cvsResource) throws CVSException { + public static CVSTag getAccurateFileTag(ICVSResource cvsResource) throws CVSException { CVSTag tag = null; if (cvsResource != null) { return Util.getAccurateFileTag(cvsResource, getTags(cvsResource)); diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java index efb33606d..15d44ad51 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSActionSelectionProperties.java @@ -26,127 +26,127 @@ import org.eclipse.team.internal.ui.Utils; * This class represents a selection for a set of CVS actions. */ public class CVSActionSelectionProperties { - - // Use a weak hash map so that the properties ae collected when the selection is no longer referenced + + // Use a weak hash map so that the properties ae collected when the selection is no longer referenced private static Map<IStructuredSelection, CVSActionSelectionProperties> selectionProperties = new WeakHashMap<>(); - - private Object[] selection; + + private Object[] selection; private Map<String, Object> properties = new HashMap<>(); - - private static final String SELECTED_RESOURCES = "selectedResources"; //$NON-NLS-1$ - private static final String NONOVERLAPPING_SELECTED_RESOURCES = "nonoverlappingSelectedResources"; //$NON-NLS-1$ - private static final String CVS_RESOURCE_MAP = "cvsResourceMap"; //$NON-NLS-1$ - - public static CVSActionSelectionProperties getProperties(IStructuredSelection selection) { - if (selection == null) return null; - CVSActionSelectionProperties props = selectionProperties.get(selection); - if (props == null) { - props = new CVSActionSelectionProperties(selection); - selectionProperties.put(selection, props); - } - return props; - } - - public CVSActionSelectionProperties(IStructuredSelection selection) { - // Copy the selection so that the WeakHashMap will not think the seleciton used for the key is still in use - this.selection = selection.toArray(); - } + + private static final String SELECTED_RESOURCES = "selectedResources"; //$NON-NLS-1$ + private static final String NONOVERLAPPING_SELECTED_RESOURCES = "nonoverlappingSelectedResources"; //$NON-NLS-1$ + private static final String CVS_RESOURCE_MAP = "cvsResourceMap"; //$NON-NLS-1$ + + public static CVSActionSelectionProperties getProperties(IStructuredSelection selection) { + if (selection == null) return null; + CVSActionSelectionProperties props = selectionProperties.get(selection); + if (props == null) { + props = new CVSActionSelectionProperties(selection); + selectionProperties.put(selection, props); + } + return props; + } + + public CVSActionSelectionProperties(IStructuredSelection selection) { + // Copy the selection so that the WeakHashMap will not think the seleciton used for the key is still in use + this.selection = selection.toArray(); + } - public void put(String key, Object value) { - properties.put(key, value); - } - - public Object get(String key) { - return properties.get(key); - } - - public IResource[] getAllSelectedResources() { - IResource[] resources = (IResource[])get(SELECTED_RESOURCES); - if (resources == null) { - resources = getResources(selection); - put(SELECTED_RESOURCES, resources); - } - return resources; - } + public void put(String key, Object value) { + properties.put(key, value); + } + + public Object get(String key) { + return properties.get(key); + } + + public IResource[] getAllSelectedResources() { + IResource[] resources = (IResource[])get(SELECTED_RESOURCES); + if (resources == null) { + resources = getResources(selection); + put(SELECTED_RESOURCES, resources); + } + return resources; + } - /* - * This method gets the resources from the given objects. - * It does so in a manner that is consistent with how the workbench does it. - * Tha is, it first uses IContributionResourceAdapter, then IResource, - * then ResourceMapping. - */ - private IResource[] getResources(Object[] objects) { - return Utils.getContributedResources(objects); - } - - public IResource[] getNonoverlappingSelectedResources() { - IResource[] resources = (IResource[])get(NONOVERLAPPING_SELECTED_RESOURCES); - if (resources == null) { - resources = getNonOverlapping(getAllSelectedResources()); - put (NONOVERLAPPING_SELECTED_RESOURCES, resources); - } - return resources; - } - - public ICVSResource getCVSResourceFor(IResource resource) { - Map map = (Map)get(CVS_RESOURCE_MAP); - if (map == null) { - map = new HashMap(); - put(CVS_RESOURCE_MAP, map); - } - ICVSResource cvsResource = (ICVSResource)map.get(resource); - if (cvsResource == null) { - cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource); - map.put(resource, cvsResource); - } - return cvsResource; - } - - /** - * Method getNonOverlapping ensures that a resource is not covered more than once. - * @param resources - * @return IResource[] - */ - public static IResource[] getNonOverlapping(IResource[] resources) { - if (resources == null || resources.length == 0 || resources.length == 1) { - return resources; - } - // Sort the resources so the shortest paths are first + /* + * This method gets the resources from the given objects. + * It does so in a manner that is consistent with how the workbench does it. + * Tha is, it first uses IContributionResourceAdapter, then IResource, + * then ResourceMapping. + */ + private IResource[] getResources(Object[] objects) { + return Utils.getContributedResources(objects); + } + + public IResource[] getNonoverlappingSelectedResources() { + IResource[] resources = (IResource[])get(NONOVERLAPPING_SELECTED_RESOURCES); + if (resources == null) { + resources = getNonOverlapping(getAllSelectedResources()); + put (NONOVERLAPPING_SELECTED_RESOURCES, resources); + } + return resources; + } + + public ICVSResource getCVSResourceFor(IResource resource) { + Map map = (Map)get(CVS_RESOURCE_MAP); + if (map == null) { + map = new HashMap(); + put(CVS_RESOURCE_MAP, map); + } + ICVSResource cvsResource = (ICVSResource)map.get(resource); + if (cvsResource == null) { + cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource); + map.put(resource, cvsResource); + } + return cvsResource; + } + + /** + * Method getNonOverlapping ensures that a resource is not covered more than once. + * @param resources + * @return IResource[] + */ + public static IResource[] getNonOverlapping(IResource[] resources) { + if (resources == null || resources.length == 0 || resources.length == 1) { + return resources; + } + // Sort the resources so the shortest paths are first List<IResource> sorted = new ArrayList<>(); - sorted.addAll(Arrays.asList(resources)); + sorted.addAll(Arrays.asList(resources)); Collections.sort(sorted, new Comparator<IResource>() { - @Override + @Override public int compare(IResource resource0, IResource resource1) { - return resource0.getFullPath().segmentCount() - resource1.getFullPath().segmentCount(); - } - @Override + return resource0.getFullPath().segmentCount() - resource1.getFullPath().segmentCount(); + } + @Override public boolean equals(Object arg0) { - return false; - } - }); - // Collect all non-overlapping resources + return false; + } + }); + // Collect all non-overlapping resources List<IPath> coveredPaths = new ArrayList<>(); - for (Iterator iter = sorted.iterator(); iter.hasNext();) { - IResource resource = (IResource) iter.next(); - IPath resourceFullPath = resource.getFullPath(); - boolean covered = false; - for (Iterator it = coveredPaths.iterator(); it.hasNext();) { - IPath path = (IPath) it.next(); - if(path.isPrefixOf(resourceFullPath)) { - covered = true; - } - } - if (covered) { - // if the resource is covered by a parent, remove it - iter.remove(); - } else { - // if the resource is a non-covered folder, add it to the covered paths - if (resource.getType() == IResource.FOLDER) { - coveredPaths.add(resource.getFullPath()); - } - } - } - return sorted.toArray(new IResource[sorted.size()]); - } - + for (Iterator iter = sorted.iterator(); iter.hasNext();) { + IResource resource = (IResource) iter.next(); + IPath resourceFullPath = resource.getFullPath(); + boolean covered = false; + for (Iterator it = coveredPaths.iterator(); it.hasNext();) { + IPath path = (IPath) it.next(); + if(path.isPrefixOf(resourceFullPath)) { + covered = true; + } + } + if (covered) { + // if the resource is covered by a parent, remove it + iter.remove(); + } else { + // if the resource is a non-covered folder, add it to the covered paths + if (resource.getType() == IResource.FOLDER) { + coveredPaths.add(resource.getFullPath()); + } + } + } + return sorted.toArray(new IResource[sorted.size()]); + } + } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java index c24887c25..747e27a74 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAction.java @@ -36,19 +36,19 @@ public class CheckoutAction extends CVSAction { } @Override - public boolean isEnabled() { - ICVSRemoteFolder[] folders = getSelectedRemoteFolders(); - if (folders.length == 0) return false; - // only enabled when all folders are in the same repository - ICVSRepositoryLocation location = folders[0].getRepository(); - for (int i = 1; i < folders.length; i++) { - ICVSRemoteFolder folder = folders[i]; - if (!folder.getRepository().equals(location)) { - return false; - } - } - return true; - } + public boolean isEnabled() { + ICVSRemoteFolder[] folders = getSelectedRemoteFolders(); + if (folders.length == 0) return false; + // only enabled when all folders are in the same repository + ICVSRepositoryLocation location = folders[0].getRepository(); + for (int i = 1; i < folders.length; i++) { + ICVSRemoteFolder folder = folders[i]; + if (!folder.getRepository().equals(location)) { + return false; + } + } + return true; + } /** * Get selected CVS remote folders, and add Project Description diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java index b1674e1a5..1ac1bf8b2 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java @@ -73,7 +73,7 @@ public class CommitAction extends WorkspaceTraversalAction { } }, false, PROGRESS_BUSYCURSOR); } - + @Override protected String getErrorTitle() { return CVSUIMessages.CommitAction_commitFailed; @@ -110,7 +110,7 @@ public class CommitAction extends WorkspaceTraversalAction { if (option.equals(MessageDialogWithToggle.NEVER)) return false; // no, never switch - // Ask the user whether to switch + // Ask the user whether to switch final int[] result = new int[] { 0 }; Utils.syncExec((Runnable) () -> { final MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(shell, @@ -124,10 +124,10 @@ public class CommitAction extends WorkspaceTraversalAction { // yes case IDialogConstants.YES_ID: case IDialogConstants.OK_ID : - return true; + return true; // no case IDialogConstants.NO_ID : - return false; + return false; } return false; } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java index 2c8736cac..354a0b7c4 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java @@ -40,8 +40,8 @@ public class CompareWithTagAction extends WorkspaceTraversalAction { @Override public void execute(IAction action) throws InvocationTargetException, InterruptedException { - - // First, determine the tag to compare with + + // First, determine the tag to compare with IResource[] resources = getSelectedResources(); CVSTag tag = promptForTag(resources); if (tag == null) @@ -57,7 +57,7 @@ public class CompareWithTagAction extends WorkspaceTraversalAction { } } - // Create a subscriber that can cover all projects involved + // Create a subscriber that can cover all projects involved if (isShowModelSync()) { final CVSCompareSubscriber compareSubscriber = new CVSCompareSubscriber(getProjects(resources), tag); ResourceMapping[] mappings = getCVSResourceMappings(); @@ -80,12 +80,12 @@ public class CompareWithTagAction extends WorkspaceTraversalAction { participant.run(getTargetPart()); } else { CVSCompareSubscriber compareSubscriber = new CVSCompareSubscriber(getProjects(resources), tag); - ResourceMapping[] resourceMappings = getCVSResourceMappings(); + ResourceMapping[] resourceMappings = getCVSResourceMappings(); if (isLogicalModel(resourceMappings)) { - compareSubscriber = new CVSCompareSubscriber(getProjects(resources), tag); - resources = getResourcesToCompare(compareSubscriber); - compareSubscriber.dispose(); - } + compareSubscriber = new CVSCompareSubscriber(getProjects(resources), tag); + resources = getResourcesToCompare(compareSubscriber); + compareSubscriber.dispose(); + } // create a subscriber specifically for the resources for display to the user compareSubscriber = new CVSCompareSubscriber(resources, tag); try { @@ -104,11 +104,11 @@ public class CompareWithTagAction extends WorkspaceTraversalAction { } } - private boolean isShowModelSync() { + private boolean isShowModelSync() { return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_ENABLE_MODEL_SYNC); } - - protected CVSTag promptForTag(IResource[] resources) { + + protected CVSTag promptForTag(IResource[] resources) { CVSTag tag = TagSelectionDialog.getTagToCompareWith(getShell(), TagSource.create(resources), TagSelectionDialog.INCLUDE_ALL_TAGS); return tag; } @@ -116,5 +116,5 @@ public class CompareWithTagAction extends WorkspaceTraversalAction { @Override protected boolean isEnabledForNonExistantResources() { return true; - } + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java index cf28b19f1..839ada0e8 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java @@ -36,7 +36,7 @@ import org.eclipse.ui.PlatformUI; * by a create patch command in the compare viewer. */ public class GenerateDiffFileAction extends WorkspaceTraversalAction{ - + @Override public void execute(IAction action) { @@ -57,46 +57,46 @@ public class GenerateDiffFileAction extends WorkspaceTraversalAction{ } } - private IResource[] getDeepResourcesToPatch(IProgressMonitor monitor) throws CoreException { - ResourceMapping[] mappings = getCVSResourceMappings(); + private IResource[] getDeepResourcesToPatch(IProgressMonitor monitor) throws CoreException { + ResourceMapping[] mappings = getCVSResourceMappings(); List<IResource> roots = new ArrayList<>(); - for (int i = 0; i < mappings.length; i++) { - ResourceMapping mapping = mappings[i]; - ResourceTraversal[] traversals = mapping.getTraversals( - SubscriberResourceMappingContext.createContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber()), - monitor); - for (int j = 0; j < traversals.length; j++) { - ResourceTraversal traversal = traversals[j]; - IResource[] resources = traversal.getResources(); - if (traversal.getDepth() == IResource.DEPTH_INFINITE) { - roots.addAll(Arrays.asList(resources)); - } else if (traversal.getDepth() == IResource.DEPTH_ZERO) { - collectShallowFiles(resources, roots); - } else if (traversal.getDepth() == IResource.DEPTH_ONE) { - collectShallowFiles(resources, roots); - for (int k = 0; k < resources.length; k++) { - IResource resource = resources[k]; - if (resource.getType() != IResource.FILE) { - collectShallowFiles(members(resource), roots); - } - } - } - } - } - return roots.toArray(new IResource[roots.size()]); - } - + for (int i = 0; i < mappings.length; i++) { + ResourceMapping mapping = mappings[i]; + ResourceTraversal[] traversals = mapping.getTraversals( + SubscriberResourceMappingContext.createContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber()), + monitor); + for (int j = 0; j < traversals.length; j++) { + ResourceTraversal traversal = traversals[j]; + IResource[] resources = traversal.getResources(); + if (traversal.getDepth() == IResource.DEPTH_INFINITE) { + roots.addAll(Arrays.asList(resources)); + } else if (traversal.getDepth() == IResource.DEPTH_ZERO) { + collectShallowFiles(resources, roots); + } else if (traversal.getDepth() == IResource.DEPTH_ONE) { + collectShallowFiles(resources, roots); + for (int k = 0; k < resources.length; k++) { + IResource resource = resources[k]; + if (resource.getType() != IResource.FILE) { + collectShallowFiles(members(resource), roots); + } + } + } + } + } + return roots.toArray(new IResource[roots.size()]); + } + private void collectShallowFiles(IResource[] resources, List<IResource> roots) { - for (int k = 0; k < resources.length; k++) { - IResource resource = resources[k]; - if (resource.getType() == IResource.FILE) - roots.add(resource); - } - } - - private IResource[] members(IResource resource) throws CoreException { - return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().members(resource); - } + for (int k = 0; k < resources.length; k++) { + IResource resource = resources[k]; + if (resource.getType() == IResource.FILE) + roots.add(resource); + } + } + + private IResource[] members(IResource resource) throws CoreException { + return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().members(resource); + } @Override protected boolean isEnabledForMultipleResources() { return true; 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 c05eec73e..7d6bf572f 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 @@ -30,30 +30,30 @@ import org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation; import org.eclipse.ui.IWorkbenchPart; public class IgnoreAction extends WorkspaceTraversalAction { - - /** - * Define an operation that can be run in the background. - * We divide the ignores by provider to obtain project - * locks while modifying the .cvsignore files - */ - class IgnoreOperation extends RepositoryProviderOperation { + + /** + * Define an operation that can be run in the background. + * We divide the ignores by provider to obtain project + * locks while modifying the .cvsignore files + */ + class IgnoreOperation extends RepositoryProviderOperation { - private final IgnoreResourcesDialog dialog; + private final IgnoreResourcesDialog dialog; - public IgnoreOperation(IWorkbenchPart part, IResource[] resources, IgnoreResourcesDialog dialog) { - super(part, resources); - this.dialog = dialog; - } + public IgnoreOperation(IWorkbenchPart part, IResource[] resources, IgnoreResourcesDialog dialog) { + super(part, resources); + this.dialog = dialog; + } - @Override + @Override protected String getTaskName(CVSTeamProvider provider) { - return NLS.bind(CVSUIMessages.IgnoreAction_0, new String[] { provider.getProject().getName() }); - } + return NLS.bind(CVSUIMessages.IgnoreAction_0, new String[] { provider.getProject().getName() }); + } - @Override + @Override protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException { try { - monitor.beginTask(null, resources.length); + monitor.beginTask(null, resources.length); for (int i = 0; i < resources.length; i++) { IResource resource = resources[i]; String pattern = dialog.getIgnorePatternFor(resource); @@ -65,22 +65,22 @@ public class IgnoreAction extends WorkspaceTraversalAction { collectStatus(e.getStatus()); return; } finally { - monitor.done(); + monitor.done(); } collectStatus(Status.OK_STATUS); - } + } - @Override + @Override protected String getTaskName() { - return CVSUIMessages.IgnoreAction_1; - } - - @Override + return CVSUIMessages.IgnoreAction_1; + } + + @Override public boolean consultModelsForMappings() { - return false; - } - - } + return false; + } + + } @Override 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/MoveRemoteTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java index 6e598a1ba..69d8672d2 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java @@ -48,13 +48,13 @@ public class MoveRemoteTagAction extends TagInRepositoryAction { return operation; } - private boolean isFolderSelected() { - ICVSResource[] resources = getSelectedCVSResources(); - for (int i = 0; i < resources.length; i++) { - ICVSResource resource = resources[i]; - if (resource.isFolder()) - return true; - } - return false; - } + private boolean isFolderSelected() { + ICVSResource[] resources = getSelectedCVSResources(); + for (int i = 0; i < resources.length; i++) { + ICVSResource resource = resources[i]; + if (resource.isFolder()) + return true; + } + return false; + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java index adc81eeec..b77869aaf 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OutgoingChangesDialog.java @@ -126,16 +126,16 @@ public class OutgoingChangesDialog extends DetailsDialog { return false; } - @Override + @Override protected void updateEnablements() { - // Can always finish - setPageComplete(true); - } - - @Override + // Can always finish + setPageComplete(true); + } + + @Override protected boolean includeErrorMessage() { - return false; - } + return false; + } public void setHelpContextId(String helpContextId) { this.helpContextId = helpContextId; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java index b2f3ceb76..f8e12c4c6 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java @@ -23,7 +23,7 @@ import org.eclipse.team.internal.ccvs.ui.IHelpContextIds; import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation; public class ReplaceWithRemoteAction extends WorkspaceTraversalAction { - + @Override public void execute(IAction action) throws InvocationTargetException, InterruptedException { diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java index ab620823c..4bc233f26 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java @@ -28,7 +28,7 @@ import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation; * Action for replace with tag. */ public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction { - + @Override public void execute(IAction action) throws InterruptedException, InvocationTargetException { final ReplaceOperation replaceOperation= createReplaceOperation(); diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java index 0186e7612..d450e4cd9 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java @@ -70,51 +70,51 @@ public class RestoreFromRepositoryAction extends WorkspaceTraversalAction { // Extract the file name and path from the RCS path // String filePath = line.substring(index); - // Find all RCS file names that contain "Attic" - int start = line.lastIndexOf(Session.SERVER_SEPARATOR); - if (start != -1) { - String fileName = line.substring(start + 1); - if (fileName.endsWith(RCS_FILE_POSTFIX)) { - fileName = fileName.substring(0, fileName.length() - RCS_FILE_POSTFIX.length()); - } - if (currentFolder != null) { - try { - ICVSFile file = currentFolder.getFile(fileName); - if (!file.exists()) - atticFiles.add(file); - } catch (CVSException e) { - return e.getStatus(); - } - } else { - // Executed for every message line when in quiet mode. - // See bug 238334 - CVSRepositoryLocation repo = (CVSRepositoryLocation)location; - // If exists, remove root directory - if (line.startsWith(repo.getRootDirectory())) { - String repoPath = line.substring(repo.getRootDirectory().length()); - try { - String cmdRootRelativePath = commandRoot.getRepositoryRelativePath(); - // Remove command root path - String path = repoPath.substring(repoPath.indexOf(cmdRootRelativePath) + cmdRootRelativePath.length()); - // Remove filename at the end - String folderPath = path.substring(0, path.indexOf(fileName)); - // The "raw" folderPath contains CVS's 'Attic/' segment when a file has been deleted from cvs. - if (folderPath.endsWith(ATTIC)) { - folderPath = folderPath.substring(0, folderPath.length() - ATTIC_LENGTH); - } - // A separator means the same as "current folder" - if (folderPath.equals(Session.SERVER_SEPARATOR)) - folderPath = Session.CURRENT_LOCAL_FOLDER; - ICVSFolder folder = commandRoot.getFolder(folderPath); - ICVSFile file = folder.getFile(fileName); - if (!file.exists()) - atticFiles.add(file); - } catch (CVSException e) { - return e.getStatus(); - } - } - } - } + // Find all RCS file names that contain "Attic" + int start = line.lastIndexOf(Session.SERVER_SEPARATOR); + if (start != -1) { + String fileName = line.substring(start + 1); + if (fileName.endsWith(RCS_FILE_POSTFIX)) { + fileName = fileName.substring(0, fileName.length() - RCS_FILE_POSTFIX.length()); + } + if (currentFolder != null) { + try { + ICVSFile file = currentFolder.getFile(fileName); + if (!file.exists()) + atticFiles.add(file); + } catch (CVSException e) { + return e.getStatus(); + } + } else { + // Executed for every message line when in quiet mode. + // See bug 238334 + CVSRepositoryLocation repo = (CVSRepositoryLocation)location; + // If exists, remove root directory + if (line.startsWith(repo.getRootDirectory())) { + String repoPath = line.substring(repo.getRootDirectory().length()); + try { + String cmdRootRelativePath = commandRoot.getRepositoryRelativePath(); + // Remove command root path + String path = repoPath.substring(repoPath.indexOf(cmdRootRelativePath) + cmdRootRelativePath.length()); + // Remove filename at the end + String folderPath = path.substring(0, path.indexOf(fileName)); + // The "raw" folderPath contains CVS's 'Attic/' segment when a file has been deleted from cvs. + if (folderPath.endsWith(ATTIC)) { + folderPath = folderPath.substring(0, folderPath.length() - ATTIC_LENGTH); + } + // A separator means the same as "current folder" + if (folderPath.equals(Session.SERVER_SEPARATOR)) + folderPath = Session.CURRENT_LOCAL_FOLDER; + ICVSFolder folder = commandRoot.getFolder(folderPath); + ICVSFile file = folder.getFile(fileName); + if (!file.exists()) + atticFiles.add(file); + } catch (CVSException e) { + return e.getStatus(); + } + } + } + } return OK; } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java index 2ec2dbf3a..60b02bcaf 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java @@ -24,7 +24,7 @@ public class SetKeywordSubstitutionAction extends WorkspaceTraversalAction { @Override public void execute(IAction action) { - ModeWizard.run(getShell(), getSelectedResources()); + ModeWizard.run(getShell(), getSelectedResources()); } @Override diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java index 4d44ac5c3..c11210f0b 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowAnnotationAction.java @@ -34,9 +34,9 @@ public class ShowAnnotationAction extends WorkspaceAction { * Action to open a CVS Annotate View */ public void execute(IAction action) throws InvocationTargetException, InterruptedException { - final ICVSResource resource= getSingleSelectedCVSResource(); - if (resource == null) - return; + final ICVSResource resource= getSingleSelectedCVSResource(); + if (resource == null) + return; execute(resource); } @@ -52,9 +52,9 @@ public class ShowAnnotationAction extends WorkspaceAction { public void execute(final ICVSResource cvsResource) throws InvocationTargetException, InterruptedException { final String revision= getRevision(cvsResource); if (revision == null) - return; + return; boolean binary = isBinary(cvsResource); - if (binary) { + if (binary) { final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore(); final String option = store.getString(ICVSUIConstants.PREF_ANNOTATE_PROMPTFORBINARY); if (option.equals(MessageDialogWithToggle.PROMPT)) { @@ -67,24 +67,24 @@ public class ShowAnnotationAction extends WorkspaceAction { } else if (option.equals(MessageDialogWithToggle.NEVER)) return; } - + new ShowAnnotationOperation(getTargetPart(), cvsResource, revision, binary).run(); } - private boolean isBinary(ICVSResource cvsResource) { - if (cvsResource.isFolder()) return false; - - try { - byte[] syncBytes = ((ICVSFile)cvsResource).getSyncBytes(); - if (syncBytes == null) - return false; - return ResourceSyncInfo.isBinary(syncBytes); - } catch (CVSException e) { - return false; - } - } + private boolean isBinary(ICVSResource cvsResource) { + if (cvsResource.isFolder()) return false; + + try { + byte[] syncBytes = ((ICVSFile)cvsResource).getSyncBytes(); + if (syncBytes == null) + return false; + return ResourceSyncInfo.isBinary(syncBytes); + } catch (CVSException e) { + return false; + } + } - /** + /** * Only enabled for single resource selection */ public boolean isEnabled() { @@ -134,7 +134,7 @@ public class ShowAnnotationAction extends WorkspaceAction { return null; } - + /** * Get the revision for the CVS resource. Throws an InvocationTargetException * if the revision could not be determined. @@ -144,16 +144,16 @@ public class ShowAnnotationAction extends WorkspaceAction { * @throws InvocationTargetException */ private String getRevision(ICVSResource cvsResource) throws InvocationTargetException { - final ResourceSyncInfo info; - try { - info= cvsResource.getSyncInfo(); - if (info == null) - throw new CVSException(NLS.bind(CVSUIMessages.ShowAnnotationAction_noSyncInfo, new String[] { cvsResource.getName() })); - } catch (CVSException e) { - throw new InvocationTargetException(e); - } - return info.getRevision(); - } + final ResourceSyncInfo info; + try { + info= cvsResource.getSyncInfo(); + if (info == null) + throw new CVSException(NLS.bind(CVSUIMessages.ShowAnnotationAction_noSyncInfo, new String[] { cvsResource.getName() })); + } catch (CVSException e) { + throw new InvocationTargetException(e); + } + return info.getRevision(); + } public String getId() { return ICVSUIConstants.CMD_ANNOTATE; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java index 8a78ab47b..d94b4948b 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java @@ -65,24 +65,24 @@ public class SyncAction extends WorkspaceTraversalAction { TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant}); participant.run(getTargetPart()); } else { - IResource[] resources = getResourcesToCompare(getWorkspaceSubscriber()); + IResource[] resources = getResourcesToCompare(getWorkspaceSubscriber()); if (resources == null || resources.length == 0) return; // First check if there is an existing matching participant WorkspaceSynchronizeParticipant participant = (WorkspaceSynchronizeParticipant)SubscriberParticipant.getMatchingParticipant(WorkspaceSynchronizeParticipant.ID, resources); // If there isn't, create one and add to the manager if (participant == null) { - ISynchronizeScope scope; - if (includesAllCVSProjects(resources)) { - scope = new WorkspaceScope(); - } else { - IWorkingSet[] sets = getSelectedWorkingSets(); - if (sets != null) { - scope = new WorkingSetScope(sets); - } else { - scope = new ResourceScope(resources); - } - } - participant = new WorkspaceSynchronizeParticipant(scope); + ISynchronizeScope scope; + if (includesAllCVSProjects(resources)) { + scope = new WorkspaceScope(); + } else { + IWorkingSet[] sets = getSelectedWorkingSets(); + if (sets != null) { + scope = new WorkingSetScope(sets); + } else { + scope = new ResourceScope(resources); + } + } + participant = new WorkspaceSynchronizeParticipant(scope); TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] {participant}); } participant.refresh(resources, getTargetPart().getSite()); @@ -98,53 +98,53 @@ public class SyncAction extends WorkspaceTraversalAction { } private IWorkingSet[] getSelectedWorkingSets() { - ResourceMapping[] mappings = getCVSResourceMappings(); + ResourceMapping[] mappings = getCVSResourceMappings(); List<IWorkingSet> sets = new ArrayList<>(); - for (int i = 0; i < mappings.length; i++) { - ResourceMapping mapping = mappings[i]; - if (mapping.getModelObject() instanceof IWorkingSet) { - IWorkingSet set = (IWorkingSet) mapping.getModelObject(); - sets.add(set); - } else { - return null; - } - } - if (sets.isEmpty()) - return null; - return sets.toArray(new IWorkingSet[sets.size()]); - } + for (int i = 0; i < mappings.length; i++) { + ResourceMapping mapping = mappings[i]; + if (mapping.getModelObject() instanceof IWorkingSet) { + IWorkingSet set = (IWorkingSet) mapping.getModelObject(); + sets.add(set); + } else { + return null; + } + } + if (sets.isEmpty()) + return null; + return sets.toArray(new IWorkingSet[sets.size()]); + } - private boolean includesAllCVSProjects(IResource[] resources) { - // First, make sure all the selected thinsg are projects - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - if (resource.getType() != IResource.PROJECT) - return false; - } - IProject[] cvsProjects = getAllCVSProjects(); - return cvsProjects.length == resources.length; - } + private boolean includesAllCVSProjects(IResource[] resources) { + // First, make sure all the selected thinsg are projects + for (int i = 0; i < resources.length; i++) { + IResource resource = resources[i]; + if (resource.getType() != IResource.PROJECT) + return false; + } + IProject[] cvsProjects = getAllCVSProjects(); + return cvsProjects.length == resources.length; + } - private IProject[] getAllCVSProjects() { - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); + private IProject[] getAllCVSProjects() { + IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); Set<IProject> cvsProjects = new HashSet<>(); - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; - if (RepositoryProvider.isShared(project) && RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()) != null) { - cvsProjects.add(project); - } - } - return cvsProjects.toArray(new IProject[cvsProjects.size()]); - } + for (int i = 0; i < projects.length; i++) { + IProject project = projects[i]; + if (RepositoryProvider.isShared(project) && RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()) != null) { + cvsProjects.add(project); + } + } + return cvsProjects.toArray(new IProject[cvsProjects.size()]); + } - /** - * Return whether it is OK to open the selected file directly in a compare editor. - * It is not OK to show the single file if the file is part of a logical model element - * that spans files. - * @param file the file - * @return whether it is OK to open the selected file directly in a compare editor - */ - public static boolean isOKToShowSingleFile(IFile file) { + /** + * Return whether it is OK to open the selected file directly in a compare editor. + * It is not OK to show the single file if the file is part of a logical model element + * that spans files. + * @param file the file + * @return whether it is OK to open the selected file directly in a compare editor + */ + public static boolean isOKToShowSingleFile(IFile file) { if (!isShowModelSync()) return true; IModelProviderDescriptor[] descriptors = ModelProvider.getModelProviderDescriptors(); @@ -178,8 +178,8 @@ public class SyncAction extends WorkspaceTraversalAction { } return true; } - - /** + + /** * Refresh the subscriber directly and show the resulting synchronization state in a compare editor. If there * is no difference the user is prompted. * diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java index 22bf5c49b..b6ee44b18 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java @@ -72,7 +72,7 @@ public abstract class TagAction extends WorkspaceTraversalAction { IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore(); ITagOperation operation = createTagOperation(); if (operation.isEmpty()) { - return null; + return null; } if (!performPrompting(operation)) { return null; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java index b9392b086..442065a13 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java @@ -25,7 +25,7 @@ import org.eclipse.team.internal.ccvs.ui.operations.TagOperation; * Action that tags the local workspace with a version tag. */ public class TagLocalAction extends TagAction { - + @Override protected boolean performPrompting(ITagOperation operation) { if (operation instanceof TagOperation) { @@ -53,7 +53,7 @@ public class TagLocalAction extends TagAction { return false; } - @Override + @Override protected ITagOperation createTagOperation() { return new TagOperation(getTargetPart(), getCVSResourceMappings()); } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java index 5798096c1..4e0d77c11 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java @@ -91,7 +91,7 @@ public class UnmanageAction extends WorkspaceAction { radio1.setSelection(deleteContent); radio2.setSelection(!deleteContent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.DISCONNECT_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.DISCONNECT_ACTION); return composite; } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java index 68699f7c2..2591555b1 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateSilentAction.java @@ -29,24 +29,24 @@ import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation; * @since 3.1 */ public class UpdateSilentAction extends WorkspaceTraversalAction { - + @Override - protected boolean isEnabledForAddedResources() { - return false; - } + protected boolean isEnabledForAddedResources() { + return false; + } @Override - protected boolean isEnabledForNonExistantResources() { - return true; - } - + protected boolean isEnabledForNonExistantResources() { + return true; + } + @Override public void execute(IAction action) throws InterruptedException, InvocationTargetException { if (CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_HANDLING).equals(ICVSUIConstants.PREF_UPDATE_HANDLING_TRADITIONAL)) { new UpdateOperation(getTargetPart(), getCVSResourceMappings(), Command.NO_LOCAL_OPTIONS, null /* no tag */).run(); } else { - new ModelUpdateOperation(getTargetPart(), getSelectedResourceMappings(CVSProviderPlugin.getTypeId())).run(); - } + new ModelUpdateOperation(getTargetPart(), getSelectedResourceMappings(CVSProviderPlugin.getTypeId())).run(); + } } @Override diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java index 7da395b4c..7f64b1dd0 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java @@ -353,7 +353,7 @@ public abstract class WorkspaceAction extends CVSAction { return true; } - /** + /** * Method isEnabledForCVSResource. * @param cvsResource * @return boolean 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 9bdb8d460..31a978cd6 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 @@ -41,71 +41,71 @@ import org.eclipse.ui.PlatformUI; */ public abstract class WorkspaceTraversalAction extends WorkspaceAction { - /** - * Return the selected mappings that contain resources - * within a CVS managed project. - * @return the selected mappings that contain resources - * within a CVS managed project - */ - protected ResourceMapping[] getCVSResourceMappings() { - return getSelectedResourceMappings(CVSProviderPlugin.getTypeId()); - } + /** + * Return the selected mappings that contain resources + * within a CVS managed project. + * @return the selected mappings that contain resources + * within a CVS managed project + */ + protected ResourceMapping[] getCVSResourceMappings() { + return getSelectedResourceMappings(CVSProviderPlugin.getTypeId()); + } - private static ResourceTraversal[] getTraversals(IWorkbenchPart part, ISynchronizationScopeManager manager, IProgressMonitor monitor) throws CoreException { - try { - BuildScopeOperation op = new BuildScopeOperation(part, manager); - op.run(monitor); - return manager.getScope().getTraversals(); - } catch (InvocationTargetException e) { + private static ResourceTraversal[] getTraversals(IWorkbenchPart part, ISynchronizationScopeManager manager, IProgressMonitor monitor) throws CoreException { + try { + BuildScopeOperation op = new BuildScopeOperation(part, manager); + op.run(monitor); + return manager.getScope().getTraversals(); + } catch (InvocationTargetException e) { throw TeamException.asTeamException(e); } catch (InterruptedException e) { throw new OperationCanceledException(); } - } - - private static IResource[] getRootTraversalResources(ISynchronizationScopeManager manager, IProgressMonitor monitor) throws CoreException { + } + + private static IResource[] getRootTraversalResources(ISynchronizationScopeManager manager, IProgressMonitor monitor) throws CoreException { Set<IResource> result = new HashSet<>(); - ResourceTraversal[] traversals = getTraversals(null, manager, monitor); - for (int i = 0; i < traversals.length; i++) { + ResourceTraversal[] traversals = getTraversals(null, manager, monitor); + for (int i = 0; i < traversals.length; i++) { ResourceTraversal traversal = traversals[i]; - IResource[] resources = traversal.getResources(); - for (int k = 0; k < resources.length; k++) { - IResource resource = resources[k]; - if (RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) != null) { - result.add(resource); - } - } - } - return result.toArray(new IResource[result.size()]); - } + IResource[] resources = traversal.getResources(); + for (int k = 0; k < resources.length; k++) { + IResource resource = resources[k]; + if (RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) != null) { + result.add(resource); + } + } + } + return result.toArray(new IResource[result.size()]); + } - protected Subscriber getWorkspaceSubscriber() { - return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(); - } - + protected Subscriber getWorkspaceSubscriber() { + return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(); + } + public static IResource[] getResourcesToCompare(ResourceMapping[] mappings, Subscriber subscriber) throws InvocationTargetException { - ISynchronizationScopeManager manager = new SynchronizationScopeManager("", //$NON-NLS-1$ - mappings, SubscriberResourceMappingContext.createContext(subscriber), true); - try { - return getResourcesToCompare(manager); - } finally { - manager.dispose(); - } + ISynchronizationScopeManager manager = new SynchronizationScopeManager("", //$NON-NLS-1$ + mappings, SubscriberResourceMappingContext.createContext(subscriber), true); + try { + return getResourcesToCompare(manager); + } finally { + manager.dispose(); + } + } + + protected IResource[] getResourcesToCompare(final Subscriber subscriber) throws InvocationTargetException { + return getResourcesToCompare(getCVSResourceMappings(), subscriber); } - protected IResource[] getResourcesToCompare(final Subscriber subscriber) throws InvocationTargetException { - return getResourcesToCompare(getCVSResourceMappings(), subscriber); - } - - protected ResourceMappingContext getResourceMappingContext() { + protected ResourceMappingContext getResourceMappingContext() { return SubscriberResourceMappingContext.createContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber()); } public static IResource[] getResourcesToCompare(final ISynchronizationScopeManager manager) throws InvocationTargetException { - // Determine what resources need to be synchronized. - // Use a resource mapping context to include any relevant remote resources - final IResource[][] resources = new IResource[][] { null }; - try { + // Determine what resources need to be synchronized. + // Use a resource mapping context to include any relevant remote resources + final IResource[][] resources = new IResource[][] { null }; + try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> { try { resources[0] = getRootTraversalResources(manager, monitor); @@ -113,50 +113,50 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction { throw new InvocationTargetException(e); } }); - } catch (InterruptedException e) { - // Canceled - return null; - } - return resources[0]; - } - - public static IResource[] getProjects(IResource[] resources) { + } catch (InterruptedException e) { + // Canceled + return null; + } + return resources[0]; + } + + public static IResource[] getProjects(IResource[] resources) { Set<IProject> projects = new HashSet<>(); - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - projects.add(resource.getProject()); - } - return projects.toArray(new IResource[projects.size()]); - } - - /** - * - * @param mappings - * @return - * - * @deprecated need to find a better way to do this - */ - @Deprecated + for (int i = 0; i < resources.length; i++) { + IResource resource = resources[i]; + projects.add(resource.getProject()); + } + return projects.toArray(new IResource[projects.size()]); + } + + /** + * + * @param mappings + * @return + * + * @deprecated need to find a better way to do this + */ + @Deprecated public static boolean isLogicalModel(ResourceMapping[] mappings) { - for (int i = 0; i < mappings.length; i++) { - ResourceMapping mapping = mappings[i]; - if (! (mapping.getModelObject() instanceof IResource) ) { - return true; - } - } - return false; - } - - protected IFile getSelectedFile() { - ResourceMapping[] mappings = getCVSResourceMappings(); - if (mappings.length == 1) { - IResource resource = Utils.getResource(mappings[0].getModelObject()); - if (resource != null && resource.getType() == IResource.FILE) - return (IFile)resource; - } - return null; - } - + for (int i = 0; i < mappings.length; i++) { + ResourceMapping mapping = mappings[i]; + if (! (mapping.getModelObject() instanceof IResource) ) { + return true; + } + } + return false; + } + + protected IFile getSelectedFile() { + ResourceMapping[] mappings = getCVSResourceMappings(); + if (mappings.length == 1) { + IResource resource = Utils.getResource(mappings[0].getModelObject()); + if (resource != null && resource.getType() == IResource.FILE) + return (IFile)resource; + } + return null; + } + protected boolean hasOutgoingChanges(final RepositoryProviderOperation operation) throws InvocationTargetException, InterruptedException { final boolean[] hasChange = new boolean[] { false }; PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> { @@ -198,8 +198,8 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction { */ protected SynchronizationScopeManager getScopeManager() { return new SynchronizationScopeManager( - "", //$NON-NLS-1$ - getCVSResourceMappings(), - getResourceMappingContext(), true); + "", //$NON-NLS-1$ + getCVSResourceMappings(), + getResourceMappingContext(), true); } } |