Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetSerializationContext.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/FastDiffFilter.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/ThreeWayDiff.java22
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/TwoWayDiff.java18
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/DelegatingStorageMerger.java10
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeStatus.java14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java9
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java32
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java30
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSetChangeEvent.java22
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.java37
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java31
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTree.java30
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java33
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayResourceComparator.java14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java8
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileContentManager.java62
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java5
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java26
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java17
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java23
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.java14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java4
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java22
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java19
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.java22
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/AbstractResourceMappingScope.java26
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/CompoundResourceTraversal.java38
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/DiffChangeEvent.java35
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LocalResourceVariant.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ModelProviderResourceMapping.java23
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/PathTree.java32
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingInputScope.java42
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeChangeEvent.java14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/SyncInfoToDiffConverter.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/TextStorageMerger.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java6
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java8
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java9
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java28
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.java12
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java8
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java24
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparisonDiffFilter.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java31
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java18
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java101
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java10
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.java29
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java13
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java17
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.java3
67 files changed, 533 insertions, 663 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetSerializationContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetSerializationContext.java
index 9c1d1fe5b..268892380 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetSerializationContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetSerializationContext.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
@@ -26,7 +26,7 @@ import org.eclipse.core.resources.IProject;
public class ProjectSetSerializationContext {
private final String filename;
- private final Map properties = new HashMap();
+ private final Map<String, Object> properties = new HashMap<>();
/**
* Create a serialization context with no filename
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
index 75f302ace..b75404a15 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProviderType.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
@@ -55,7 +55,7 @@ import org.eclipse.team.internal.core.TeamPlugin;
*/
public abstract class RepositoryProviderType extends PlatformObject {
- private static Map allProviderTypes = new HashMap();
+ private static Map<String, RepositoryProviderType> allProviderTypes = new HashMap<>();
private String id;
@@ -73,7 +73,7 @@ public abstract class RepositoryProviderType extends PlatformObject {
* @see #getID()
*/
public static RepositoryProviderType getProviderType(String id) {
- RepositoryProviderType type = (RepositoryProviderType) allProviderTypes.get(id);
+ RepositoryProviderType type = allProviderTypes.get(id);
if(type != null)
return type;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java
index b8f66e462..5de9f9f12 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ScmUrlImportDescription.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 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
@@ -32,7 +32,7 @@ import java.util.HashMap;
public class ScmUrlImportDescription {
private String url;
private String project;
- private HashMap properties;
+ private HashMap<String, Object> properties;
public ScmUrlImportDescription(String url, String project) {
this.url = url;
@@ -73,7 +73,7 @@ public class ScmUrlImportDescription {
*/
public synchronized void setProperty(String key, Object value) {
if (properties == null) {
- properties = new HashMap();
+ properties = new HashMap<>();
}
if (value == null) {
properties.remove(key);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
index 538c0f6d0..675a72928 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
@@ -67,7 +67,7 @@ public final class Team {
private final static FileContentManager fFileContentManager;
- private static List fBundleImporters;
+ private static List<IBundleImporter> fBundleImporters;
static {
fFileContentManager= new FileContentManager();
@@ -604,7 +604,7 @@ public final class Team {
*/
public synchronized static IBundleImporter[] getBundleImporters() {
if (fBundleImporters == null) {
- fBundleImporters = new ArrayList();
+ fBundleImporters = new ArrayList<>();
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.EXTENSION_POINT_BUNDLE_IMPORTERS);
if (point != null) {
IConfigurationElement[] infos = point.getConfigurationElements();
@@ -613,6 +613,6 @@ public final class Team {
}
}
}
- return (IBundleImporter[]) fBundleImporters.toArray(new IBundleImporter[fBundleImporters.size()]);
+ return fBundleImporters.toArray(new IBundleImporter[fBundleImporters.size()]);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/FastDiffFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/FastDiffFilter.java
index 4d9a6d298..be0ccea7b 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/FastDiffFilter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/FastDiffFilter.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
@@ -27,6 +27,7 @@ public abstract class FastDiffFilter extends DiffFilter {
public static final FastDiffFilter getStateFilter(final int[] states, final int mask) {
return new FastDiffFilter() {
+ @Override
public boolean select(IDiff node) {
int status = ((Diff)node).getStatus();
for (int i = 0; i < states.length; i++) {
@@ -40,9 +41,7 @@ public abstract class FastDiffFilter extends DiffFilter {
};
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.DiffNodeFilter#select(org.eclipse.team.core.diff.IDiffNode, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public final boolean select(IDiff diff, IProgressMonitor monitor) {
return select(diff);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/ThreeWayDiff.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/ThreeWayDiff.java
index 575b593c0..fe514dbc8 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/ThreeWayDiff.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/ThreeWayDiff.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -77,30 +77,22 @@ public class ThreeWayDiff extends Diff implements IThreeWayDiff {
return CHANGE;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.IThreeWayDelta#getLocalChange()
- */
+ @Override
public ITwoWayDiff getLocalChange() {
return localChange;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.IThreeWayDelta#getRemoteChange()
- */
+ @Override
public ITwoWayDiff getRemoteChange() {
return remoteChange;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.IThreeWayDelta#getDirection()
- */
+ @Override
public int getDirection() {
return getStatus() & CONFLICTING;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffNode#toDiffString()
- */
+ @Override
public String toDiffString() {
int kind = getKind();
String label = ""; //$NON-NLS-1$
@@ -113,9 +105,7 @@ public class ThreeWayDiff extends Diff implements IThreeWayDiff {
return label;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.provider.Diff#equals(java.lang.Object)
- */
+ @Override
public boolean equals(Object obj) {
if (obj == this)
return true;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/TwoWayDiff.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/TwoWayDiff.java
index 01e261f16..8b04f82b6 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/TwoWayDiff.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/TwoWayDiff.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
@@ -45,30 +45,22 @@ public class TwoWayDiff extends Diff implements ITwoWayDiff {
super(path, (kind & KIND_MASK) | (flags & ~KIND_MASK));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ITwoWayDelta#getFlags()
- */
+ @Override
public int getFlags() {
return getStatus() & ~KIND_MASK;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.delta.ITwoWayDelta#getMovedToPath()
- */
+ @Override
public IPath getToPath() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.delta.ITwoWayDelta#getMovedFromPath()
- */
+ @Override
public IPath getFromPath() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.provider.Diff#equals(java.lang.Object)
- */
+ @Override
public boolean equals(Object obj) {
if (obj == this)
return true;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/DelegatingStorageMerger.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/DelegatingStorageMerger.java
index 6a267a052..86ff0d547 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/DelegatingStorageMerger.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/DelegatingStorageMerger.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
@@ -69,9 +69,7 @@ public class DelegatingStorageMerger implements IStorageMerger {
return instance;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IStorageMerger#merge(java.io.OutputStream, java.lang.String, org.eclipse.core.resources.IStorage, org.eclipse.core.resources.IStorage, org.eclipse.core.resources.IStorage, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public IStatus merge(OutputStream output, String outputEncoding,
IStorage ancestor, IStorage target, IStorage other,
IProgressMonitor monitor) throws CoreException {
@@ -217,9 +215,7 @@ public class DelegatingStorageMerger implements IStorageMerger {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IStorageMerger#canMergeWithoutAncestor()
- */
+ @Override
public boolean canMergeWithoutAncestor() {
return false;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.java
index 41c4ffcc8..90fdd515c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ResourceMappingMerger.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
@@ -37,9 +37,7 @@ import org.eclipse.team.core.mapping.provider.MergeStatus;
*/
public abstract class ResourceMappingMerger implements IResourceMappingMerger {
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingMerger#validateMerge(org.eclipse.team.core.mapping.IMergeContext, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public IStatus validateMerge(IMergeContext mergeContext, IProgressMonitor monitor) {
return Status.OK_STATUS;
}
@@ -61,6 +59,7 @@ public abstract class ResourceMappingMerger implements IResourceMappingMerger {
* model provider.
* @see org.eclipse.team.core.mapping.IResourceMappingMerger#getMergeRule(org.eclipse.team.core.mapping.IMergeContext)
*/
+ @Override
public ISchedulingRule getMergeRule(IMergeContext context) {
ResourceMapping[] mappings = context.getScope().getMappings(getModelProvider().getId());
ISchedulingRule rule = null;
@@ -88,6 +87,7 @@ public abstract class ResourceMappingMerger implements IResourceMappingMerger {
* @throws CoreException if an error occurred
* @see org.eclipse.team.core.mapping.IResourceMappingMerger#merge(org.eclipse.team.core.mapping.IMergeContext, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public IStatus merge(IMergeContext mergeContext, IProgressMonitor monitor) throws CoreException {
IDiff[] deltas = getSetToMerge(mergeContext);
IStatus status = mergeContext.merge(deltas, false /* don't force */, monitor);
@@ -96,7 +96,7 @@ public abstract class ResourceMappingMerger implements IResourceMappingMerger {
private IDiff[] getSetToMerge(IMergeContext mergeContext) {
ResourceMapping[] mappings = mergeContext.getScope().getMappings(getModelProvider().getDescriptor().getId());
- Set result = new HashSet();
+ Set<IDiff> result = new HashSet<>();
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
ResourceTraversal[] traversals = mergeContext.getScope().getTraversals(mapping);
@@ -106,7 +106,7 @@ public abstract class ResourceMappingMerger implements IResourceMappingMerger {
result.add(delta);
}
}
- return (IDiff[]) result.toArray(new IDiff[result.size()]);
+ return result.toArray(new IDiff[result.size()]);
}
private IStatus covertFilesToMappings(IStatus status, IMergeContext mergeContext) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeStatus.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeStatus.java
index 2a35b63bf..02fc2eb45 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeStatus.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeStatus.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -58,17 +58,13 @@ public class MergeStatus extends Status implements IMergeStatus {
this.conflictingFiles = files;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IMergeStatus#getConflictingMappings()
- */
- public ResourceMapping[] getConflictingMappings() {
+ @Override
+ public ResourceMapping[] getConflictingMappings() {
return conflictingMappings;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IMergeStatus#getConflictingFiles()
- */
- public IFile[] getConflictingFiles() {
+ @Override
+ public IFile[] getConflictingFiles() {
return conflictingFiles;
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
index ee7df0f17..b0e193110 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/Subscriber.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
@@ -65,7 +65,7 @@ import org.eclipse.team.internal.core.mapping.SyncInfoToDiffConverter;
*/
abstract public class Subscriber {
- private List listeners = new ArrayList(1);
+ private List<ISubscriberChangeListener> listeners = new ArrayList<>(1);
/**
* Return the name of this subscription, in a format that is
@@ -274,16 +274,18 @@ abstract public class Subscriber {
ISubscriberChangeListener[] allListeners;
// Copy the listener list so we're not calling client code while synchronized
synchronized (listeners) {
- allListeners = (ISubscriberChangeListener[]) listeners.toArray(new ISubscriberChangeListener[listeners.size()]);
+ allListeners = listeners.toArray(new ISubscriberChangeListener[listeners.size()]);
}
// Notify the listeners safely so all will receive notification
for (int i = 0; i < allListeners.length; i++) {
final ISubscriberChangeListener listener = allListeners[i];
SafeRunner.run(new ISafeRunnable() {
+ @Override
public void handleException(Throwable exception) {
// don't log the exception....it is already being logged in
// Platform#run
}
+ @Override
public void run() throws Exception {
listener.subscriberResourceChanged(deltas);
}
@@ -500,6 +502,7 @@ abstract public class Subscriber {
final int[] direction = new int[] { 0 };
final int[] kind = new int[] { 0 };
accept(traversals, new IDiffVisitor() {
+ @Override
public boolean visit(IDiff diff) {
if (diff instanceof IThreeWayDiff) {
IThreeWayDiff twd = (IThreeWayDiff) diff;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java
index a5d032422..b80021924 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java
@@ -27,7 +27,7 @@ import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
public class SubscriberScopeManager extends SynchronizationScopeManager implements ISubscriberChangeListener {
private final Subscriber subscriber;
- private Map participants = new HashMap();
+ private Map<ModelProvider, ISynchronizationScopeParticipant> participants = new HashMap<>();
/**
* Create a manager for the given subscriber and input.
@@ -72,29 +72,23 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
@Override
public void initialize(IProgressMonitor monitor) throws CoreException {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- SubscriberScopeManager.super.initialize(monitor);
- hookupParticipants();
- getSubscriber().addListener(SubscriberScopeManager.this);
- }
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor1 -> {
+ SubscriberScopeManager.super.initialize(monitor1);
+ hookupParticipants();
+ getSubscriber().addListener(SubscriberScopeManager.this);
}, getSchedulingRule(), IResource.NONE, monitor);
}
@Override
public ResourceTraversal[] refresh(final ResourceMapping[] mappings, IProgressMonitor monitor) throws CoreException {
- final List result = new ArrayList(1);
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- result.add(SubscriberScopeManager.super.refresh(mappings, monitor));
- hookupParticipants();
- }
+ final List<ResourceTraversal[]> result = new ArrayList<>(1);
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor1 -> {
+ result.add(SubscriberScopeManager.super.refresh(mappings, monitor1));
+ hookupParticipants();
}, getSchedulingRule(), IResource.NONE, monitor);
if (result.isEmpty())
return new ResourceTraversal[0];
- return (ResourceTraversal[])result.get(0);
+ return result.get(0);
}
/*
@@ -145,8 +139,8 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
}
private void fireChange(final IResource[] resources, final IProject[] projects) {
- final Set result = new HashSet();
- ISynchronizationScopeParticipant[] handlers = (ISynchronizationScopeParticipant[]) participants.values().toArray(new ISynchronizationScopeParticipant[participants.size()]);
+ final Set<ResourceMapping> result = new HashSet<>();
+ ISynchronizationScopeParticipant[] handlers = participants.values().toArray(new ISynchronizationScopeParticipant[participants.size()]);
for (int i = 0; i < handlers.length; i++) {
final ISynchronizationScopeParticipant participant = handlers[i];
SafeRunner.run(new ISafeRunnable() {
@@ -165,7 +159,7 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
});
}
if (!result.isEmpty()) {
- refresh((ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]));
+ refresh(result.toArray(new ResourceMapping[result.size()]));
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java
index a74dbc946..c987c54ec 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/FastSyncInfoFilter.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
@@ -68,9 +68,7 @@ public class FastSyncInfoFilter extends SyncInfoFilter {
public AndSyncInfoFilter(FastSyncInfoFilter[] filters) {
super(filters);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.FastSyncInfoFilter#select(org.eclipse.team.core.synchronize.SyncInfo)
- */
+ @Override
public boolean select(SyncInfo info) {
for (int i = 0; i < filters.length; i++) {
FastSyncInfoFilter filter = filters[i];
@@ -86,9 +84,7 @@ public class FastSyncInfoFilter extends SyncInfoFilter {
* Selects <code>SyncInfo</code> instances that are auto-mergable.
*/
public static class AutomergableFilter extends FastSyncInfoFilter {
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.FastSyncInfoFilter#select(org.eclipse.team.core.synchronize.SyncInfo)
- */
+ @Override
public boolean select(SyncInfo info) {
return (info.getKind() & SyncInfo.AUTOMERGE_CONFLICT) != 0;
}
@@ -98,9 +94,7 @@ public class FastSyncInfoFilter extends SyncInfoFilter {
* Selects <code>SyncInfo</code> instances that are pseudo-conflicts.
*/
public static class PseudoConflictFilter extends FastSyncInfoFilter {
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.FastSyncInfoFilter#select(org.eclipse.team.core.synchronize.SyncInfo)
- */
+ @Override
public boolean select(SyncInfo info) {
return info.getKind() != 0 && (info.getKind() & SyncInfo.PSEUDO_CONFLICT) == 0;
}
@@ -117,9 +111,7 @@ public class FastSyncInfoFilter extends SyncInfoFilter {
public OrSyncInfoFilter(FastSyncInfoFilter[] filters) {
super(filters);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.FastSyncInfoFilter#select(org.eclipse.team.core.synchronize.SyncInfo)
- */
+ @Override
public boolean select(SyncInfo info) {
for (int i = 0; i < filters.length; i++) {
FastSyncInfoFilter filter = filters[i];
@@ -154,9 +146,7 @@ public class FastSyncInfoFilter extends SyncInfoFilter {
public SyncInfoChangeTypeFilter(int change) {
this(new int[]{change});
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.FastSyncInfoFilter#select(org.eclipse.team.core.synchronize.SyncInfo)
- */
+ @Override
public boolean select(SyncInfo info) {
int syncKind = info.getKind();
for (int i = 0; i < changeFilters.length; i++) {
@@ -191,9 +181,7 @@ public class FastSyncInfoFilter extends SyncInfoFilter {
public SyncInfoDirectionFilter(int direction) {
this(new int[] { direction });
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.FastSyncInfoFilter#select(org.eclipse.team.core.synchronize.SyncInfo)
- */
+ @Override
public boolean select(SyncInfo info) {
int syncKind = info.getKind();
for (int i = 0; i < directionFilters.length; i++) {
@@ -216,9 +204,7 @@ public class FastSyncInfoFilter extends SyncInfoFilter {
return info.getKind() != 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.SyncInfoFilter#select(org.eclipse.team.core.subscribers.SyncInfo, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public final boolean select(SyncInfo info, IProgressMonitor monitor) {
return select(info);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.java
index 48af21eea..ffe405acc 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoFilter.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
@@ -54,9 +54,7 @@ public abstract class SyncInfoFilter {
criteria = new ContentComparator(ignoreWhitespace);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.SyncInfoFilter#select(org.eclipse.team.core.synchronize.SyncInfo, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public boolean select(SyncInfo info, IProgressMonitor monitor) {
IResourceVariant remote = info.getRemote();
IResource local = info.getLocal();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSetChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSetChangeEvent.java
index 8c2446182..860c233da 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSetChangeEvent.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSetChangeEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 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,13 +27,13 @@ public class SyncInfoSetChangeEvent implements ISyncInfoSetChangeEvent {
// List that accumulate changes
// SyncInfo
- private Map changedResources = new HashMap();
- private Set removedResources = new HashSet();
- private Map addedResources = new HashMap();
+ private Map<IResource, SyncInfo> changedResources = new HashMap<>();
+ private Set<IResource> removedResources = new HashSet<>();
+ private Map<IResource, SyncInfo> addedResources = new HashMap<>();
private boolean reset = false;
- private List errors = new ArrayList();
+ private List<ITeamStatus> errors = new ArrayList<>();
public SyncInfoSetChangeEvent(SyncInfoSet set) {
super();
@@ -72,18 +72,22 @@ public class SyncInfoSetChangeEvent implements ISyncInfoSetChangeEvent {
changedResources.put(resource, info);
}
+ @Override
public SyncInfo[] getAddedResources() {
- return (SyncInfo[]) addedResources.values().toArray(new SyncInfo[addedResources.size()]);
+ return addedResources.values().toArray(new SyncInfo[addedResources.size()]);
}
+ @Override
public SyncInfo[] getChangedResources() {
- return (SyncInfo[]) changedResources.values().toArray(new SyncInfo[changedResources.size()]);
+ return changedResources.values().toArray(new SyncInfo[changedResources.size()]);
}
+ @Override
public IResource[] getRemovedResources() {
- return (IResource[]) removedResources.toArray(new IResource[removedResources.size()]);
+ return removedResources.toArray(new IResource[removedResources.size()]);
}
+ @Override
public SyncInfoSet getSet() {
return set;
}
@@ -105,6 +109,6 @@ public class SyncInfoSetChangeEvent implements ISyncInfoSetChangeEvent {
}
public ITeamStatus[] getErrors() {
- return (ITeamStatus[]) errors.toArray(new ITeamStatus[errors.size()]);
+ return errors.toArray(new ITeamStatus[errors.size()]);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.java
index c78c3e953..3888a19b0 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/AbstractResourceVariantTree.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
@@ -46,8 +46,9 @@ public abstract class AbstractResourceVariantTree implements IResourceVariantTre
* @return the array of resources whose corresponding variants have changed
* @throws TeamException
*/
+ @Override
public IResource[] refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
- List changedResources = new ArrayList();
+ List<IResource> changedResources = new ArrayList<>();
monitor.beginTask(null, 100 * resources.length);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
@@ -55,7 +56,7 @@ public abstract class AbstractResourceVariantTree implements IResourceVariantTre
changedResources.addAll(Arrays.asList(changed));
}
monitor.done();
- return (IResource[]) changedResources.toArray(new IResource[changedResources.size()]);
+ return changedResources.toArray(new IResource[changedResources.size()]);
}
/**
@@ -109,9 +110,9 @@ public abstract class AbstractResourceVariantTree implements IResourceVariantTre
* @throws TeamException
*/
protected IResource[] collectChanges(IResource local, IResourceVariant remote, int depth, IProgressMonitor monitor) throws TeamException {
- List changedResources = new ArrayList();
+ List<IResource> changedResources = new ArrayList<>();
collectChanges(local, remote, changedResources, depth, monitor);
- return (IResource[]) changedResources.toArray(new IResource[changedResources.size()]);
+ return changedResources.toArray(new IResource[changedResources.size()]);
}
/**
@@ -164,30 +165,30 @@ public abstract class AbstractResourceVariantTree implements IResourceVariantTre
*/
protected abstract boolean setVariant(IResource local, IResourceVariant remote) throws TeamException;
- private void collectChanges(IResource local, IResourceVariant remote, Collection changedResources, int depth, IProgressMonitor monitor) throws TeamException {
+ private void collectChanges(IResource local, IResourceVariant remote, Collection<IResource> changedResources, int depth, IProgressMonitor monitor) throws TeamException {
boolean changed = setVariant(local, remote);
if (changed) {
changedResources.add(local);
}
if (depth == IResource.DEPTH_ZERO) return;
- Map children = mergedMembers(local, remote, monitor);
- for (Iterator it = children.keySet().iterator(); it.hasNext();) {
- IResource localChild = (IResource) it.next();
- IResourceVariant remoteChild = (IResourceVariant)children.get(localChild);
+ Map<IResource, IResourceVariant> children = mergedMembers(local, remote, monitor);
+ for (Iterator<IResource> it = children.keySet().iterator(); it.hasNext();) {
+ IResource localChild = it.next();
+ IResourceVariant remoteChild = children.get(localChild);
collectChanges(localChild, remoteChild, changedResources,
depth == IResource.DEPTH_INFINITE ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO,
monitor);
}
- IResource[] cleared = collectedMembers(local, (IResource[]) children.keySet().toArray(new IResource[children.keySet().size()]));
+ IResource[] cleared = collectedMembers(local, children.keySet().toArray(new IResource[children.keySet().size()]));
changedResources.addAll(Arrays.asList(cleared));
monitor.worked(1);
}
- private Map mergedMembers(IResource local, IResourceVariant remote, IProgressMonitor progress) throws TeamException {
+ private Map<IResource, IResourceVariant> mergedMembers(IResource local, IResourceVariant remote, IProgressMonitor progress) throws TeamException {
// {IResource -> IResourceVariant}
- Map mergedResources = new HashMap();
+ Map<IResource, IResourceVariant> mergedResources = new HashMap<>();
IResourceVariant[] remoteChildren;
if (remote == null) {
@@ -200,12 +201,12 @@ public abstract class AbstractResourceVariantTree implements IResourceVariantTre
IResource[] localChildren = members(local);
if (remoteChildren.length > 0 || localChildren.length > 0) {
- Set allSet = new HashSet(20);
- Map localSet = null;
- Map remoteSet = null;
+ Set<String> allSet = new HashSet<>(20);
+ Map<String, IResource> localSet = null;
+ Map<String, IResourceVariant> remoteSet = null;
if (localChildren.length > 0) {
- localSet = new HashMap(10);
+ localSet = new HashMap<>(10);
for (int i = 0; i < localChildren.length; i++) {
IResource localChild = localChildren[i];
String name = localChild.getName();
@@ -215,7 +216,7 @@ public abstract class AbstractResourceVariantTree implements IResourceVariantTre
}
if (remoteChildren.length > 0) {
- remoteSet = new HashMap(10);
+ remoteSet = new HashMap<>(10);
for (int i = 0; i < remoteChildren.length; i++) {
IResourceVariant remoteChild = remoteChildren[i];
String name = remoteChild.getName();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java
index 9f38007aa..90ac851b9 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/PersistantResourceVariantByteStore.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -43,9 +43,7 @@ public class PersistantResourceVariantByteStore extends ResourceVariantByteStore
getSynchronizer().add(syncName);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#dispose()
- */
+ @Override
public void dispose() {
getSynchronizer().remove(getSyncName());
}
@@ -58,9 +56,7 @@ public class PersistantResourceVariantByteStore extends ResourceVariantByteStore
return syncName;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#getBytes(org.eclipse.core.resources.IResource)
- */
+ @Override
public byte[] getBytes(IResource resource) throws TeamException {
byte[] syncBytes = internalGetSyncBytes(resource);
if (syncBytes != null && equals(syncBytes, NO_REMOTE)) {
@@ -70,9 +66,7 @@ public class PersistantResourceVariantByteStore extends ResourceVariantByteStore
return syncBytes;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#setBytes(org.eclipse.core.resources.IResource, byte[])
- */
+ @Override
public boolean setBytes(IResource resource, byte[] bytes) throws TeamException {
Assert.isNotNull(bytes);
byte[] oldBytes = internalGetSyncBytes(resource);
@@ -85,9 +79,7 @@ public class PersistantResourceVariantByteStore extends ResourceVariantByteStore
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#flushBytes(org.eclipse.core.resources.IResource, int)
- */
+ @Override
public boolean flushBytes(IResource resource, int depth) throws TeamException {
if (resource.exists() || resource.isPhantom()) {
try {
@@ -122,13 +114,12 @@ public class PersistantResourceVariantByteStore extends ResourceVariantByteStore
* <code>getBytes(resource)</code> will return <code>null</code>.
* @return <code>true</code> if this changes the remote sync bytes
*/
+ @Override
public boolean deleteBytes(IResource resource) throws TeamException {
return setBytes(resource, NO_REMOTE);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#members(org.eclipse.core.resources.IResource)
- */
+ @Override
public IResource[] members(IResource resource) throws TeamException {
if(resource.getType() == IResource.FILE) {
return new IResource[0];
@@ -136,14 +127,14 @@ public class PersistantResourceVariantByteStore extends ResourceVariantByteStore
try {
// Filter and return only resources that have sync bytes in the cache.
IResource[] members = ((IContainer)resource).members(true /* include phantoms */);
- List filteredMembers = new ArrayList(members.length);
+ List<IResource> filteredMembers = new ArrayList<>(members.length);
for (int i = 0; i < members.length; i++) {
IResource member = members[i];
if(getBytes(member) != null) {
filteredMembers.add(member);
}
}
- return (IResource[]) filteredMembers.toArray(new IResource[filteredMembers.size()]);
+ return filteredMembers.toArray(new IResource[filteredMembers.size()]);
} catch (CoreException e) {
throw TeamException.asTeamException(e);
}
@@ -161,9 +152,7 @@ public class PersistantResourceVariantByteStore extends ResourceVariantByteStore
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#run(org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void run(IResource root, IWorkspaceRunnable runnable, IProgressMonitor monitor)
throws TeamException {
try {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTree.java
index 12cf6faeb..e3b5c9f85 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTree.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
@@ -11,8 +11,6 @@
package org.eclipse.team.core.variants;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
@@ -38,30 +36,22 @@ public abstract class ResourceVariantTree extends AbstractResourceVariantTree {
this.store = store;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.IResourceVariantTree#members(org.eclipse.core.resources.IResource)
- */
+ @Override
public IResource[] members(IResource resource) throws TeamException {
return getByteStore().members(resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.IResourceVariantTree#hasResourceVariant(org.eclipse.core.resources.IResource)
- */
+ @Override
public boolean hasResourceVariant(IResource resource) throws TeamException {
return getByteStore().getBytes(resource) != null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.IResourceVariantTree#flushVariants(org.eclipse.core.resources.IResource, int)
- */
+ @Override
public void flushVariants(IResource resource, int depth) throws TeamException {
getByteStore().flushBytes(resource, depth);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.AbstractResourceVariantTree#setVariant(org.eclipse.core.resources.IResource, org.eclipse.team.core.variants.IResourceVariant)
- */
+ @Override
protected boolean setVariant(IResource local, IResourceVariant remote) throws TeamException {
ResourceVariantByteStore cache = getByteStore();
byte[] newRemoteBytes = getBytes(local, remote);
@@ -100,18 +90,12 @@ public abstract class ResourceVariantTree extends AbstractResourceVariantTree {
return remote.asBytes();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.AbstractResourceVariantTree#collectChanges(org.eclipse.core.resources.IResource, org.eclipse.team.core.variants.IResourceVariant, int, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected IResource[] collectChanges(final IResource local,
final IResourceVariant remote, final int depth, IProgressMonitor monitor)
throws TeamException {
final IResource[][] resources = new IResource[][] { null };
- getByteStore().run(local, new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- resources[0] = ResourceVariantTree.super.collectChanges(local, remote, depth, monitor);
- }
- }, monitor);
+ getByteStore().run(local, monitor1 -> resources[0] = ResourceVariantTree.super.collectChanges(local, remote, depth, monitor1), monitor);
return resources[0];
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java
index 7c7c64e35..b58ccaeac 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ResourceVariantTreeSubscriber.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 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
@@ -31,9 +31,7 @@ import org.eclipse.team.internal.core.*;
*/
public abstract class ResourceVariantTreeSubscriber extends Subscriber {
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.Subscriber#getSyncInfo(org.eclipse.core.resources.IResource)
- */
+ @Override
public SyncInfo getSyncInfo(IResource resource) throws TeamException {
if (!isSupervised(resource)) return null;
IResourceVariant remoteResource = getRemoteTree().getResourceVariant(resource);
@@ -61,15 +59,13 @@ public abstract class ResourceVariantTreeSubscriber extends Subscriber {
return info;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.Subscriber#members(org.eclipse.core.resources.IResource)
- */
+ @Override
public IResource[] members(IResource resource) throws TeamException {
if(resource.getType() == IResource.FILE) {
return new IResource[0];
}
try {
- Set allMembers = new HashSet();
+ Set<IResource> allMembers = new HashSet<>();
try {
allMembers.addAll(Arrays.asList(((IContainer)resource).members()));
} catch (CoreException e) {
@@ -93,19 +89,17 @@ public abstract class ResourceVariantTreeSubscriber extends Subscriber {
iterator.remove();
}
}
- return (IResource[]) allMembers.toArray(new IResource[allMembers.size()]);
+ return allMembers.toArray(new IResource[allMembers.size()]);
} catch (CoreException e) {
throw TeamException.asTeamException(e);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.Subscriber#refresh(org.eclipse.core.resources.IResource[], int, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
monitor = Policy.monitorFor(monitor);
- List errors = new ArrayList();
- List cancels = new ArrayList();
+ List<IStatus> errors = new ArrayList<>();
+ List<IStatus> cancels = new ArrayList<>();
try {
monitor.beginTask(null, 1000 * resources.length);
for (int i = 0; i < resources.length; i++) {
@@ -127,7 +121,7 @@ public abstract class ResourceVariantTreeSubscriber extends Subscriber {
if (!cancels.isEmpty()) {
errors.addAll(cancels);
throw new TeamException(new MultiStatus(TeamPlugin.ID, 0,
- (IStatus[]) errors.toArray(new IStatus[errors.size()]),
+ errors.toArray(new IStatus[errors.size()]),
NLS.bind(
Messages.ResourceVariantTreeSubscriber_3,
(new Object[] { getName(),
@@ -135,6 +129,7 @@ public abstract class ResourceVariantTreeSubscriber extends Subscriber {
Integer.toString(resources.length),
Integer.toString(cancels.size()) })),
null) {
+ @Override
public int getSeverity() {
// we want to display status as an error
return IStatus.ERROR;
@@ -142,12 +137,12 @@ public abstract class ResourceVariantTreeSubscriber extends Subscriber {
});
}
throw new TeamException(new MultiStatus(TeamPlugin.ID, 0,
- (IStatus[]) errors.toArray(new IStatus[errors.size()]),
+ errors.toArray(new IStatus[errors.size()]),
NLS.bind(Messages.ResourceVariantTreeSubscriber_1, (new Object[] {getName(), Integer.toString(numSuccess), Integer.toString(resources.length)})), null));
}
if (!cancels.isEmpty()) {
throw new OperationCanceledException(
- ((IStatus) cancels.get(0)).getMessage());
+ cancels.get(0).getMessage());
}
}
@@ -165,14 +160,14 @@ public abstract class ResourceVariantTreeSubscriber extends Subscriber {
monitor = Policy.monitorFor(monitor);
try {
monitor.beginTask(null, 100);
- Set allChanges = new HashSet();
+ Set<IResource> allChanges = new HashSet<>();
if (getResourceComparator().isThreeWay()) {
IResource[] baseChanges = getBaseTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 25));
allChanges.addAll(Arrays.asList(baseChanges));
}
IResource[] remoteChanges = getRemoteTree().refresh(new IResource[] {resource}, depth, Policy.subMonitorFor(monitor, 75));
allChanges.addAll(Arrays.asList(remoteChanges));
- IResource[] changedResources = (IResource[]) allChanges.toArray(new IResource[allChanges.size()]);
+ IResource[] changedResources = allChanges.toArray(new IResource[allChanges.size()]);
fireTeamResourceChange(SubscriberChangeEvent.asSyncChangedDeltas(this, changedResources));
return Status.OK_STATUS;
} catch (TeamException e) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayResourceComparator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayResourceComparator.java
index 0382fcfea..db7c714cf 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayResourceComparator.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayResourceComparator.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
@@ -36,9 +36,7 @@ public class ThreeWayResourceComparator implements IResourceVariantComparator {
this.synchronizer = synchronizer;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.IResourceVariantComparator#compare(org.eclipse.core.resources.IResource, org.eclipse.team.core.variants.IResourceVariant)
- */
+ @Override
public boolean compare(IResource local, IResourceVariant remote) {
// First, ensure the resources are the same gender
if ((local.getType() == IResource.FILE) == remote.isContainer()) {
@@ -59,18 +57,14 @@ public class ThreeWayResourceComparator implements IResourceVariantComparator {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.IResourceVariantComparator#compare(org.eclipse.team.core.variants.IResourceVariant, org.eclipse.team.core.variants.IResourceVariant)
- */
+ @Override
public boolean compare(IResourceVariant base, IResourceVariant remote) {
byte[] bytes1 = getBytes(base);
byte[] bytes2 = getBytes(remote);
return equals(bytes1, bytes2);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.IResourceVariantComparator#isThreeWay()
- */
+ @Override
public boolean isThreeWay() {
return true;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java
index 82eb1c4a5..bfe55bb88 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java
@@ -59,7 +59,7 @@ public abstract class BackgroundEventHandler {
public static final int RUNNABLE_EVENT = 1000;
// Events that need to be processed
- private List awaitingProcessing = new ArrayList();
+ private List<Event> awaitingProcessing = new ArrayList<>();
// The job that runs when events need to be processed
private Job eventHandlerJob;
@@ -329,14 +329,14 @@ public abstract class BackgroundEventHandler {
if (isShutdown() || isQueueEmpty()) {
return null;
}
- return (Event) awaitingProcessing.remove(0);
+ return awaitingProcessing.remove(0);
}
protected synchronized Event peek() {
if (isShutdown() || isQueueEmpty()) {
return null;
}
- return (Event) awaitingProcessing.get(0);
+ return awaitingProcessing.get(0);
}
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
index 7ea9179b7..fd911f7e9 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultFileModificationValidator.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
@@ -37,6 +37,7 @@ public class DefaultFileModificationValidator extends FileModificationValidator
: Status.OK_STATUS;
}
+ @Override
public IStatus validateEdit(IFile[] files, FileModificationValidationContext context) {
IFile[] readOnlyFiles = getReadOnly(files);
if (readOnlyFiles.length == 0)
@@ -75,16 +76,17 @@ public class DefaultFileModificationValidator extends FileModificationValidator
}
private IFile[] getReadOnly(IFile[] files) {
- List result = new ArrayList(files.length);
+ List<IFile> result = new ArrayList<>(files.length);
for (int i = 0; i < files.length; i++) {
IFile file = files[i];
if (file.isReadOnly()) {
result.add(file);
}
}
- return (IFile[]) result.toArray(new IFile[result.size()]);
+ return result.toArray(new IFile[result.size()]);
}
+ @Override
public IStatus validateSave(IFile file) {
if (!file.isReadOnly())
return Status.OK_STATUS;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java
index 08040ed13..e56522730 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ExceptionCollector.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,7 +25,7 @@ import org.eclipse.core.runtime.*;
*/
public class ExceptionCollector {
- private List statuses = new ArrayList();
+ private List<IStatus> statuses = new ArrayList<>();
private String message;
private String pluginId;
private int severity;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileContentManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileContentManager.java
index 32103b084..b11c740fb 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileContentManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileContentManager.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
@@ -38,11 +38,13 @@ public class FileContentManager implements IFileContentManager {
fType= type;
}
- public String getString() {
+ @Override
+ public String getString() {
return fString;
}
- public int getType() {
+ @Override
+ public int getType() {
return fType;
}
}
@@ -53,8 +55,9 @@ public class FileContentManager implements IFileContentManager {
super(key);
}
- protected Map loadMappingsFromPreferences() {
- final Map result= super.loadMappingsFromPreferences();
+ @Override
+ protected Map<String, Integer> loadMappingsFromPreferences() {
+ final Map<String, Integer> result= super.loadMappingsFromPreferences();
if (loadMappingsFromOldWorkspace(result)) {
TeamPlugin.getPlugin().savePluginPreferences();
}
@@ -70,7 +73,7 @@ public class FileContentManager implements IFileContentManager {
* been added to the map, false otherwise.
*
*/
- private boolean loadMappingsFromOldWorkspace(Map map) {
+ private boolean loadMappingsFromOldWorkspace(Map<String, Integer> map) {
// File name of the persisted file type information
String STATE_FILE = ".fileTypes"; //$NON-NLS-1$
IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation().append(STATE_FILE);
@@ -100,15 +103,15 @@ public class FileContentManager implements IFileContentManager {
* @param input the input stream to read the saved state from
* @throws IOException if an I/O problem occurs
*/
- private Map readOldFormatExtensionMappings(DataInputStream input) throws IOException {
- final Map result= new TreeMap();
+ private Map<String, Integer> readOldFormatExtensionMappings(DataInputStream input) throws IOException {
+ final Map<String, Integer> result= new TreeMap<>();
int numberOfMappings = 0;
try {
numberOfMappings = input.readInt();
} catch (EOFException e) {
// Ignore the exception, it will occur if there are no
// patterns stored in the state file.
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
for (int i = 0; i < numberOfMappings; i++) {
final String extension = input.readUTF();
@@ -129,44 +132,53 @@ public class FileContentManager implements IFileContentManager {
fPluginExtensionMappings= new PluginStringMappings(TeamPlugin.FILE_TYPES_EXTENSION, "extension"); //$NON-NLS-1$
}
- public int getTypeForName(String filename) {
+ @Override
+ public int getTypeForName(String filename) {
final int userType= fUserNameMappings.getType(filename);
// final int pluginType= fPluginNameMappings.getType(filename);
// return userType != Team.UNKNOWN ? userType : pluginType;
return userType;
}
- public int getTypeForExtension(String extension) {
+ @Override
+ public int getTypeForExtension(String extension) {
final int userType= fUserExtensionMappings.getType(extension);
final int pluginType= fPluginExtensionMappings.getType(extension);
return userType != Team.UNKNOWN ? userType : pluginType;
}
- public void addNameMappings(String[] names, int [] types) {
+ @Override
+ public void addNameMappings(String[] names, int [] types) {
fUserNameMappings.addStringMappings(names, types);
}
- public void addExtensionMappings(String[] extensions, int [] types) {
+ @Override
+ public void addExtensionMappings(String[] extensions, int [] types) {
fUserExtensionMappings.addStringMappings(extensions, types);
}
- public void setNameMappings(String[] names, int [] types) {
+ @Override
+ public void setNameMappings(String[] names, int [] types) {
fUserNameMappings.setStringMappings(names, types);
}
- public void setExtensionMappings(String[] extensions, int [] types) {
+ @Override
+ public void setExtensionMappings(String[] extensions, int [] types) {
fUserExtensionMappings.setStringMappings(extensions, types);
}
- public IStringMapping[] getNameMappings() {
+ @Override
+ public IStringMapping[] getNameMappings() {
return getMappings(fUserNameMappings, null);//fPluginNameMappings);
}
- public IStringMapping[] getExtensionMappings() {
+ @Override
+ public IStringMapping[] getExtensionMappings() {
return getMappings(fUserExtensionMappings, fPluginExtensionMappings);
}
- public int getType(IStorage storage) {
+ @Override
+ public int getType(IStorage storage) {
int type;
final String name= storage.getName();
@@ -194,21 +206,25 @@ public class FileContentManager implements IFileContentManager {
return textContentType;
}
- public IStringMapping[] getDefaultNameMappings() {
+ @Override
+ public IStringMapping[] getDefaultNameMappings() {
// TODO: There is currently no extension point for this
return new IStringMapping[0];//getStringMappings(fPluginNameMappings.referenceMap());
}
- public IStringMapping[] getDefaultExtensionMappings() {
+ @Override
+ public IStringMapping[] getDefaultExtensionMappings() {
return getStringMappings(fPluginExtensionMappings.referenceMap());
}
- public boolean isKnownExtension(String extension) {
+ @Override
+ public boolean isKnownExtension(String extension) {
return fUserExtensionMappings.referenceMap().containsKey(extension)
|| fPluginExtensionMappings.referenceMap().containsKey(extension);
}
- public boolean isKnownFilename(String filename) {
+ @Override
+ public boolean isKnownFilename(String filename) {
return fUserNameMappings.referenceMap().containsKey(filename);
// || fPluginNameMappings.referenceMap().containsKey(filename);
}
@@ -235,7 +251,7 @@ public class FileContentManager implements IFileContentManager {
}
private IStringMapping [] getMappings(UserStringMappings userMappings, PluginStringMappings pluginMappings) {
- final Map mappings= new HashMap();
+ final Map<String, Integer> mappings= new HashMap<>();
if (pluginMappings != null)
mappings.putAll(pluginMappings.referenceMap());
mappings.putAll(userMappings.referenceMap());
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java
index 60347be34..71a59a269 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/InfiniteSubProgressMonitor.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
@@ -52,6 +52,7 @@ public class InfiniteSubProgressMonitor extends SubProgressMonitor {
super(monitor, ticks, style);
}
+ @Override
public void beginTask(String name, int totalWork) {
super.beginTask(name, totalWork);
this.totalWork = totalWork;
@@ -61,6 +62,7 @@ public class InfiniteSubProgressMonitor extends SubProgressMonitor {
this.worked = 0;
}
+ @Override
public void worked(int work) {
if (worked >= totalWork) return;
if (--nextProgress <= 0) {
@@ -83,6 +85,7 @@ public class InfiniteSubProgressMonitor extends SubProgressMonitor {
*
* @see IProgressMonitor#subTask(String)
*/
+ @Override
public void subTask(String name) {
if(name != null && ! name.equals("")) { //$NON-NLS-1$
super.subTask(name);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java
index f4e0bd23f..7a8879ff4 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/MoveDeleteManager.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
@@ -38,9 +38,7 @@ public class MoveDeleteManager implements IMoveDeleteHook {
return hook;
}
- /*
- * @see IMoveDeleteHook#deleteFile(IResourceTree, IFile, int, IProgressMonitor)
- */
+ @Override
public boolean deleteFile(
IResourceTree tree,
IFile file,
@@ -50,9 +48,7 @@ public class MoveDeleteManager implements IMoveDeleteHook {
return getHookFor(file).deleteFile(tree, file, updateFlags, monitor);
}
- /*
- * @see IMoveDeleteHook#deleteFolder(IResourceTree, IFolder, int, IProgressMonitor)
- */
+ @Override
public boolean deleteFolder(
IResourceTree tree,
IFolder folder,
@@ -62,9 +58,7 @@ public class MoveDeleteManager implements IMoveDeleteHook {
return getHookFor(folder).deleteFolder(tree, folder, updateFlags, monitor);
}
- /*
- * @see IMoveDeleteHook#deleteProject(IResourceTree, IProject, int, IProgressMonitor)
- */
+ @Override
public boolean deleteProject(
IResourceTree tree,
IProject project,
@@ -74,9 +68,7 @@ public class MoveDeleteManager implements IMoveDeleteHook {
return getHookFor(project).deleteProject(tree, project, updateFlags, monitor);
}
- /*
- * @see IMoveDeleteHook#moveFile(IResourceTree, IFile, IFile, int, IProgressMonitor)
- */
+ @Override
public boolean moveFile(
IResourceTree tree,
IFile source,
@@ -87,9 +79,7 @@ public class MoveDeleteManager implements IMoveDeleteHook {
return getHookFor(source).moveFile(tree, source, destination, updateFlags, monitor);
}
- /*
- * @see IMoveDeleteHook#moveFolder(IResourceTree, IFolder, IFolder, int, IProgressMonitor)
- */
+ @Override
public boolean moveFolder(
IResourceTree tree,
IFolder source,
@@ -100,9 +90,7 @@ public class MoveDeleteManager implements IMoveDeleteHook {
return getHookFor(source).moveFolder(tree, source, destination, updateFlags, monitor);
}
- /*
- * @see IMoveDeleteHook#moveProject(IResourceTree, IProject, IProjectDescription, int, IProgressMonitor)
- */
+ @Override
public boolean moveProject(
IResourceTree tree,
IProject source,
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java
index ef9277282..d2de69f61 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PluginStringMappings.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
@@ -24,7 +24,7 @@ public class PluginStringMappings {
private final String fExtensionID;
private final String fAttributeName;
- private SortedMap fMappings;
+ private SortedMap<String, Integer> fMappings;
public PluginStringMappings(String extensionID, String stringAttributeName) {
fExtensionID= extensionID;
@@ -35,9 +35,9 @@ public class PluginStringMappings {
* Load all the extension patterns contributed by plugins.
* @return a map with the patterns
*/
- private SortedMap loadPluginPatterns() {
+ private SortedMap<String, Integer> loadPluginPatterns() {
- final SortedMap result= new TreeMap();
+ final SortedMap<String, Integer> result= new TreeMap<>();
final TeamPlugin plugin = TeamPlugin.getPlugin();
if (plugin == null)
@@ -69,7 +69,7 @@ public class PluginStringMappings {
return result;
}
- public Map referenceMap() {
+ public Map<String, Integer> referenceMap() {
if (fMappings == null) {
fMappings= loadPluginPatterns();
}
@@ -77,7 +77,7 @@ public class PluginStringMappings {
}
public int getType(String filename) {
- final Map mappings= referenceMap();
- return mappings.containsKey(filename) ? ((Integer)mappings.get(filename)).intValue() : Team.UNKNOWN;
+ final Map<String, Integer> mappings= referenceMap();
+ return mappings.containsKey(filename) ? mappings.get(filename).intValue() : Team.UNKNOWN;
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java
index aad349319..66b4b3ac8 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Policy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 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
@@ -11,7 +11,6 @@
package org.eclipse.team.internal.core;
import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugOptionsListener;
public class Policy {
@@ -23,14 +22,12 @@ public class Policy {
public static boolean DEBUG_BACKGROUND_EVENTS = false;
public static boolean DEBUG_THREADING = false;
- static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = new DebugOptionsListener() {
- public void optionsChanged(DebugOptions options) {
- DEBUG = options.getBooleanOption(TeamPlugin.ID + "/debug", false); //$NON-NLS-1$
- DEBUG_STREAMS = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/streams", false); //$NON-NLS-1$
- DEBUG_REFRESH_JOB = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/refreshjob", false); //$NON-NLS-1$
- DEBUG_BACKGROUND_EVENTS = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/backgroundevents", false); //$NON-NLS-1$
- DEBUG_THREADING = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/threading", false); //$NON-NLS-1$
- }
+ static final DebugOptionsListener DEBUG_OPTIONS_LISTENER = options -> {
+ DEBUG = options.getBooleanOption(TeamPlugin.ID + "/debug", false); //$NON-NLS-1$
+ DEBUG_STREAMS = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/streams", false); //$NON-NLS-1$
+ DEBUG_REFRESH_JOB = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/refreshjob", false); //$NON-NLS-1$
+ DEBUG_BACKGROUND_EVENTS = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/backgroundevents", false); //$NON-NLS-1$
+ DEBUG_THREADING = DEBUG && options.getBooleanOption(TeamPlugin.ID + "/threading", false); //$NON-NLS-1$
};
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java
index 05cc63aed..4dd0f75d0 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/RepositoryProviderManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
@@ -17,7 +17,7 @@ import org.eclipse.team.core.RepositoryProvider;
public class RepositoryProviderManager implements IRepositoryProviderListener {
private static RepositoryProviderManager instance;
- private ListenerList listeners = new ListenerList();
+ private ListenerList<IRepositoryProviderListener> listeners = new ListenerList<>();
public static synchronized RepositoryProviderManager getInstance() {
if (instance == null) {
@@ -26,9 +26,7 @@ public class RepositoryProviderManager implements IRepositoryProviderListener {
return instance;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.IRepositoryProviderListener#providerMapped(org.eclipse.team.core.RepositoryProvider)
- */
+ @Override
public void providerMapped(RepositoryProvider provider) {
Object[] allListeners = listeners.getListeners();
for (int i = 0; i < allListeners.length; i++) {
@@ -37,9 +35,7 @@ public class RepositoryProviderManager implements IRepositoryProviderListener {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.IRepositoryProviderListener#providerUnmapped(org.eclipse.core.resources.IProject)
- */
+ @Override
public void providerUnmapped(IProject project) {
Object[] allListeners = listeners.getListeners();
for (int i = 0; i < allListeners.length; i++) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
index 5a3827a36..ea6b7bda6 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/ResourceVariantCache.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
@@ -31,10 +31,10 @@ public class ResourceVariantCache {
private static final long CACHE_FILE_LIFESPAN = 60*60*1000; // 1hr
// Map of registered caches indexed by local name of a QualifiedName
- private static Map caches = new HashMap(); // String (local name) > RemoteContentsCache
+ private static Map<String, ResourceVariantCache> caches = new HashMap<>(); // String (local name) > RemoteContentsCache
private String name;
- private Map cacheEntries;
+ private Map<String, ResourceVariantCacheEntry> cacheEntries;
private long lastCacheCleanup;
private int cacheDirSize;
@@ -87,11 +87,11 @@ public class ResourceVariantCache {
* @return the cache
*/
public static synchronized ResourceVariantCache getCache(String cacheId) {
- return (ResourceVariantCache)caches.get(cacheId);
+ return caches.get(cacheId);
}
public static synchronized void shutdown() {
- String[] keys = (String[])caches.keySet().toArray(new String[caches.size()]);
+ String[] keys = caches.keySet().toArray(new String[caches.size()]);
for (int i = 0; i < keys.length; i++) {
String id = keys[i];
disableCache(id);
@@ -122,7 +122,7 @@ public class ResourceVariantCache {
private synchronized void clearOldCacheEntries() {
long current = new Date().getTime();
if ((lastCacheCleanup!=-1) && (current - lastCacheCleanup < CACHE_FILE_LIFESPAN)) return;
- List stale = new ArrayList();
+ List<ResourceVariantCacheEntry> stale = new ArrayList<>();
for (Iterator iter = cacheEntries.values().iterator(); iter.hasNext();) {
ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry) iter.next();
long lastHit = entry.getLastAccessTimeStamp();
@@ -130,14 +130,13 @@ public class ResourceVariantCache {
stale.add(entry);
}
}
- for (Iterator iter = stale.iterator(); iter.hasNext();) {
- ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry) iter.next();
+ for (ResourceVariantCacheEntry entry : stale) {
entry.dispose();
}
}
private synchronized void purgeFromCache(String id) {
- ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry)cacheEntries.get(id);
+ ResourceVariantCacheEntry entry = cacheEntries.get(id);
File f = entry.getFile();
try {
deleteFile(f);
@@ -164,7 +163,7 @@ public class ResourceVariantCache {
if (! file.exists() && ! file.mkdirs()) {
TeamPlugin.log(new TeamException(NLS.bind(Messages.RemoteContentsCache_fileError, new String[] { file.getAbsolutePath() })));
}
- cacheEntries = new HashMap();
+ cacheEntries = new HashMap<>();
lastCacheCleanup = -1;
cacheDirSize = 0;
}
@@ -211,7 +210,7 @@ public class ResourceVariantCache {
// This probably means that the cache has been disposed
throw new IllegalStateException(NLS.bind(Messages.RemoteContentsCache_cacheDisposed, new String[] { name }));
}
- ResourceVariantCacheEntry entry = (ResourceVariantCacheEntry)cacheEntries.get(id);
+ ResourceVariantCacheEntry entry = cacheEntries.get(id);
if (entry != null) {
entry.registerHit();
}
@@ -243,7 +242,7 @@ public class ResourceVariantCache {
* Method used for testing only
*/
public ResourceVariantCacheEntry[] getEntries() {
- return (ResourceVariantCacheEntry[]) cacheEntries.values().toArray(new ResourceVariantCacheEntry[cacheEntries.size()]);
+ return cacheEntries.values().toArray(new ResourceVariantCacheEntry[cacheEntries.size()]);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.java
index 00adffb41..caf175a45 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StorageMergerRegistry.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
@@ -32,9 +32,9 @@ public class StorageMergerRegistry {
private static StorageMergerRegistry instance;
- private HashMap fIdMap; // maps ids to datas
- private HashMap fExtensionMap; // maps extensions to datas
- private HashMap fContentTypeBindings; // maps content type bindings to datas
+ private HashMap<String, Object> fIdMap; // maps ids to datas
+ private HashMap<String, Object> fExtensionMap; // maps extensions to datas
+ private HashMap<IContentType, Object> fContentTypeBindings; // maps content type bindings to datas
private boolean fRegistriesInitialized;
public static StorageMergerRegistry getInstance() {
@@ -109,14 +109,14 @@ public class StorageMergerRegistry {
String id = element.getAttribute(ID_ATTRIBUTE);
if (id != null) {
if (fIdMap == null)
- fIdMap = new HashMap();
+ fIdMap = new HashMap<>();
fIdMap.put(id, data);
}
String types = element.getAttribute(EXTENSIONS_ATTRIBUTE);
if (types != null) {
if (fExtensionMap == null)
- fExtensionMap = new HashMap();
+ fExtensionMap = new HashMap<>();
StringTokenizer tokenizer = new StringTokenizer(types, ","); //$NON-NLS-1$
while (tokenizer.hasMoreElements()) {
String extension = tokenizer.nextToken().trim();
@@ -136,7 +136,7 @@ public class StorageMergerRegistry {
IContentType ct = Platform.getContentTypeManager().getContentType(type);
if (ct != null) {
if (fContentTypeBindings == null)
- fContentTypeBindings = new HashMap();
+ fContentTypeBindings = new HashMap<>();
fContentTypeBindings.put(ct, o);
} else {
logErrorMessage(NLS.bind("Content type id '{0}' not found", type)); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java
index 7fd92a786..ad683e742 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/StringMatcher.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
@@ -257,7 +257,7 @@ public class StringMatcher {
}
}
- Vector temp = new Vector();
+ Vector<String> temp = new Vector<>();
int pos = 0;
StringBuffer buf = new StringBuffer();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java
index bb071633b..96c8aae58 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamHookDispatcher.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
@@ -40,9 +40,7 @@ public class TeamHookDispatcher extends TeamHook {
instance = this;
}
- /**
- * @see org.eclipse.core.resources.team.TeamHook#validateCreateLink(org.eclipse.core.resources.IFile, int, org.eclipse.core.runtime.IPath)
- */
+ @Override
public IStatus validateCreateLink(IFile file, int updateFlags, IPath location) {
RepositoryProvider provider = getProvider(file);
if (provider == null) {
@@ -52,9 +50,7 @@ public class TeamHookDispatcher extends TeamHook {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.team.TeamHook#validateCreateLink(org.eclipse.core.resources.IFile, int, java.net.URI)
- */
+ @Override
public IStatus validateCreateLink(IFile file, int updateFlags, URI location) {
RepositoryProvider provider = getProvider(file);
if (provider == null) {
@@ -64,9 +60,7 @@ public class TeamHookDispatcher extends TeamHook {
}
}
- /**
- * @see org.eclipse.core.resources.team.TeamHook#validateCreateLink(org.eclipse.core.resources.IFolder, int, org.eclipse.core.runtime.IPath)
- */
+ @Override
public IStatus validateCreateLink(IFolder folder, int updateFlags, IPath location) {
RepositoryProvider provider = getProvider(folder);
if (provider == null) {
@@ -76,9 +70,7 @@ public class TeamHookDispatcher extends TeamHook {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.team.TeamHook#validateCreateLink(org.eclipse.core.resources.IFolder, int, java.net.URI)
- */
+ @Override
public IStatus validateCreateLink(IFolder folder, int updateFlags, URI location) {
RepositoryProvider provider = getProvider(folder);
if (provider == null) {
@@ -97,9 +89,7 @@ public class TeamHookDispatcher extends TeamHook {
return RepositoryProvider.getProvider(resource.getProject());
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.team.TeamHook#getRuleFactory(org.eclipse.core.resources.IProject)
- */
+ @Override
public IResourceRuleFactory getRuleFactory(IProject project) {
if (RepositoryProvider.isShared(project)) {
RepositoryProvider provider = getProvider(project);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java
index 8d312ba0e..61ed6013d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/UserStringMappings.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
@@ -31,7 +31,7 @@ public class UserStringMappings implements Preferences.IPropertyChangeListener {
private final Preferences fPreferences;
private final String fKey;
- private Map fMap;
+ private Map<String, Integer> fMap;
public UserStringMappings(String key) {
fKey= key;
@@ -39,7 +39,7 @@ public class UserStringMappings implements Preferences.IPropertyChangeListener {
fPreferences.addPropertyChangeListener(this);
}
- public Map referenceMap() {
+ public Map<String, Integer> referenceMap() {
if (fMap == null) {
fMap= loadMappingsFromPreferences();
}
@@ -48,7 +48,7 @@ public class UserStringMappings implements Preferences.IPropertyChangeListener {
public void addStringMappings(String[] names, int[] types) {
Assert.isTrue(names.length == types.length);
- final Map map= referenceMap();
+ final Map<String, Integer> map= referenceMap();
for (int i = 0; i < names.length; i++) {
switch (types[i]) {
@@ -69,11 +69,12 @@ public class UserStringMappings implements Preferences.IPropertyChangeListener {
public int getType(String string) {
if (string == null)
return Team.UNKNOWN;
- final Integer type= (Integer)referenceMap().get(string);
+ final Integer type= referenceMap().get(string);
return type != null ? type.intValue() : Team.UNKNOWN;
}
- public void propertyChange(PropertyChangeEvent event) {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
if(event.getProperty().equals(fKey))
fMap= null;
}
@@ -87,15 +88,15 @@ public class UserStringMappings implements Preferences.IPropertyChangeListener {
final String filename = (String)e.next();
buffer.append(filename);
buffer.append(PREF_TEAM_SEPARATOR);
- final Integer type = (Integer)fMap.get(filename);
+ final Integer type = fMap.get(filename);
buffer.append(type);
buffer.append(PREF_TEAM_SEPARATOR);
}
TeamPlugin.getPlugin().getPluginPreferences().setValue(fKey, buffer.toString());
}
- protected Map loadMappingsFromPreferences() {
- final Map result= new HashMap();
+ protected Map<String, Integer> loadMappingsFromPreferences() {
+ final Map<String, Integer> result= new HashMap<>();
if (!fPreferences.contains(fKey))
return result;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.java
index be2f171a3..0c6c80944 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileHistory.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
@@ -36,9 +36,7 @@ public class LocalFileHistory extends FileHistory {
this.includeCurrent = includeCurrent;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileHistory#getContributors(org.eclipse.team.core.history.IFileRevision)
- */
+ @Override
public IFileRevision[] getContributors(IFileRevision revision) {
IFileRevision[] revisions = getFileRevisions();
@@ -63,9 +61,7 @@ public class LocalFileHistory extends FileHistory {
return new IFileRevision[] {fileRevision};
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileHistory#getFileRevision(java.lang.String)
- */
+ @Override
public IFileRevision getFileRevision(String id) {
if (revisions != null) {
for (int i = 0; i < revisions.length; i++) {
@@ -78,28 +74,24 @@ public class LocalFileHistory extends FileHistory {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileHistory#getFileRevisions()
- */
+ @Override
public IFileRevision[] getFileRevisions() {
if (revisions == null)
return new IFileRevision[0];
return revisions;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileHistory#getTargets(org.eclipse.team.core.history.IFileRevision)
- */
+ @Override
public IFileRevision[] getTargets(IFileRevision revision) {
IFileRevision[] revisions = getFileRevisions();
- ArrayList directDescendents = new ArrayList();
+ ArrayList<IFileRevision> directDescendents = new ArrayList<>();
for (int i = 0; i < revisions.length; i++) {
if (((LocalFileRevision) revisions[i]).isDescendentOf(revision)) {
directDescendents.add(revisions[i]);
}
}
- return (IFileRevision[]) directDescendents.toArray(new IFileRevision[directDescendents.size()]);
+ return directDescendents.toArray(new IFileRevision[directDescendents.size()]);
}
/**
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;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java
index 78a41ce4a..2621578fd 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/CRLFtoLFInputStream.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
@@ -41,6 +41,7 @@ public class CRLFtoLFInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read() throws IOException {
if (! pendingByte) {
lastByte = in.read(); // ok if this throws
@@ -64,6 +65,7 @@ public class CRLFtoLFInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred may be non-zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read(byte[] buffer, int off, int len) throws IOException {
// handle boundary cases cleanly
if (len == 0) {
@@ -125,6 +127,7 @@ public class CRLFtoLFInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred may be non-zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public long skip(long count) throws IOException {
int actualCount = 0; // assumes count < Integer.MAX_INT
try {
@@ -142,6 +145,7 @@ public class CRLFtoLFInputStream extends FilterInputStream {
* possible translation of CR/LF sequences to LFs in these bytes.
* @throws IOException if an i/o error occurs
*/
+ @Override
public int available() throws IOException {
return in.available() / 2; // we can guarantee at least this amount after contraction
}
@@ -149,6 +153,7 @@ public class CRLFtoLFInputStream extends FilterInputStream {
/**
* Mark is not supported by the wrapper even if the underlying stream does, returns false.
*/
+ @Override
public boolean markSupported() {
return false;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java
index c005ab6f1..20c608db0 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/LFtoCRLFInputStream.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
@@ -40,6 +40,7 @@ public class LFtoCRLFInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read() throws IOException {
if (mustReturnLF) {
mustReturnLF = false;
@@ -60,6 +61,7 @@ public class LFtoCRLFInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred may be non-zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read(byte[] buffer, int off, int len) throws IOException {
// handle boundary cases cleanly
if (len == 0) {
@@ -116,6 +118,7 @@ public class LFtoCRLFInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred may be non-zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public long skip(long count) throws IOException {
int actualCount = 0; // assumes count < Integer.MAX_INT
try {
@@ -133,6 +136,7 @@ public class LFtoCRLFInputStream extends FilterInputStream {
* possible translation of LFs to CR/LF sequences in these bytes.
* @throws IOException if an i/o error occurs
*/
+ @Override
public int available() throws IOException {
return in.available(); // we can guarantee at least this amount after expansion
}
@@ -140,6 +144,7 @@ public class LFtoCRLFInputStream extends FilterInputStream {
/**
* Mark is not supported by the wrapper even if the underlying stream does, returns false.
*/
+ @Override
public boolean markSupported() {
return false;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java
index b85f0e6bc..f612fc49d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingInputStream.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 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
@@ -59,6 +59,7 @@ public class PollingInputStream extends FilterInputStream {
* @throws OperationCanceledException if the progress monitor is canceled
* @throws InterruptedIOException if the underlying operation times out numAttempts times
*/
+ @Override
public void close() throws InterruptedIOException {
int attempts = 0;
try {
@@ -94,6 +95,7 @@ public class PollingInputStream extends FilterInputStream {
* and no data was received, bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read() throws IOException {
int attempts = 0;
for (;;) {
@@ -119,6 +121,7 @@ public class PollingInputStream extends FilterInputStream {
* and no data was received, bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read(byte[] buffer, int off, int len) throws IOException {
int attempts = 0;
for (;;) {
@@ -143,6 +146,7 @@ public class PollingInputStream extends FilterInputStream {
* and no data was received, bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public long skip(long count) throws IOException {
int attempts = 0;
for (;;) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java
index df12be8f9..3ad9d061b 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/PollingOutputStream.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 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
@@ -55,6 +55,7 @@ public class PollingOutputStream extends FilterOutputStream {
* and no data was sent, bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public void write(int b) throws IOException {
int attempts = 0;
for (;;) {
@@ -77,6 +78,7 @@ public class PollingOutputStream extends FilterOutputStream {
* bytesTransferred will reflect the number of bytes sent
* @throws IOException if an i/o error occurs
*/
+ @Override
public void write(byte[] buffer, int off, int len) throws IOException {
int count = 0;
int attempts = 0;
@@ -111,6 +113,7 @@ public class PollingOutputStream extends FilterOutputStream {
* bytesTransferred will reflect the number of bytes sent
* @throws IOException if an i/o error occurs
*/
+ @Override
public void flush() throws IOException {
int count = 0;
int attempts = 0;
@@ -142,6 +145,7 @@ public class PollingOutputStream extends FilterOutputStream {
* bytesTransferred will reflect the number of bytes sent during the flush()
* @throws IOException if an i/o error occurs
*/
+ @Override
public void close() throws IOException {
int attempts = numAttempts - 1; // fail fast if flush() does times out
try {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java
index b15cf7926..d4a85fc0d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/ProgressMonitorInputStream.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
@@ -55,6 +55,7 @@ public abstract class ProgressMonitorInputStream extends FilterInputStream {
* Updates the progress monitor to the final number of bytes read.
* @throws IOException if an i/o error occurs
*/
+ @Override
public void close() throws IOException {
try {
in.close();
@@ -70,6 +71,7 @@ public abstract class ProgressMonitorInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read() throws IOException {
int b = in.read();
if (b != -1) {
@@ -86,6 +88,7 @@ public abstract class ProgressMonitorInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred may be non-zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read(byte[] buffer, int offset, int length) throws IOException {
try {
int count = in.read(buffer, offset, length);
@@ -108,6 +111,7 @@ public abstract class ProgressMonitorInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred may be non-zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public long skip(long amount) throws IOException {
try {
long count = in.skip(amount);
@@ -124,6 +128,7 @@ public abstract class ProgressMonitorInputStream extends FilterInputStream {
/**
* Mark is not supported by the wrapper even if the underlying stream does, returns false.
*/
+ @Override
public boolean markSupported() {
return false;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java
index a225c255f..7919f8208 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/SizeConstrainedInputStream.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 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
@@ -49,6 +49,7 @@ public class SizeConstrainedInputStream extends FilterInputStream {
* If discardOnClose, skip()'s over any remaining unread bytes in the constrained region.
* @throws IOException if an i/o error occurs
*/
+ @Override
public void close() throws IOException {
try {
if (discardOnClose) {
@@ -68,6 +69,7 @@ public class SizeConstrainedInputStream extends FilterInputStream {
* Simulates an end-of-file condition if the end of the constrained region has been reached.
* @throws IOException if an i/o error occurs
*/
+ @Override
public int available() throws IOException {
int amount = in.available();
if (amount > bytesRemaining) amount = (int) bytesRemaining;
@@ -81,6 +83,7 @@ public class SizeConstrainedInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read() throws IOException {
if (bytesRemaining == 0) return -1;
int b = in.read();
@@ -95,6 +98,7 @@ public class SizeConstrainedInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred may be non-zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public int read(byte[] buffer, int offset, int length) throws IOException {
if (length > bytesRemaining) {
if (bytesRemaining == 0) return -1;
@@ -117,6 +121,7 @@ public class SizeConstrainedInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred may be non-zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public long skip(long amount) throws IOException {
if (amount > bytesRemaining) amount = bytesRemaining;
try {
@@ -132,6 +137,7 @@ public class SizeConstrainedInputStream extends FilterInputStream {
/**
* Mark is not supported by the wrapper even if the underlying stream does, returns false.
*/
+ @Override
public boolean markSupported() {
return false;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
index 1d7858f89..66961a544 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.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
@@ -61,6 +61,7 @@ public class TimeoutInputStream extends FilterInputStream {
this.closeTimeout = closeTimeout;
this.iobuffer = new byte[bufferSize];
thread = new Thread(new Runnable() {
+ @Override
public void run() {
runThread();
}
@@ -83,6 +84,7 @@ public class TimeoutInputStream extends FilterInputStream {
* @throws InterruptedIOException if the timeout expired
* @throws IOException if an i/o error occurs
*/
+ @Override
public void close() throws IOException {
Thread oldThread;
synchronized (this) {
@@ -108,6 +110,7 @@ public class TimeoutInputStream extends FilterInputStream {
* Returns the number of unread bytes in the buffer.
* @throws IOException if an i/o error occurs
*/
+ @Override
public synchronized int available() throws IOException {
if (length == 0) checkError();
return length > 0 ? length : 0;
@@ -119,6 +122,7 @@ public class TimeoutInputStream extends FilterInputStream {
* bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public synchronized int read() throws IOException {
if (! syncFill()) return -1; // EOF reached
int b = iobuffer[head++] & 255;
@@ -134,6 +138,7 @@ public class TimeoutInputStream extends FilterInputStream {
* bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public synchronized int read(byte[] buffer, int off, int len) throws IOException {
if (! syncFill()) return -1; // EOF reached
int pos = off;
@@ -153,6 +158,7 @@ public class TimeoutInputStream extends FilterInputStream {
* bytes specified have been skipped, bytesTransferred may be non-zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public synchronized long skip(long count) throws IOException {
long amount = 0;
try {
@@ -174,6 +180,7 @@ public class TimeoutInputStream extends FilterInputStream {
/**
* Mark is not supported by the wrapper even if the underlying stream does, returns false.
*/
+ @Override
public boolean markSupported() {
return false;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java
index 7ed2a4bb5..deaa22a47 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.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
@@ -61,11 +61,7 @@ public class TimeoutOutputStream extends FilterOutputStream {
this.writeTimeout = writeTimeout;
this.closeTimeout = closeTimeout;
this.iobuffer = new byte[bufferSize];
- thread = new Thread(new Runnable() {
- public void run() {
- runThread();
- }
- }, "TimeoutOutputStream");//$NON-NLS-1$
+ thread = new Thread((Runnable) () -> runThread(), "TimeoutOutputStream");//$NON-NLS-1$
thread.setDaemon(true);
thread.start();
}
@@ -80,6 +76,7 @@ public class TimeoutOutputStream extends FilterOutputStream {
* reflect the number of bytes flushed from the buffer
* @throws IOException if an i/o error occurs
*/
+ @Override
public void close() throws IOException {
Thread oldThread;
synchronized (this) {
@@ -107,6 +104,7 @@ public class TimeoutOutputStream extends FilterOutputStream {
* bytesTransferred will be zero
* @throws IOException if an i/o error occurs
*/
+ @Override
public synchronized void write(int b) throws IOException {
syncCommit(true);
iobuffer[(head + length) % iobuffer.length] = (byte) b;
@@ -120,6 +118,7 @@ public class TimeoutOutputStream extends FilterOutputStream {
* reflect the number of bytes sent
* @throws IOException if an i/o error occurs
*/
+ @Override
public synchronized void write(byte[] buffer, int off, int len) throws IOException {
int amount = 0;
try {
@@ -144,6 +143,7 @@ public class TimeoutOutputStream extends FilterOutputStream {
* reflect the number of bytes flushed from the buffer
* @throws IOException if an i/o error occurs
*/
+ @Override
public synchronized void flush() throws IOException {
int oldLength = length;
flushRequested = true;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java
index c1ee04158..1c2c59439 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/AbstractSynchronizationScope.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
@@ -26,13 +26,11 @@ import org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener;
*/
public abstract class AbstractSynchronizationScope implements ISynchronizationScope {
- private ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
+ private ListenerList<ISynchronizationScopeChangeListener> listeners = new ListenerList<>(ListenerList.IDENTITY);
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.ISynchronizationScope#getRoots()
- */
+ @Override
public IResource[] getRoots() {
- List result = new ArrayList();
+ List<IResource> result = new ArrayList<>();
ResourceTraversal[] traversals = getTraversals();
for (int i = 0; i < traversals.length; i++) {
ResourceTraversal traversal = traversals[i];
@@ -42,12 +40,10 @@ public abstract class AbstractSynchronizationScope implements ISynchronizationSc
accumulateRoots(result, resource);
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.ISynchronizationScope#contains(org.eclipse.core.resources.IResource)
- */
+ @Override
public boolean contains(IResource resource) {
ResourceTraversal[] traversals = getTraversals();
for (int i = 0; i < traversals.length; i++) {
@@ -62,7 +58,7 @@ public abstract class AbstractSynchronizationScope implements ISynchronizationSc
* Add the resource to the list if it isn't there already
* or is not a child of an existing resource.
*/
- private void accumulateRoots(List roots, IResource resource) {
+ private void accumulateRoots(List<IResource> roots, IResource resource) {
IPath resourcePath = resource.getFullPath();
for (Iterator iter = roots.iterator(); iter.hasNext();) {
IResource root = (IResource) iter.next();
@@ -88,9 +84,11 @@ public abstract class AbstractSynchronizationScope implements ISynchronizationSc
for (int i = 0; i < allListeners.length; i++) {
final Object listener = allListeners[i];
SafeRunner.run(new ISafeRunnable() {
+ @Override
public void run() throws Exception {
((ISynchronizationScopeChangeListener)listener).scopeChanged(AbstractSynchronizationScope.this, newMappings, newTraversals);
}
+ @Override
public void handleException(Throwable exception) {
// Logged by Platform
}
@@ -98,16 +96,12 @@ public abstract class AbstractSynchronizationScope implements ISynchronizationSc
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.ISynchronizationScope#addPropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener)
- */
+ @Override
public void addScopeChangeListener(ISynchronizationScopeChangeListener listener) {
listeners.add(listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.ISynchronizationScope#removePropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener)
- */
+ @Override
public void removeScopeChangeListener(ISynchronizationScopeChangeListener listener) {
listeners.remove(listener);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.java
index 3daba8f6a..58bbfc258 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSet.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
@@ -71,7 +71,8 @@ public class ActiveChangeSet extends DiffChangeSet {
* as never been set, the title is returned as the comment
* @return the comment to be used when the set is committed
*/
- public String getComment() {
+ @Override
+ public String getComment() {
if (comment == null) {
return getTitle();
}
@@ -96,7 +97,8 @@ public class ActiveChangeSet extends DiffChangeSet {
/*
* Override inherited method to only include outgoing changes
*/
- protected boolean isValidChange(IDiff diff) {
+ @Override
+ protected boolean isValidChange(IDiff diff) {
return getManager().isModified(diff);
}
@@ -195,7 +197,7 @@ public class ActiveChangeSet extends DiffChangeSet {
* @throws CoreException
*/
public void add(IResource[] resources) throws CoreException {
- List toAdd = new ArrayList();
+ List<IDiff> toAdd = new ArrayList<>();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
IDiff diff = getManager().getDiff(resource);
@@ -204,7 +206,7 @@ public class ActiveChangeSet extends DiffChangeSet {
}
}
if (!toAdd.isEmpty()) {
- add((IDiff[]) toAdd.toArray(new IDiff[toAdd.size()]));
+ add(toAdd.toArray(new IDiff[toAdd.size()]));
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java
index 17a7584e4..deb6c8139 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java
@@ -145,7 +145,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
* @throws CoreException
*/
public ActiveChangeSet createSet(String title, IFile[] files) throws CoreException {
- List infos = new ArrayList();
+ List<IDiff> infos = new ArrayList<>();
for (int i = 0; i < files.length; i++) {
IFile file = files[i];
IDiff diff = getDiff(file);
@@ -153,7 +153,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
infos.add(diff);
}
}
- return createSet(title, (IDiff[]) infos.toArray(new IDiff[infos.size()]));
+ return createSet(title, infos.toArray(new IDiff[infos.size()]));
}
/**
@@ -196,7 +196,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
}
private IPath[] getAllResources(IDiffChangeEvent event) {
- Set allResources = new HashSet();
+ Set<IPath> allResources = new HashSet<>();
IDiff[] addedResources = event.getAdditions();
for (int i = 0; i < addedResources.length; i++) {
IDiff diff = addedResources[i];
@@ -212,7 +212,7 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
IPath path = removals[i];
allResources.add(path);
}
- return (IPath[]) allResources.toArray(new IPath[allResources.size()]);
+ return allResources.toArray(new IPath[allResources.size()]);
}
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
index 0fcf72138..b4793ab7a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 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
@@ -34,18 +34,20 @@ import org.eclipse.team.internal.core.*;
public class BatchingLock {
// This is a placeholder rule used to indicate that no scheduling rule is needed
/* internal use only */ static final ISchedulingRule NULL_SCHEDULING_RULE= new ISchedulingRule() {
+ @Override
public boolean contains(ISchedulingRule rule) {
return false;
}
+ @Override
public boolean isConflicting(ISchedulingRule rule) {
return false;
}
};
public class ThreadInfo {
- private Set changedResources = new HashSet();
+ private Set<IResource> changedResources = new HashSet<>();
private IFlushOperation operation;
- private List rules = new ArrayList();
+ private List<ISchedulingRule> rules = new ArrayList<>();
public ThreadInfo(IFlushOperation operation) {
this.operation = operation;
}
@@ -127,7 +129,7 @@ public class BatchingLock {
} else if (resourceRule instanceof MultiRule) {
// Create a MultiRule for all projects from the given rule
ISchedulingRule[] rules = ((MultiRule)resourceRule).getChildren();
- Set projects = new HashSet();
+ Set<ISchedulingRule> projects = new HashSet<>();
for (int i = 0; i < rules.length; i++) {
ISchedulingRule childRule = rules[i];
if (childRule instanceof IResource) {
@@ -137,9 +139,9 @@ public class BatchingLock {
if (projects.isEmpty()) {
rule = NULL_SCHEDULING_RULE;
} else if (projects.size() == 1) {
- rule = (ISchedulingRule)projects.iterator().next();
+ rule = projects.iterator().next();
} else {
- rule = new MultiRule((ISchedulingRule[]) projects.toArray(new ISchedulingRule[projects.size()]));
+ rule = new MultiRule(projects.toArray(new ISchedulingRule[projects.size()]));
}
} else {
// Rule is not associated with resources so ignore it
@@ -163,7 +165,7 @@ public class BatchingLock {
return changedResources.isEmpty();
}
public IResource[] getChangedResources() {
- return (IResource[]) changedResources.toArray(new IResource[changedResources.size()]);
+ return changedResources.toArray(new IResource[changedResources.size()]);
}
public void flush(IProgressMonitor monitor) throws TeamException {
try {
@@ -190,7 +192,7 @@ public class BatchingLock {
*/
private boolean remainingRulesAreNull() {
for (int i = 0; i < rules.size() - 1; i++) {
- ISchedulingRule rule = (ISchedulingRule) rules.get(i);
+ ISchedulingRule rule = rules.get(i);
if (rule != NULL_SCHEDULING_RULE) {
return false;
}
@@ -204,7 +206,7 @@ public class BatchingLock {
rules.add(rule);
}
private ISchedulingRule removeRule() {
- return (ISchedulingRule)rules.remove(rules.size() - 1);
+ return rules.remove(rules.size() - 1);
}
public boolean ruleContains(IResource resource) {
for (Iterator iter = rules.iterator(); iter.hasNext();) {
@@ -221,7 +223,7 @@ public class BatchingLock {
public void flush(ThreadInfo info, IProgressMonitor monitor) throws TeamException;
}
- private Map infos = new HashMap();
+ private Map<Thread, ThreadInfo> infos = new HashMap<>();
/**
* Return the thread info for the current thread
@@ -230,7 +232,7 @@ public class BatchingLock {
protected ThreadInfo getThreadInfo() {
Thread thisThread = Thread.currentThread();
synchronized (infos) {
- ThreadInfo info = (ThreadInfo)infos.get(thisThread);
+ ThreadInfo info = infos.get(thisThread);
return info;
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java
index 7f99fcf4e..fb0337dd1 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 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
@@ -37,6 +37,7 @@ public class ContentComparator extends AbstractContentComparator{
* second input to contents compare
* @return <code>true</code> if content is equal
*/
+ @Override
protected boolean contentsEqual(IProgressMonitor monitor, InputStream is1,
InputStream is2, boolean ignoreWhitespace) {
try {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparisonDiffFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparisonDiffFilter.java
index 236e4435c..a838f89b0 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparisonDiffFilter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ContentComparisonDiffFilter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 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
@@ -52,6 +52,7 @@ public class ContentComparisonDiffFilter extends DiffFilter {
return criteria.compare(local, remote, monitor);
}
+ @Override
public boolean select(IDiff diff, IProgressMonitor monitor) {
IFileRevision remote = SyncInfoToDiffConverter.getRemote(diff);
IResource local = ResourceDiffTree.getResourceFor(diff);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java
index 9645ac22b..aeeab75e1 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DescendantResourceVariantByteStore.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 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
@@ -50,13 +50,12 @@ public abstract class DescendantResourceVariantByteStore extends ResourceVariant
* This method will dispose the remote cache but not the base cache.
* @see org.eclipse.team.core.variants.ResourceVariantByteStore#dispose()
*/
+ @Override
public void dispose() {
remoteStore.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#getBytes(org.eclipse.core.resources.IResource)
- */
+ @Override
public byte[] getBytes(IResource resource) throws TeamException {
byte[] remoteBytes = remoteStore.getBytes(resource);
byte[] baseBytes = baseStore.getBytes(resource);
@@ -84,9 +83,7 @@ public abstract class DescendantResourceVariantByteStore extends ResourceVariant
return baseBytes;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#setBytes(org.eclipse.core.resources.IResource, byte[])
- */
+ @Override
public boolean setBytes(IResource resource, byte[] bytes) throws TeamException {
byte[] baseBytes = baseStore.getBytes(resource);
if (baseBytes != null && equals(baseBytes, bytes)) {
@@ -97,9 +94,7 @@ public abstract class DescendantResourceVariantByteStore extends ResourceVariant
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#removeBytes(org.eclipse.core.resources.IResource, int)
- */
+ @Override
public boolean flushBytes(IResource resource, int depth) throws TeamException {
return remoteStore.flushBytes(resource, depth);
}
@@ -130,9 +125,7 @@ public abstract class DescendantResourceVariantByteStore extends ResourceVariant
*/
protected abstract boolean isDescendant(IResource resource, byte[] baseBytes, byte[] remoteBytes) throws TeamException;
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#setVariantDoesNotExist(org.eclipse.core.resources.IResource)
- */
+ @Override
public boolean deleteBytes(IResource resource) throws TeamException {
return remoteStore.deleteBytes(resource);
}
@@ -154,13 +147,11 @@ public abstract class DescendantResourceVariantByteStore extends ResourceVariant
return remoteStore;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.ResourceVariantByteStore#members(org.eclipse.core.resources.IResource)
- */
+ @Override
public IResource[] members(IResource resource) throws TeamException {
IResource[] remoteMembers = getRemoteStore().members(resource);
IResource[] baseMembers = getBaseStore().members(resource);
- Set members = new HashSet();
+ Set<IResource> members = new HashSet<>();
for (int i = 0; i < remoteMembers.length; i++) {
members.add(remoteMembers[i]);
}
@@ -172,12 +163,10 @@ public abstract class DescendantResourceVariantByteStore extends ResourceVariant
members.add(member);
}
}
- return (IResource[]) members.toArray(new IResource[members.size()]);
+ return members.toArray(new IResource[members.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#run(org.eclipse.core.resources.IResource, org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void run(IResource root, IWorkspaceRunnable runnable, IProgressMonitor monitor) throws TeamException {
remoteStore.run(root, runnable, monitor);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java
index 3be397a49..c193f3bf6 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/RootResourceSynchronizationScope.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
@@ -29,6 +29,7 @@ public class RootResourceSynchronizationScope extends AbstractResourceMappingSco
this.roots = roots;
}
+ @Override
public ResourceTraversal[] getTraversals() {
return new ResourceTraversal[] {new ResourceTraversal(roots, IResource.DEPTH_INFINITE, IResource.NONE)};
}
@@ -43,26 +44,30 @@ public class RootResourceSynchronizationScope extends AbstractResourceMappingSco
fireTraversalsChangedEvent(getTraversals(), getMappings());
}
+ @Override
public ResourceMapping[] getInputMappings() {
return getMappings();
}
+ @Override
public ISynchronizationScope asInputScope() {
return this;
}
+ @Override
public ResourceMapping[] getMappings() {
- List result = new ArrayList();
+ List<ResourceMapping> result = new ArrayList<>();
for (int i = 0; i < roots.length; i++) {
IResource resource = roots[i];
Object o = resource.getAdapter(ResourceMapping.class);
if (o instanceof ResourceMapping) {
- result.add(o);
+ result.add((ResourceMapping) o);
}
}
- return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
+ return result.toArray(new ResourceMapping[result.size()]);
}
+ @Override
public ResourceTraversal[] getTraversals(ResourceMapping mapping) {
Object object = mapping.getModelObject();
if (object instanceof IResource) {
@@ -72,22 +77,27 @@ public class RootResourceSynchronizationScope extends AbstractResourceMappingSco
return null;
}
+ @Override
public boolean hasAdditionalMappings() {
return false;
}
+ @Override
public boolean hasAdditonalResources() {
return false;
}
+ @Override
public IProject[] getProjects() {
return ResourcesPlugin.getWorkspace().getRoot().getProjects();
}
+ @Override
public ResourceMappingContext getContext() {
return ResourceMappingContext.LOCAL_CONTEXT;
}
+ @Override
public void refresh(ResourceMapping[] mappings) {
// Not supported
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java
index ac568651e..745e0324d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler.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
@@ -72,23 +72,17 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
super(subscriber);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#hasMembers(org.eclipse.core.resources.IResource)
- */
+ @Override
protected boolean hasMembers(IResource resource) {
return tree.members(resource).length > 0;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#remove(org.eclipse.core.resources.IResource)
- */
+ @Override
protected void remove(IResource resource) {
SubscriberDiffTreeEventHandler.this.remove(resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#change(org.eclipse.core.resources.IResource, int)
- */
+ @Override
protected void change(IResource resource, int depth) {
SubscriberDiffTreeEventHandler.this.change(resource, depth);
}
@@ -109,26 +103,25 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
this.filter = filter;
}
+ @Override
protected void reset(ResourceTraversal[] traversals, int type) {
// Reset the exception state since we are reseting
exceptionState = EXCEPTION_NONE;
if (!manager.isInitialized() && state == STATE_OK_TO_INITIALIZE) {
// This means the scope has not been initialized
- queueEvent(new RunnableEvent(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // Only initialize the scope if we are in the STARTED state
- if (state == STATE_OK_TO_INITIALIZE) {
- try {
- prepareScope(monitor);
- state = STATE_COLLECTING_CHANGES;
- } finally {
- // If the initialization didn't complete,
- // return to the STARTED state.
- if (state != STATE_COLLECTING_CHANGES) {
- state = STATE_STARTED;
- if (exceptionState == EXCEPTION_NONE)
- exceptionState = EXCEPTION_CANCELED;
- }
+ queueEvent(new RunnableEvent(monitor -> {
+ // Only initialize the scope if we are in the STARTED state
+ if (state == STATE_OK_TO_INITIALIZE) {
+ try {
+ prepareScope(monitor);
+ state = STATE_COLLECTING_CHANGES;
+ } finally {
+ // If the initialization didn't complete,
+ // return to the STARTED state.
+ if (state != STATE_COLLECTING_CHANGES) {
+ state = STATE_STARTED;
+ if (exceptionState == EXCEPTION_NONE)
+ exceptionState = EXCEPTION_CANCELED;
}
}
}
@@ -155,9 +148,7 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
reset(traversals, SubscriberEvent.INITIALIZE);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberEventHandler#handleChange(org.eclipse.core.resources.IResource)
- */
+ @Override
protected void handleChange(IResource resource) throws CoreException {
IDiff node = getSubscriber().getDiff(resource);
if (node == null) {
@@ -174,27 +165,23 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
return manager.getScope().contains(resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberEventHandler#collectAll(org.eclipse.core.resources.IResource, int, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected void collectAll(IResource resource, int depth,
final IProgressMonitor monitor) {
Policy.checkCanceled(monitor);
monitor.beginTask(null, IProgressMonitor.UNKNOWN);
ResourceTraversal[] traversals = new ResourceTraversal[] { new ResourceTraversal(new IResource[] { resource }, depth, IResource.NONE) };
try {
- getSubscriber().accept(traversals, new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- Policy.checkCanceled(monitor);
- monitor.subTask(NLS.bind(Messages.SubscriberDiffTreeEventHandler_0, tree.getResource(diff).getFullPath().toString()));
- // Queue up any found diffs for inclusion into the output tree
- queueDispatchEvent(
- new SubscriberDiffChangedEvent(tree.getResource(diff), SubscriberEvent.CHANGE, IResource.DEPTH_ZERO, diff));
- // Handle any pending dispatches
- handlePreemptiveEvents(monitor);
- handlePendingDispatch(monitor);
- return true;
- }
+ getSubscriber().accept(traversals, diff -> {
+ Policy.checkCanceled(monitor);
+ monitor.subTask(NLS.bind(Messages.SubscriberDiffTreeEventHandler_0, tree.getResource(diff).getFullPath().toString()));
+ // Queue up any found diffs for inclusion into the output tree
+ queueDispatchEvent(
+ new SubscriberDiffChangedEvent(tree.getResource(diff), SubscriberEvent.CHANGE, IResource.DEPTH_ZERO, diff));
+ // Handle any pending dispatches
+ handlePreemptiveEvents(monitor);
+ handlePendingDispatch(monitor);
+ return true;
});
} catch (CoreException e) {
if (resource.getProject().isAccessible())
@@ -204,9 +191,7 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberEventHandler#dispatchEvents(org.eclipse.team.internal.core.subscribers.SubscriberEventHandler.SubscriberEvent[], org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected void dispatchEvents(SubscriberEvent[] events,
IProgressMonitor monitor) {
try {
@@ -256,25 +241,19 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
return tree;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberEventHandler#getSubscriber()
- */
+ @Override
public Subscriber getSubscriber() {
return super.getSubscriber();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberEventHandler#shutdown()
- */
+ @Override
public void shutdown() {
state = STATE_SHUTDOWN;
collector.dispose();
super.shutdown();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#getJobFamiliy()
- */
+ @Override
protected Object getJobFamiliy() {
return family;
}
@@ -287,18 +266,14 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
this.family = family;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberEventHandler#handleException(org.eclipse.core.runtime.CoreException, org.eclipse.core.resources.IResource, int, java.lang.String)
- */
+ @Override
protected void handleException(CoreException e, IResource resource, int code, String message) {
super.handleException(e, resource, code, message);
tree.reportError(new TeamStatus(IStatus.ERROR, TeamPlugin.ID, code, message, e, resource));
exceptionState = EXCEPTION_ERROR;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberEventHandler#handleCancel(org.eclipse.core.runtime.OperationCanceledException)
- */
+ @Override
protected void handleCancel(OperationCanceledException e) {
super.handleCancel(e);
tree.reportError(new TeamStatus(IStatus.ERROR, TeamPlugin.ID, ITeamStatus.SYNC_INFO_SET_CANCELLATION, Messages.SubscriberEventHandler_12, e, ResourcesPlugin.getWorkspace().getRoot()));
@@ -327,6 +302,7 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
}
}
+ @Override
public synchronized void start() {
super.start();
if (state == STATE_NEW)
@@ -337,12 +313,14 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
return state;
}
+ @Override
protected boolean isSystemJob() {
if (manager != null && !manager.isInitialized())
return false;
return super.isSystemJob();
}
+ @Override
public synchronized void remove(IResource resource) {
// Don't queue changes if we haven't been initialized
if (state == STATE_STARTED)
@@ -350,6 +328,7 @@ public class SubscriberDiffTreeEventHandler extends SubscriberEventHandler {
super.remove(resource);
}
+ @Override
public void change(IResource resource, int depth) {
// Don't queue changes if we haven't been initialized
if (state == STATE_STARTED)
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java
index bde9700a0..de97e030f 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 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
@@ -53,9 +53,7 @@ public abstract class SubscriberResourceCollector implements IResourceChangeList
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.sync.ITeamResourceChangeListener#teamResourceChanged(org.eclipse.team.core.sync.TeamDelta[])
- */
+ @Override
public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
try {
beginInput();
@@ -102,9 +100,7 @@ public abstract class SubscriberResourceCollector implements IResourceChangeList
}
- /*(non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
+ @Override
public void resourceChanged(IResourceChangeEvent event) {
try {
beginInput();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.java
index ddc71bcc3..be0aec992 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet.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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.team.internal.core.subscribers;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
import org.eclipse.team.core.synchronize.SyncInfoTree;
@@ -38,9 +37,7 @@ public class SubscriberSyncInfoSet extends SyncInfoTree {
this.handler = handler;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.SyncInfoSet#connect(org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void connect(ISyncInfoSetChangeListener listener, IProgressMonitor monitor) {
if (handler == null) {
super.connect(listener, monitor);
@@ -60,18 +57,16 @@ public class SubscriberSyncInfoSet extends SyncInfoTree {
// Should only use this connect if the set has a handler
throw new UnsupportedOperationException();
} else {
- handler.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- try {
- beginInput();
- monitor.beginTask(null, 100);
- removeSyncSetChangedListener(listener);
- addSyncSetChangedListener(listener);
- listener.syncInfoSetReset(SubscriberSyncInfoSet.this, Policy.subMonitorFor(monitor, 95));
- } finally {
- endInput(Policy.subMonitorFor(monitor, 5));
- monitor.done();
- }
+ handler.run(monitor -> {
+ try {
+ beginInput();
+ monitor.beginTask(null, 100);
+ removeSyncSetChangedListener(listener);
+ addSyncSetChangedListener(listener);
+ listener.syncInfoSetReset(SubscriberSyncInfoSet.this, Policy.subMonitorFor(monitor, 95));
+ } finally {
+ endInput(Policy.subMonitorFor(monitor, 5));
+ monitor.done();
}
}, true /* high priority */);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java
index 39b4a5e75..c2cd069c8 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoStatistics.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 @@ import org.eclipse.team.core.synchronize.SyncInfo;
*/
public class SyncInfoStatistics {
// {int sync kind -> int number of infos with that sync kind in this sync set}
- protected Map stats = new HashMap();
+ protected Map<Integer, Long> stats = new HashMap<>();
/**
* Count this sync kind. Only the type of the sync info is stored.
@@ -29,7 +29,7 @@ public class SyncInfoStatistics {
*/
public void add(SyncInfo info) {
// update statistics
- Long count = (Long)stats.get(new Integer(info.getKind()));
+ Long count = stats.get(new Integer(info.getKind()));
if(count == null) {
count = new Long(0);
}
@@ -43,7 +43,7 @@ public class SyncInfoStatistics {
public void remove(SyncInfo info) {
// update stats
Integer kind = new Integer(info.getKind());
- Long count = (Long)stats.get(kind);
+ Long count = stats.get(kind);
if(count == null) {
// error condition, shouldn't be removing if we haven't added yet
// programmer error calling remove before add.
@@ -69,7 +69,7 @@ public class SyncInfoStatistics {
*/
public long countFor(int kind, int mask) {
if(mask == 0) {
- Long count = (Long)stats.get(new Integer(kind));
+ Long count = stats.get(new Integer(kind));
return count == null ? 0 : count.longValue();
} else {
Iterator it = stats.keySet().iterator();
@@ -77,7 +77,7 @@ public class SyncInfoStatistics {
while (it.hasNext()) {
Integer key = (Integer) it.next();
if((key.intValue() & mask) == kind) {
- count += ((Long)stats.get(key)).intValue();
+ count += stats.get(key).intValue();
}
}
return count;
@@ -95,6 +95,7 @@ public class SyncInfoStatistics {
/**
* For debugging
*/
+ @Override
public String toString() {
StringBuffer out = new StringBuffer();
Iterator it = stats.keySet().iterator();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java
index c118f3878..803366628 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoWorkingSetFilter.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,9 +25,7 @@ public class SyncInfoWorkingSetFilter extends FastSyncInfoFilter {
private IResource[] resources;
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.sync.SyncInfoFilter#select(org.eclipse.team.core.subscribers.SyncInfo)
- */
+ @Override
public boolean select(SyncInfo info) {
// if there's no set, the resource is included
if (isEmpty()) return true;
@@ -53,20 +51,17 @@ public class SyncInfoWorkingSetFilter extends FastSyncInfoFilter {
return (parent.getFullPath().isPrefixOf(child.getFullPath()));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.views.SyncSetInputFromSubscriber#getRoots()
- */
public IResource[] getRoots(Subscriber subscriber) {
IResource[] roots = subscriber.roots();
if (isEmpty()) return roots;
// filter the roots by the selected working set
- Set result = new HashSet();
+ Set<IResource> result = new HashSet<>();
for (int i = 0; i < roots.length; i++) {
IResource resource = roots[i];
result.addAll(Arrays.asList(getIntersectionWithSet(subscriber, resource)));
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
/*
@@ -74,7 +69,7 @@ public class SyncInfoWorkingSetFilter extends FastSyncInfoFilter {
* and the receiver's working set.
*/
private IResource[] getIntersectionWithSet(Subscriber subscriber, IResource resource) {
- List result = new ArrayList();
+ List<IResource> result = new ArrayList<>();
for (int i = 0; i < resources.length; i++) {
IResource setResource = resources[i];
if (setResource != null) {
@@ -93,7 +88,7 @@ public class SyncInfoWorkingSetFilter extends FastSyncInfoFilter {
}
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
public void setWorkingSet(IResource[] resources) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.java
index 9c71fc2a2..baf8cffe1 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/WorkingSetFilteredSyncInfoCollector.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
@@ -47,6 +47,7 @@ public final class WorkingSetFilteredSyncInfoCollector {
workingSetInput = new WorkingSetSyncSetInput((SubscriberSyncInfoSet)collector.getSyncInfoSet(), getEventHandler());
filteredInput = new SyncSetInputFromSyncSet(workingSetInput.getSyncSet(), getEventHandler());
filteredInput.setFilter(new SyncInfoFilter() {
+ @Override
public boolean select(SyncInfo info, IProgressMonitor monitor) {
return true;
}

Back to the top