diff options
Diffstat (limited to 'bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping')
10 files changed, 95 insertions, 132 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java index e660c9d1b..a23cdc343 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,9 +21,7 @@ import org.eclipse.team.internal.core.subscribers.AbstractSynchronizationScope; */ public abstract class AbstractResourceMappingScope extends AbstractSynchronizationScope { - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.IResourceMappingScope#getMapping(java.lang.Object) - */ + @Override public ResourceMapping getMapping(Object modelObject) { ResourceMapping[] mappings = getMappings(); for (int i = 0; i < mappings.length; i++) { @@ -34,11 +32,9 @@ public abstract class AbstractResourceMappingScope extends AbstractSynchronizati return null; } - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.IResourceMappingScope#getMappings(java.lang.String) - */ + @Override public ResourceMapping[] getMappings(String id) { - Set result = new HashSet(); + Set<ResourceMapping> result = new HashSet<>(); ResourceMapping[] mappings = getMappings(); for (int i = 0; i < mappings.length; i++) { ResourceMapping mapping = mappings[i]; @@ -46,13 +42,11 @@ public abstract class AbstractResourceMappingScope extends AbstractSynchronizati result.add(mapping); } } - return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]); + return result.toArray(new ResourceMapping[result.size()]); } - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.ISynchronizationScope#getTraversals(java.lang.String) - */ + @Override public ResourceTraversal[] getTraversals(String modelProviderId) { ResourceMapping[] mappings = getMappings(modelProviderId); CompoundResourceTraversal traversal = new CompoundResourceTraversal(); @@ -65,11 +59,9 @@ public abstract class AbstractResourceMappingScope extends AbstractSynchronizati return traversal.asTraversals(); } - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.IResourceMappingScope#getModelProviders() - */ + @Override public ModelProvider[] getModelProviders() { - Set result = new HashSet(); + Set<ModelProvider> result = new HashSet<>(); ResourceMapping[] mappings = getMappings(); for (int i = 0; i < mappings.length; i++) { ResourceMapping mapping = mappings[i]; @@ -77,7 +69,7 @@ public abstract class AbstractResourceMappingScope extends AbstractSynchronizati if (modelProvider != null) result.add(modelProvider); } - return (ModelProvider[]) result.toArray(new ModelProvider[result.size()]); + return result.toArray(new ModelProvider[result.size()]); } } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java index 274a2cdb6..71e09aa88 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,10 +23,10 @@ import org.eclipse.core.runtime.IPath; */ public class CompoundResourceTraversal { - private Set deepFolders = new HashSet(); - private Set shallowFolders = new HashSet(); - private Set zeroFolders = new HashSet(); - private Set files = new HashSet(); + private Set<IResource> deepFolders = new HashSet<>(); + private Set<IResource> shallowFolders = new HashSet<>(); + private Set<IResource> zeroFolders = new HashSet<>(); + private Set<IResource> files = new HashSet<>(); public synchronized void addTraversals(ResourceTraversal[] traversals) { for (int i = 0; i < traversals.length; i++) { @@ -154,16 +154,16 @@ public class CompoundResourceTraversal { // However, this makes deadlock possible and, in practive, I don't think that // the provided traversal will be modified after it is passed to this method. addResources( - (IResource[]) compoundTraversal.deepFolders.toArray(new IResource[compoundTraversal.deepFolders.size()]), + compoundTraversal.deepFolders.toArray(new IResource[compoundTraversal.deepFolders.size()]), IResource.DEPTH_INFINITE); addResources( - (IResource[]) compoundTraversal.shallowFolders.toArray(new IResource[compoundTraversal.shallowFolders.size()]), + compoundTraversal.shallowFolders.toArray(new IResource[compoundTraversal.shallowFolders.size()]), IResource.DEPTH_ONE); addResources( - (IResource[]) compoundTraversal.zeroFolders.toArray(new IResource[compoundTraversal.zeroFolders.size()]), + compoundTraversal.zeroFolders.toArray(new IResource[compoundTraversal.zeroFolders.size()]), IResource.DEPTH_ZERO); addResources( - (IResource[]) compoundTraversal.files.toArray(new IResource[compoundTraversal.files.size()]), + compoundTraversal.files.toArray(new IResource[compoundTraversal.files.size()]), IResource.DEPTH_ZERO); } @@ -190,7 +190,7 @@ public class CompoundResourceTraversal { * Return any resources in the other traversal that are not covered by this traversal */ private IResource[] getUncoveredResources(CompoundResourceTraversal otherTraversal) { - Set result = new HashSet(); + Set<IResource> result = new HashSet<>(); for (Iterator iter = otherTraversal.files.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (!isCovered(resource, IResource.DEPTH_ZERO)) { @@ -215,33 +215,33 @@ public class CompoundResourceTraversal { result.add(resource); } } - return (IResource[]) result.toArray(new IResource[result.size()]); + return result.toArray(new IResource[result.size()]); } public synchronized ResourceTraversal[] asTraversals() { - List result = new ArrayList(); + List<ResourceTraversal> result = new ArrayList<>(); if (!files.isEmpty() || ! zeroFolders.isEmpty()) { - Set combined = new HashSet(); + Set<IResource> combined = new HashSet<>(); combined.addAll(files); combined.addAll(zeroFolders); - result.add(new ResourceTraversal((IResource[]) combined.toArray(new IResource[combined.size()]), IResource.DEPTH_ZERO, IResource.NONE)); + result.add(new ResourceTraversal(combined.toArray(new IResource[combined.size()]), IResource.DEPTH_ZERO, IResource.NONE)); } if (!shallowFolders.isEmpty()) { - result.add(new ResourceTraversal((IResource[]) shallowFolders.toArray(new IResource[shallowFolders.size()]), IResource.DEPTH_ONE, IResource.NONE)); + result.add(new ResourceTraversal(shallowFolders.toArray(new IResource[shallowFolders.size()]), IResource.DEPTH_ONE, IResource.NONE)); } if (!deepFolders.isEmpty()) { - result.add(new ResourceTraversal((IResource[]) deepFolders.toArray(new IResource[deepFolders.size()]), IResource.DEPTH_INFINITE, IResource.NONE)); + result.add(new ResourceTraversal(deepFolders.toArray(new IResource[deepFolders.size()]), IResource.DEPTH_INFINITE, IResource.NONE)); } - return (ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]); + return result.toArray(new ResourceTraversal[result.size()]); } public synchronized IResource[] getRoots() { - List result = new ArrayList(); + List<IResource> result = new ArrayList<>(); result.addAll(files); result.addAll(zeroFolders); result.addAll(shallowFolders); result.addAll(deepFolders); - return (IResource[]) result.toArray(new IResource[result.size()]); + return result.toArray(new IResource[result.size()]); } public synchronized ResourceTraversal[] getUncoveredTraversals(ResourceTraversal[] traversals) { diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/DiffChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/DiffChangeEvent.java index bd7fc2982..6fb7515bf 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/DiffChangeEvent.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/DiffChangeEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,13 +25,13 @@ public class DiffChangeEvent implements IDiffChangeEvent { // List that accumulate changes // SyncInfo - private Map changedResources = new HashMap(); - private Set removedResources = new HashSet(); - private Map addedResources = new HashMap(); + private Map<IPath, IDiff> changedResources = new HashMap<>(); + private Set<IPath> removedResources = new HashSet<>(); + private Map<IPath, IDiff> addedResources = new HashMap<>(); private boolean reset = false; - private List errors = new ArrayList(); + private List<IStatus> errors = new ArrayList<>(); /** * Create a diff change event @@ -41,32 +41,24 @@ public class DiffChangeEvent implements IDiffChangeEvent { this.tree = tree; } - /* (non-Javadoc) - * @see org.eclipse.team.core.delta.ISyncDeltaChangeEvent#getTree() - */ + @Override public IDiffTree getTree() { return tree; } - /* (non-Javadoc) - * @see org.eclipse.team.core.delta.ISyncDeltaChangeEvent#getAdditions() - */ + @Override public IDiff[] getAdditions() { - return (IDiff[]) addedResources.values().toArray(new IDiff[addedResources.size()]); + return addedResources.values().toArray(new IDiff[addedResources.size()]); } - /* (non-Javadoc) - * @see org.eclipse.team.core.delta.ISyncDeltaChangeEvent#getRemovals() - */ + @Override public IPath[] getRemovals() { - return (IPath[]) removedResources.toArray(new IPath[removedResources.size()]); + return removedResources.toArray(new IPath[removedResources.size()]); } - /* (non-Javadoc) - * @see org.eclipse.team.core.delta.ISyncDeltaChangeEvent#getChanges() - */ + @Override public IDiff[] getChanges() { - return (IDiff[]) changedResources.values().toArray(new IDiff[changedResources.size()]); + return changedResources.values().toArray(new IDiff[changedResources.size()]); } public void added(IDiff delta) { @@ -116,8 +108,9 @@ public class DiffChangeEvent implements IDiffChangeEvent { errors .add(status); } + @Override public IStatus[] getErrors() { - return (IStatus[]) errors.toArray(new IStatus[errors.size()]); + return errors.toArray(new IStatus[errors.size()]); } } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LocalResourceVariant.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LocalResourceVariant.java index 97b8f8f30..36e7af7f8 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LocalResourceVariant.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LocalResourceVariant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,14 +24,17 @@ public class LocalResourceVariant implements IResourceVariant { this.resource = resource; } + @Override public byte[] asBytes() { return getContentIdentifier().getBytes(); } + @Override public String getContentIdentifier() { return new Date(resource.getLocalTimeStamp()).toString(); } + @Override public IStorage getStorage(IProgressMonitor monitor) throws TeamException { if (resource.getType() == IResource.FILE) { return (IFile)resource; @@ -39,10 +42,12 @@ public class LocalResourceVariant implements IResourceVariant { return null; } + @Override public boolean isContainer() { return resource.getType() != IResource.FILE; } + @Override public String getName() { return resource.getName(); } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java index 8e697341b..487e04a6d 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,45 +28,37 @@ public class ModelProviderResourceMapping extends ResourceMapping { this.provider = provider; } - /* (non-Javadoc) - * @see org.eclipse.core.resources.mapping.ResourceMapping#getModelObject() - */ + @Override public Object getModelObject() { return provider; } - /* (non-Javadoc) - * @see org.eclipse.core.resources.mapping.ResourceMapping#getModelProviderId() - */ + @Override public String getModelProviderId() { // Use the resource model provider id. Model providers // can override this by adapting their specific model provider class return ModelProvider.RESOURCE_MODEL_PROVIDER_ID; } - /* (non-Javadoc) - * @see org.eclipse.core.resources.mapping.ResourceMapping#getProjects() - */ + @Override public IProject[] getProjects() { IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); try { IResource[] resources = provider.getDescriptor().getMatchingResources(projects); - Set result = new HashSet(); + Set<IProject> result = new HashSet<>(); for (int i = 0; i < resources.length; i++) { IResource resource = resources[i]; if (resource.isAccessible()) result.add(resource.getProject()); } - return (IProject[]) result.toArray(new IProject[result.size()]); + return result.toArray(new IProject[result.size()]); } catch (CoreException e) { TeamPlugin.log(e); } return projects; } - /* (non-Javadoc) - * @see org.eclipse.core.resources.mapping.ResourceMapping#getTraversals(org.eclipse.core.resources.mapping.ResourceMappingContext, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { monitor = Policy.monitorFor(monitor); @@ -91,6 +83,7 @@ public class ModelProviderResourceMapping extends ResourceMapping { return getProjects(); } + @Override public boolean contains(ResourceMapping mapping) { return (mapping.getModelProviderId().equals(getModelProviderId())); } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java index e3c6692a7..61ff6d870 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,7 +21,7 @@ public class PathTree { class Node { Object payload; - Set descendantsWithPayload; + Set<IPath> descendantsWithPayload; int flags; public boolean isEmpty() { return payload == null && (descendantsWithPayload == null || descendantsWithPayload.isEmpty()); @@ -46,8 +46,8 @@ public class PathTree { } public boolean descendantHasFlag(int property) { if (hasDescendants()) { - for (Iterator iter = descendantsWithPayload.iterator(); iter.hasNext();) { - IPath path = (IPath) iter.next(); + for (Iterator<IPath> iter = descendantsWithPayload.iterator(); iter.hasNext();) { + IPath path = iter.next(); Node child = getNode(path); if (child.hasFlag(property)) { return true; @@ -58,7 +58,7 @@ public class PathTree { } } - private Map objects = new HashMap(); + private Map<IPath, Node> objects = new HashMap<>(); /** * Return the object at the given path or <code>null</code> @@ -139,7 +139,7 @@ public class PathTree { public synchronized IPath[] getChildren(IPath path) { // OPTIMIZE: could be optimized so that we don't traverse all the deep // children to find the immediate ones. - Set children = new HashSet(); + Set<IPath> children = new HashSet<>(); Node node = getNode(path); if (node != null) { Set possibleChildren = node.descendantsWithPayload; @@ -159,7 +159,7 @@ public class PathTree { } } } - return (IPath[]) children.toArray(new IPath[children.size()]); + return children.toArray(new IPath[children.size()]); } private boolean addToParents(IPath path, IPath parent) { @@ -172,9 +172,9 @@ public class PathTree { Node node = getNode(parent); if (node == null) node = addNode(parent); - Set children = node.descendantsWithPayload; + Set<IPath> children = node.descendantsWithPayload; if (children == null) { - children = new HashSet(); + children = new HashSet<>(); node.descendantsWithPayload = children; // this is a new folder in the sync set addedParent = true; @@ -239,14 +239,14 @@ public class PathTree { * @return the paths in this tree that contain diffs. */ public synchronized IPath[] getPaths() { - List result = new ArrayList(); + List<IPath> result = new ArrayList<>(); for (Iterator iter = objects.keySet().iterator(); iter.hasNext();) { IPath path = (IPath) iter.next(); Node node = getNode(path); if (node.getPayload() != null) result.add(path); } - return (IPath[]) result.toArray(new IPath[result.size()]); + return result.toArray(new IPath[result.size()]); } /** @@ -254,7 +254,7 @@ public class PathTree { * @return all the values in the tree */ public synchronized Collection values() { - List result = new ArrayList(); + List<Object> result = new ArrayList<>(); for (Iterator iter = objects.keySet().iterator(); iter.hasNext();) { IPath path = (IPath) iter.next(); Node node = getNode(path); @@ -273,7 +273,7 @@ public class PathTree { } private Node getNode(IPath path) { - return (Node)objects.get(path); + return objects.get(path); } private Node addNode(IPath path) { @@ -297,12 +297,12 @@ public class PathTree { * @return the paths whose bit changed */ public synchronized IPath[] setPropogatedProperty(IPath path, int property, boolean value) { - Set changed = new HashSet(); + Set<IPath> changed = new HashSet<>(); internalSetPropertyBit(path, property, value, changed); - return (IPath[]) changed.toArray(new IPath[changed.size()]); + return changed.toArray(new IPath[changed.size()]); } - private void internalSetPropertyBit(IPath path, int property, boolean value, Set changed) { + private void internalSetPropertyBit(IPath path, int property, boolean value, Set<IPath> changed) { if (path.segmentCount() == 0) return; Node node = getNode(path); diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java index c01852b81..042b22152 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,23 +27,17 @@ public class ResourceMappingInputScope extends AbstractResourceMappingScope { this.wrappedScope = wrappedScope; } - /* (non-Javadoc) - * @see org.eclipse.team.ui.mapping.IResourceMappingScope#getInputMappings() - */ + @Override public ResourceMapping[] getInputMappings() { return wrappedScope.getInputMappings(); } - /* (non-Javadoc) - * @see org.eclipse.team.ui.mapping.IResourceMappingScope#getMappings() - */ + @Override public ResourceMapping[] getMappings() { return getInputMappings(); } - /* (non-Javadoc) - * @see org.eclipse.team.ui.mapping.IResourceMappingScope#getTraversals() - */ + @Override public ResourceTraversal[] getTraversals() { CompoundResourceTraversal result = new CompoundResourceTraversal(); ResourceMapping[] mappings = getMappings(); @@ -55,9 +49,7 @@ public class ResourceMappingInputScope extends AbstractResourceMappingScope { return result.asTraversals(); } - /* (non-Javadoc) - * @see org.eclipse.team.ui.mapping.IResourceMappingScope#getTraversals(org.eclipse.core.resources.mapping.ResourceMapping) - */ + @Override public ResourceTraversal[] getTraversals(ResourceMapping mapping) { if (!contains(mapping)) { return null; @@ -76,44 +68,32 @@ public class ResourceMappingInputScope extends AbstractResourceMappingScope { return false; } - /* (non-Javadoc) - * @see org.eclipse.team.ui.mapping.IResourceMappingScope#hasAdditionalMappings() - */ + @Override public boolean hasAdditionalMappings() { return false; } - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.IResourceMappingScope#hasAdditonalResources() - */ + @Override public boolean hasAdditonalResources() { return false; } - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.IResourceMappingScope#asInputScope() - */ + @Override public ISynchronizationScope asInputScope() { return this; } - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.ISynchronizationScope#getProjects() - */ + @Override public IProject[] getProjects() { return wrappedScope.getProjects(); } - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.ISynchronizationScope#getContext() - */ + @Override public ResourceMappingContext getContext() { return wrappedScope.getContext(); } - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.ISynchronizationScope#refresh(org.eclipse.core.resources.mapping.ResourceMapping[]) - */ + @Override public void refresh(ResourceMapping[] mappings) { wrappedScope.refresh(mappings); } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java index da7e30457..11a3a5cd4 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -61,8 +61,8 @@ public class ScopeChangeEvent { ResourceMapping[] changedMappings; if (currentMappings.length > originalMappings.length) { // The number of mappings has increased so we should report the new mappings - Set originalSet = new HashSet(); - List result = new ArrayList(); + Set<ResourceMapping> originalSet = new HashSet<>(); + List<ResourceMapping> result = new ArrayList<>(); for (int i = 0; i < originalMappings.length; i++) { ResourceMapping mapping = originalMappings[i]; originalSet.add(mapping); @@ -73,11 +73,11 @@ public class ScopeChangeEvent { result.add(mapping); } } - changedMappings = (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]); + changedMappings = result.toArray(new ResourceMapping[result.size()]); } else if (isContracted()) { // The number of mappings may be smaller so report the removed mappings - Set finalSet = new HashSet(); - List result = new ArrayList(); + Set<ResourceMapping> finalSet = new HashSet<>(); + List<ResourceMapping> result = new ArrayList<>(); for (int i = 0; i < currentMappings.length; i++) { ResourceMapping mapping = currentMappings[i]; finalSet.add(mapping); @@ -88,7 +88,7 @@ public class ScopeChangeEvent { result.add(mapping); } } - changedMappings = (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]); + changedMappings = result.toArray(new ResourceMapping[result.size()]); } else { changedMappings = new ResourceMapping[0]; } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/SyncInfoToDiffConverter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/SyncInfoToDiffConverter.java index 9b8f2a6f9..2bd474d23 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/SyncInfoToDiffConverter.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/SyncInfoToDiffConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,6 +39,7 @@ public class SyncInfoToDiffConverter { this.kind = kind; } + @Override protected int calculateKind() throws TeamException { return kind; } diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java index 61f890677..562fe55e2 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ import org.eclipse.team.internal.core.TeamPlugin; public class TextStorageMerger implements IStorageMerger { + @Override public IStatus merge(OutputStream output, String outputEncoding, IStorage ancestor, IStorage target, IStorage other, IProgressMonitor monitor) throws CoreException { @@ -88,9 +89,7 @@ public class TextStorageMerger implements IStorageMerger { return Status.OK_STATUS; } - /* (non-Javadoc) - * @see org.eclipse.team.core.mapping.IStorageMerger#canMergeWithoutAncestor() - */ + @Override public boolean canMergeWithoutAncestor() { return false; } |