Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-07-25 11:01:13 -0400
committerAlexander Kurtakov2017-07-25 11:05:06 -0400
commit3734ce46345e063654bf3bdc0ff6a3096bc0d501 (patch)
tree8116dfe1bce4bf55085edda12f867920aa0c8e5f /bundles
parent6a433070e2339a9bb564565a873f54c697ec1feb (diff)
downloadeclipse.platform.team-3734ce46345e063654bf3bdc0ff6a3096bc0d501.tar.gz
eclipse.platform.team-3734ce46345e063654bf3bdc0ff6a3096bc0d501.tar.xz
eclipse.platform.team-3734ce46345e063654bf3bdc0ff6a3096bc0d501.zip
Bug 520159 - Modernize o.e.team.core
* Generify. * Replace non-javadoc with @Override * Convert to lambdas Change-Id: I8cd3bc81ce83b53bb9c80f5f928a963baa82b872 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.core.prefs54
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ICache.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java11
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java50
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java60
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamStatus.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/Diff.java26
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java86
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/provider/FileRevision.java41
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java16
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java24
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java208
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiff.java18
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiffTree.java70
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationContext.java26
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java37
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.java14
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.java19
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.java54
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberScopeManager.java28
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.java23
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java46
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java51
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/CachedResourceVariant.java11
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/IResourceVariant.java3
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.java44
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayRemoteTree.java21
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.java19
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.java18
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/AdapterFactory.java17
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/BackgroundEventHandler.java10
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java42
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java26
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java34
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java22
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PessimisticResourceRuleFactory.java34
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java16
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java43
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileRevision.java36
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java28
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LineComparator.java31
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingScope.java45
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceVariantFileRevision.java17
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java9
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager.java35
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java36
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.java44
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.java23
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.java20
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java13
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberChangeSetManager.java72
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java31
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java24
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java37
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.java17
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.java7
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java19
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ThreeWayBaseTree.java28
60 files changed, 836 insertions, 1070 deletions
diff --git a/bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.core.prefs
index a243d867d..9f6ef3661 100644
--- a/bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.core.prefs
@@ -7,6 +7,15 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
@@ -20,17 +29,23 @@ org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
@@ -42,42 +57,75 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disable
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ICache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ICache.java
index c3cbd1df1..d22c04352 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ICache.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ICache.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
@@ -63,6 +63,7 @@ public interface ICache {
* @param listener the listener to remove
* @deprecated use {@link #removeCacheListener(ICacheListener)}
*/
+ @Deprecated
void removeDisposeListener(ICacheListener listener);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java
index 1276de402..3aaf1f7fa 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IFileTypeInfo.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
@@ -18,6 +18,7 @@ package org.eclipse.team.core;
* @deprecated Use the <code>IFileContentManager</code> API instead.
* @noimplement This interface is not intended to be implemented by clients.
*/
+@Deprecated
public interface IFileTypeInfo {
/**
* Returns the string specifying the file extension
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java
index 45ed0334c..925583a06 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.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,6 +26,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
* to obtain an instance of {@link org.eclipse.team.core.ProjectSetCapability} instead.
*/
+@Deprecated
public interface IProjectSetSerializer {
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
index bb4e08793..a3f485e21 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ProjectSetCapability.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
@@ -84,6 +84,7 @@ public abstract class ProjectSetCapability {
* projectSetCreated(File, ProjectSetSerializationContext, IProgressMonitor)
* instead
*/
+ @Deprecated
public void projectSetCreated(File file, Object context, IProgressMonitor monitor) {
//default is to do nothing
}
@@ -233,7 +234,7 @@ public abstract class ProjectSetCapability {
// Build a collection of existing projects
- final Collection existingProjects = new ArrayList();
+ final Collection<IProject> existingProjects = new ArrayList<>();
for (int i = 0; i < projects.length; i++) {
IProject eachProj = projects[i];
if (eachProj.exists()) {
@@ -249,7 +250,7 @@ public abstract class ProjectSetCapability {
IProject[] confirmed =
context.confirmOverwrite(
- (IProject[]) existingProjects.toArray(
+ existingProjects.toArray(
new IProject[existingProjects.size()]));
if (confirmed == null)
return null;
@@ -258,7 +259,7 @@ public abstract class ProjectSetCapability {
// Return the amended list of projects to be loaded
- Collection result = new ArrayList(projects.length);
+ Collection<IProject> result = new ArrayList<>(projects.length);
result.addAll(Arrays.asList(projects));
result.removeAll(existingProjects);
for (int i = 0; i < confirmed.length; i++) {
@@ -266,7 +267,7 @@ public abstract class ProjectSetCapability {
if (existingProjects.contains(eachProj))
result.add(eachProj);
}
- return (IProject[]) result.toArray(new IProject[result.size()]);
+ return result.toArray(new IProject[result.size()]);
}
/*
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
index 3b051a58d..c70aa03c3 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 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
@@ -57,7 +57,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
private final static String TEAM_SETID = "org.eclipse.team.repository-provider"; //$NON-NLS-1$
- private final static List AllProviderTypeIds = initializeAllProviderTypes();
+ private final static List<String> AllProviderTypeIds = initializeAllProviderTypes();
// the project instance that this nature is assigned to
private IProject project;
@@ -167,16 +167,14 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
// validate that either the provider supports linked resources or the project has no linked resources
if (!provider.canHandleLinkedResourceURI()) {
try {
- project.accept(new IResourceProxyVisitor() {
- public boolean visit(IResourceProxy proxy) throws CoreException {
- if (proxy.isLinked()) {
- if (!provider.canHandleLinkedResources() ||
- proxy.requestFullPath().segmentCount() > 2 ||
- !EFS.SCHEME_FILE.equals(proxy.requestResource().getLocationURI().getScheme()))
- throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, IResourceStatus.LINKING_NOT_ALLOWED, NLS.bind(Messages.RepositoryProvider_linkedURIsExist, new String[] { project.getName(), id }), null));
- }
- return true;
+ project.accept(proxy -> {
+ if (proxy.isLinked()) {
+ if (!provider.canHandleLinkedResources() ||
+ proxy.requestFullPath().segmentCount() > 2 ||
+ !EFS.SCHEME_FILE.equals(proxy.requestResource().getLocationURI().getScheme()))
+ throw new TeamException(new Status(IStatus.ERROR, TeamPlugin.ID, IResourceStatus.LINKING_NOT_ALLOWED, NLS.bind(Messages.RepositoryProvider_linkedURIsExist, new String[] { project.getName(), id }), null));
}
+ return true;
}, IResource.NONE);
} catch (CoreException e) {
if (e instanceof TeamException) {
@@ -329,6 +327,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
*
* @see RepositoryProvider#configureProject()
*/
+ @Override
final public void configure() throws CoreException {
try {
configureProject();
@@ -369,6 +368,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
* @see org.eclipse.core.resources.IFileModificationValidator
* @deprecated use {@link #getFileModificationValidator2()}
*/
+ @Deprecated
public IFileModificationValidator getFileModificationValidator() {
return null;
}
@@ -399,9 +399,11 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
if (fileModificationValidator == null)
return null;
return new FileModificationValidator() {
+ @Override
public IStatus validateSave(IFile file) {
return fileModificationValidator.validateSave(file);
}
+ @Override
public IStatus validateEdit(IFile[] files,
FileModificationValidationContext context) {
// Extract the shell from the context in order to invoke the old API
@@ -450,6 +452,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
*
* @return a string description of this provider
*/
+ @Override
public String toString() {
return NLS.bind(Messages.RepositoryProvider_toString, new String[] { getProject().getName(), getID() });
}
@@ -461,7 +464,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
*/
final public static String[] getAllProviderTypeIds() {
IProjectNatureDescriptor[] desc = ResourcesPlugin.getWorkspace().getNatureDescriptors();
- Set teamSet = new HashSet();
+ Set<String> teamSet = new HashSet<>();
teamSet.addAll(AllProviderTypeIds); // add in all the ones we know via extension point
@@ -474,7 +477,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
}
}
}
- return (String[]) teamSet.toArray(new String[teamSet.size()]);
+ return teamSet.toArray(new String[teamSet.size()]);
}
/**
@@ -659,22 +662,18 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
}
}
- /*
- * @see IProjectNature#getProject()
- */
+ @Override
public IProject getProject() {
return project;
}
- /*
- * @see IProjectNature#setProject(IProject)
- */
+ @Override
public void setProject(IProject project) {
this.project = project;
}
- private static List initializeAllProviderTypes() {
- List allIDs = new ArrayList();
+ private static List<String> initializeAllProviderTypes() {
+ List<String> allIDs = new ArrayList<>();
TeamPlugin plugin = TeamPlugin.getPlugin();
if (plugin != null) {
@@ -739,6 +738,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
* @deprecated see {@link #validateCreateLink(IResource, int, URI) } instead
* @since 2.1
*/
+ @Deprecated
public IStatus validateCreateLink(IResource resource, int updateFlags, IPath location) {
if (canHandleLinkedResources()) {
return Team.OK_STATUS;
@@ -793,6 +793,7 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
*
* @deprecated see {@link #canHandleLinkedResourceURI() }
*/
+ @Deprecated
public boolean canHandleLinkedResources() {
return canHandleLinkedResourceURI();
}
@@ -821,11 +822,8 @@ public abstract class RepositoryProvider implements IProjectNature, IAdaptable {
return false;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
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 79ddfdb33..538c0f6d0 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
@@ -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
@@ -16,7 +16,6 @@ import java.util.Map.Entry;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.importing.provisional.IBundleImporter;
@@ -40,11 +39,13 @@ public final class Team {
fMapping= mapping;
}
- public String getExtension() {
+ @Override
+ public String getExtension() {
return fMapping.getString();
}
- public int getType() {
+ @Override
+ public int getType() {
return fMapping.getType();
}
@@ -61,7 +62,7 @@ public final class Team {
// The ignore list that is read at startup from the persisted file
- protected static SortedMap globalIgnore, pluginIgnore;
+ protected static SortedMap<String, Boolean> globalIgnore, pluginIgnore;
private static StringMatcher[] ignoreMatchers;
private final static FileContentManager fFileContentManager;
@@ -88,6 +89,7 @@ public final class Team {
*
* @deprecated Use <code>getFileContentManager().getType(IStorage storage)</code> instead.
*/
+ @Deprecated
public static int getType(IStorage storage) {
return fFileContentManager.getType(storage);
}
@@ -112,6 +114,7 @@ public final class Team {
* @return <code>true</code> if this file should be ignored, and <code>false</code> otherwise
* @deprecated use isIgnoredHint(IResource) instead
*/
+ @Deprecated
public static boolean isIgnoredHint(IFile file) {
if (file.isDerived()) return true;
return matchesEnabledIgnore(file);
@@ -135,6 +138,7 @@ public final class Team {
* @return <code>true</code> if this file should be ignored, and <code>false</code> otherwise
* @deprecated use isIgnoredHint instead
*/
+ @Deprecated
public static boolean isIgnored(IFile file) {
return matchesEnabledIgnore(file);
}
@@ -146,6 +150,7 @@ public final class Team {
* @return all known file types
* @deprecated Use <code>getFileContentManager().getExtensionMappings()</code> instead.
*/
+ @Deprecated
public static IFileTypeInfo[] getAllTypes() {
final IStringMapping [] mappings= fFileContentManager.getExtensionMappings();
final IFileTypeInfo [] infos= new IFileTypeInfo[mappings.length];
@@ -170,8 +175,8 @@ public final class Team {
private static void initializeIgnores() {
if (globalIgnore == null) {
- globalIgnore = new TreeMap();
- pluginIgnore = new TreeMap();
+ globalIgnore = new TreeMap<>();
+ pluginIgnore = new TreeMap<>();
ignoreMatchers = null;
try {
readIgnoreState();
@@ -193,9 +198,11 @@ public final class Team {
result[i++] = new IIgnoreInfo() {
private String p = pattern;
private boolean e1 = enabled;
+ @Override
public String getPattern() {
return p;
}
+ @Override
public boolean getEnabled() {
return e1;
}
@@ -207,14 +214,14 @@ public final class Team {
private synchronized static StringMatcher[] getStringMatchers() {
if (ignoreMatchers==null) {
IIgnoreInfo[] ignorePatterns = getAllIgnores();
- ArrayList matchers = new ArrayList(ignorePatterns.length);
+ ArrayList<StringMatcher> matchers = new ArrayList<>(ignorePatterns.length);
for (int i = 0; i < ignorePatterns.length; i++) {
if (ignorePatterns[i].getEnabled()) {
matchers.add(new StringMatcher(ignorePatterns[i].getPattern(), true, false));
}
}
ignoreMatchers = new StringMatcher[matchers.size()];
- ignoreMatchers = (StringMatcher[]) matchers.toArray(ignoreMatchers);
+ ignoreMatchers = matchers.toArray(ignoreMatchers);
}
return ignoreMatchers;
}
@@ -234,6 +241,7 @@ public final class Team {
*
* @deprecated Use <code>getFileContentManager().setExtensionMappings()</code> instead.
*/
+ @Deprecated
public static void setAllTypes(String[] extensions, int[] types) {
fFileContentManager.addExtensionMappings(extensions, types);
}
@@ -246,7 +254,7 @@ public final class Team {
*/
public static void setAllIgnores(String[] patterns, boolean[] enabled) {
initializeIgnores();
- globalIgnore = new TreeMap();
+ globalIgnore = new TreeMap<>();
ignoreMatchers = null;
for (int i = 0; i < patterns.length; i++) {
globalIgnore.put(patterns[i], Boolean.valueOf(enabled[i]));
@@ -259,7 +267,7 @@ public final class Team {
String pattern = (String) entry.getKey();
Boolean value = (Boolean) entry.getValue();
boolean isCustom = (!pluginIgnore.containsKey(pattern)) ||
- !((Boolean)pluginIgnore.get(pattern)).equals(value);
+ !pluginIgnore.get(pattern).equals(value);
if (isCustom) {
buf.append(pattern);
buf.append(PREF_TEAM_SEPARATOR);
@@ -280,7 +288,7 @@ public final class Team {
*
* Reads the ignores currently defined by extensions.
*/
- private static void initializePluginIgnores(SortedMap pIgnore, SortedMap gIgnore) {
+ private static void initializePluginIgnores(SortedMap<String, Boolean> pIgnore, SortedMap<String, Boolean> gIgnore) {
TeamPlugin plugin = TeamPlugin.getPlugin();
if (plugin != null) {
IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(TeamPlugin.ID, TeamPlugin.IGNORE_EXTENSION);
@@ -325,9 +333,9 @@ public final class Team {
}
}
- Iterator it = pIgnore.keySet().iterator();
+ Iterator<String> it = pIgnore.keySet().iterator();
while (it.hasNext()) {
- Object pattern = it.next();
+ String pattern = it.next();
if (!gIgnore.containsKey(pattern)) {
gIgnore.put(pattern, pIgnore.get(pattern));
}
@@ -366,13 +374,11 @@ public final class Team {
if (readBackwardCompatibleIgnoreState()) return;
Preferences pref = TeamPlugin.getPlugin().getPluginPreferences();
if (!pref.contains(PREF_TEAM_IGNORES)) return;
- pref.addPropertyChangeListener(new Preferences.IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- // when a property is changed, invalidate our cache so that
- // properties will be recalculated.
- if(event.getProperty().equals(PREF_TEAM_IGNORES))
- globalIgnore = null;
- }
+ pref.addPropertyChangeListener(event -> {
+ // when a property is changed, invalidate our cache so that
+ // properties will be recalculated.
+ if(event.getProperty().equals(PREF_TEAM_IGNORES))
+ globalIgnore = null;
});
String prefIgnores = pref.getString(PREF_TEAM_IGNORES);
StringTokenizer tok = new StringTokenizer(prefIgnores, PREF_TEAM_SEPARATOR);
@@ -447,6 +453,7 @@ public final class Team {
* Use {@link org.eclipse.team.core.RepositoryProviderType#getProjectSetCapability()}
* to obtain an instance of {@link ProjectSetCapability} instead.
*/
+ @Deprecated
public static IProjectSetSerializer getProjectSetSerializer(String id) {
TeamPlugin plugin = TeamPlugin.getPlugin();
if (plugin != null) {
@@ -481,8 +488,8 @@ public final class Team {
* @since 3.0
*/
public static IIgnoreInfo[] getDefaultIgnores() {
- SortedMap gIgnore = new TreeMap();
- SortedMap pIgnore = new TreeMap();
+ SortedMap<String, Boolean> gIgnore = new TreeMap<>();
+ SortedMap<String, Boolean> pIgnore = new TreeMap<>();
initializePluginIgnores(pIgnore, gIgnore);
return getIgnoreInfo(gIgnore);
}
@@ -496,6 +503,7 @@ public final class Team {
* @since 3.0
* @deprecated Use Team.getFileContentManager().getDefaultExtensionMappings() instead.
*/
+ @Deprecated
public static IFileTypeInfo[] getDefaultTypes() {
return asFileTypeInfo(getFileContentManager().getDefaultExtensionMappings());
}
@@ -560,7 +568,8 @@ public final class Team {
* @deprecated Use {@link #createMerger(IContentType)} instead.
* @since 3.2
*/
- public IStorageMerger createStorageMerger(IContentType type) {
+ @Deprecated
+ public IStorageMerger createStorageMerger(IContentType type) {
return createMerger(type);
}
@@ -574,7 +583,8 @@ public final class Team {
* @deprecated Use {@link #createMerger(String)} instead.
* @since 3.2
*/
- public IStorageMerger createStorageMerger(String extension) {
+ @Deprecated
+ public IStorageMerger createStorageMerger(String extension) {
return createMerger(extension);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamStatus.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamStatus.java
index 689f382ed..38c191f1e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamStatus.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamStatus.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
@@ -49,6 +49,7 @@ public class TeamStatus extends Status implements ITeamStatus {
* Return the resource associated with this status.
* @return Returns the resource.
*/
+ @Override
public IResource getResource() {
return resource;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/Diff.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/Diff.java
index a83e0155e..38875e735 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/Diff.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/Diff.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
@@ -48,20 +48,12 @@ public abstract class Diff implements IDiff {
this.status = status;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.synchronize.ISyncDelta#getFullPath()
- */
+ @Override
public IPath getPath() {
return path;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.synchronize.ISyncDelta#getKind()
- */
+ @Override
public int getKind() {
return getStatus() & KIND_MASK;
}
@@ -78,25 +70,19 @@ public abstract class Diff implements IDiff {
return status;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffNode#toDiffString()
- */
+ @Override
public String toDiffString() {
int kind = getKind();
String label = SyncInfoToDiffConverter.diffKindToString(kind);
return label;
}
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
+ @Override
public int hashCode() {
return getPath().hashCode();
}
- /* (non-Javadoc)
- * @see java.lang.Object#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/DiffTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
index cceae1d6b..5e3ead07d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/diff/provider/DiffTree.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
@@ -37,7 +37,7 @@ public class DiffTree implements IDiffTree {
*/
public static final int START_CLIENT_PROPERTY_RANGE = 1024;
- private ListenerList listeners = new ListenerList();
+ private ListenerList<IDiffChangeListener> listeners = new ListenerList<>();
private PathTree pathTree = new PathTree();
@@ -49,7 +49,7 @@ public class DiffTree implements IDiffTree {
private boolean lockedForModification;
- private Map propertyChanges = new HashMap();
+ private Map<Integer, Set<IPath>> propertyChanges = new HashMap<>();
/**
* Create an empty diff tree.
@@ -58,23 +58,17 @@ public class DiffTree implements IDiffTree {
resetChanges();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncDeltaTree#addSyncDeltaChangeListener(org.eclipse.team.core.synchronize.ISyncDeltaChangeListener)
- */
+ @Override
public void addDiffChangeListener(IDiffChangeListener listener) {
listeners.add(listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncDeltaTree#removeSyncDeltaChangeListener(org.eclipse.team.core.synchronize.ISyncDeltaChangeListener)
- */
+ @Override
public void removeDiffChangeListener(IDiffChangeListener listener) {
listeners.remove(listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncDeltaTree#accept(org.eclipse.core.runtime.IPath, org.eclipse.team.core.synchronize.ISyncDeltaVisitor)
- */
+ @Override
public void accept(IPath path, IDiffVisitor visitor, int depth) {
IDiff delta = getDiff(path);
if (delta == null || visitor.visit(delta)) {
@@ -88,23 +82,17 @@ public class DiffTree implements IDiffTree {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncDeltaTree#findMember(org.eclipse.core.runtime.IPath)
- */
+ @Override
public IDiff getDiff(IPath path) {
return (IDiff)pathTree.get(path);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.ISyncDeltaTree#getAffectedChildren(org.eclipse.core.runtime.IPath)
- */
+ @Override
public IPath[] getChildren(IPath path) {
return pathTree.getChildren(path);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.delta.ISyncDeltaTree#isEmpty()
- */
+ @Override
public boolean isEmpty() {
return pathTree.isEmpty();
}
@@ -229,26 +217,28 @@ public class DiffTree implements IDiffTree {
final DiffChangeEvent event = getChangeEvent();
resetChanges();
- final Map propertyChanges = this.propertyChanges;
- this.propertyChanges = new HashMap();
+ final Map<Integer, Set<IPath>> propertyChanges = this.propertyChanges;
+ this.propertyChanges = new HashMap<>();
if(event.isEmpty() && ! event.isReset() && propertyChanges.isEmpty()) return;
Object[] listeners = this.listeners.getListeners();
for (int i = 0; i < listeners.length; i++) {
final IDiffChangeListener listener = (IDiffChangeListener)listeners[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 {
try {
lockedForModification = true;
if (!event.isEmpty() || event.isReset())
listener.diffsChanged(event, Policy.subMonitorFor(monitor, 100));
- for (Iterator iter = propertyChanges.keySet().iterator(); iter.hasNext();) {
- Integer key = (Integer) iter.next();
- Set paths = (Set)propertyChanges.get(key);
- listener.propertyChanged(DiffTree.this, key.intValue(), (IPath[]) paths.toArray(new IPath[paths
+ for (Iterator<Integer> iter = propertyChanges.keySet().iterator(); iter.hasNext();) {
+ Integer key = iter.next();
+ Set<IPath> paths = propertyChanges.get(key);
+ listener.propertyChanged(DiffTree.this, key.intValue(), paths.toArray(new IPath[paths
.size()]));
}
@@ -330,25 +320,18 @@ public class DiffTree implements IDiffTree {
return (IDiff[]) pathTree.values().toArray(new IDiff[pathTree.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffTree#countFor(int, int)
- */
+ @Override
public long countFor(int state, int mask) {
if (state == 0)
return size();
return statistics.countFor(state, mask);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffTree#size()
- */
+ @Override
public int size() {
return pathTree.size();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffTree#setPropertyToRoot(org.eclipse.core.runtime.IPath, int, boolean)
- */
public void setPropertyToRoot(IDiff node, int property, boolean value) {
try {
beginInput();
@@ -361,9 +344,9 @@ public class DiffTree implements IDiffTree {
private void accumulatePropertyChanges(int property, IPath[] paths) {
Integer key = new Integer(property);
- Set changes = (Set)propertyChanges.get(key);
+ Set<IPath> changes = propertyChanges.get(key);
if (changes == null) {
- changes = new HashSet();
+ changes = new HashSet<>();
propertyChanges.put(key, changes);
}
for (int i = 0; i < paths.length; i++) {
@@ -372,16 +355,12 @@ public class DiffTree implements IDiffTree {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffTree#getProperty(org.eclipse.core.runtime.IPath, int)
- */
+ @Override
public boolean getProperty(IPath path, int property) {
return pathTree.getProperty(path, property);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffTree#setBusy(org.eclipse.team.core.diff.IDiffNode[], org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void setBusy(IDiff[] diffs, IProgressMonitor monitor) {
try {
beginInput();
@@ -394,9 +373,7 @@ public class DiffTree implements IDiffTree {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffTree#clearBusy(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void clearBusy(IProgressMonitor monitor) {
try {
beginInput();
@@ -411,20 +388,15 @@ public class DiffTree implements IDiffTree {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffTree#hasDiffsMatching(org.eclipse.core.runtime.IPath, org.eclipse.team.core.diff.FastDiffFilter)
- */
+ @Override
public boolean hasMatchingDiffs(IPath path, final FastDiffFilter filter) {
final RuntimeException found = new RuntimeException();
try {
- accept(path, new IDiffVisitor() {
- public boolean visit(IDiff delta) {
- if (filter.select(delta)) {
- throw found;
- }
- return false;
+ accept(path, delta -> {
+ if (filter.select(delta)) {
+ throw found;
}
-
+ return false;
}, IResource.DEPTH_INFINITE);
} catch (RuntimeException e) {
if (e == found)
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/provider/FileRevision.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/provider/FileRevision.java
index 8db6fcf74..893fba3a3 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/provider/FileRevision.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/history/provider/FileRevision.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
@@ -38,38 +38,47 @@ public abstract class FileRevision implements IFileRevision {
this.file = file;
}
+ @Override
public IStorage getStorage(IProgressMonitor monitor) {
return file;
}
+ @Override
public String getName() {
return file.getName();
}
+ @Override
public boolean exists() {
return file.exists();
}
+ @Override
public long getTimestamp() {
return file.getLocalTimeStamp();
}
+ @Override
public URI getURI() {
return file.getLocationURI();
}
+ @Override
public IFileRevision withAllProperties(IProgressMonitor monitor) throws CoreException {
return this;
}
+ @Override
public boolean isPropertyMissing() {
return false;
}
+ @Override
public int hashCode() {
return file.hashCode();
}
+ @Override
public boolean equals(Object obj) {
if (obj == this)
return true;
@@ -89,46 +98,35 @@ public abstract class FileRevision implements IFileRevision {
* local file
* @deprecated This method doesn't do anything useful so it has been deprecated.
*/
+ @Deprecated
public static IFileRevision getFileRevisionFor(final IFile file) {
return new LocalFileRevision(file);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileState#getURI()
- */
+ @Override
public URI getURI() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileState#getTimestamp()
- */
+ @Override
public long getTimestamp() {
return -1;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileState#exists()
- */
+ @Override
public boolean exists() {
return true;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileRevision#getContentIdentifier()
- */
+ @Override
public String getContentIdentifier() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileRevision#getAuthor()
- */
+ @Override
public String getAuthor() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileRevision#getComment()
- */
+ @Override
public String getComment() {
return null;
}
@@ -137,13 +135,12 @@ public abstract class FileRevision implements IFileRevision {
* {@inheritDoc}
* @since 3.6
*/
+ @Override
public ITag[] getBranches() {
return new ITag[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileRevision#getTags()
- */
+ @Override
public ITag[] getTags() {
return new ITag[0];
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java
index a662f8748..73a653abb 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/importing/provisional/BundleImporterDelegate.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
@@ -43,9 +43,7 @@ public abstract class BundleImporterDelegate implements IBundleImporterDelegate
protected abstract RepositoryProviderType getProviderType();
- /* (non-Javadoc)
- * @see org.eclipse.pde.core.project.IBundleImporterDelegate#validateImport(java.util.Map[])
- */
+ @Override
public ScmUrlImportDescription[] validateImport(Map[] manifests) {
ScmUrlImportDescription[] results = new ScmUrlImportDescription[manifests.length];
if (getProviderType() != null) {
@@ -80,23 +78,21 @@ public abstract class BundleImporterDelegate implements IBundleImporterDelegate
return results;
}
- /* (non-Javadoc)
- * @see org.eclipse.pde.core.importing.IBundleImporterDelegate#performImport(org.eclipse.pde.core.importing.BundleImportDescription[], org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public IProject[] performImport(ScmUrlImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException {
- List references = new ArrayList();
+ List<String> references = new ArrayList<>();
ProjectSetCapability psfCapability = getProviderType().getProjectSetCapability();
IProject[] result = null;
if (psfCapability != null) {
// collect and validate all header values
for (int i = 0; i < descriptions.length; i++) {
- ScmUrlImportDescription description = (ScmUrlImportDescription) descriptions[i];
+ ScmUrlImportDescription description = descriptions[i];
references.add(psfCapability.asReference(description.getUri(), description.getProject()));
}
// create projects
if (!references.isEmpty()) {
SubMonitor subMonitor = SubMonitor.convert(monitor, references.size());
- result = psfCapability.addToWorkspace((String[]) references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), subMonitor);
+ result = psfCapability.addToWorkspace(references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), subMonitor);
subMonitor.done();
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java
index 93126e48d..9c9de46b7 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/ChangeTracker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 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
@@ -14,7 +14,6 @@ import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.internal.core.*;
@@ -29,7 +28,7 @@ import org.eclipse.team.internal.core.*;
*/
public abstract class ChangeTracker {
- private Map trackedProjects = new HashMap(); // Map IProject->IChangeGroupingRequestor
+ private Map<IProject, IChangeGroupingRequestor> trackedProjects = new HashMap<>(); // Map IProject->IChangeGroupingRequestor
private boolean disposed;
private ChangeListener changeListener = new ChangeListener();
@@ -40,6 +39,7 @@ public abstract class ChangeTracker {
* by listening for project changes and project description changes.
* @param event the change event
*/
+ @Override
public void resourceChanged(IResourceChangeEvent event) {
if (disposed) return;
IResourceDelta delta = event.getDelta();
@@ -68,6 +68,7 @@ public abstract class ChangeTracker {
* When a project is shared, start tracking it if it is of interest.
* @param provider the repository provider
*/
+ @Override
public void providerMapped(RepositoryProvider provider) {
if (disposed) return;
if (isProjectOfInterest(provider.getProject())) {
@@ -79,6 +80,7 @@ public abstract class ChangeTracker {
* When a project is no longer shared, stop tracking the project.
* @param project the project
*/
+ @Override
public void providerUnmapped(IProject project) {
if (disposed) return;
stopTrackingProject(project);
@@ -118,9 +120,10 @@ public abstract class ChangeTracker {
}
private IResource[] getProjectChanges(IProject project, IResourceDelta projectDelta) {
- final List result = new ArrayList();
+ final List<IResource> result = new ArrayList<>();
try {
projectDelta.accept(new IResourceDeltaVisitor() {
+ @Override
public boolean visit(IResourceDelta delta) throws CoreException {
if (isResourceOfInterest(delta.getResource()) & isChangeOfInterest(delta)) {
result.add(delta.getResource());
@@ -131,7 +134,7 @@ public abstract class ChangeTracker {
} catch (CoreException e) {
TeamPlugin.log(e);
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
/**
@@ -230,11 +233,10 @@ public abstract class ChangeTracker {
}
private IChangeGroupingRequestor getCollector(RepositoryProviderType type) {
- if (type instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) type;
- Object o = adaptable.getAdapter(IChangeGroupingRequestor.class);
- if (o instanceof IChangeGroupingRequestor) {
- return (IChangeGroupingRequestor) o;
+ if (type != null) {
+ IChangeGroupingRequestor o = type.getAdapter(IChangeGroupingRequestor.class);
+ if (o != null) {
+ return o;
}
}
return null;
@@ -264,7 +266,7 @@ public abstract class ChangeTracker {
}
private IChangeGroupingRequestor getCollector(IProject project) {
- return (IChangeGroupingRequestor)trackedProjects.get(project);
+ return trackedProjects.get(project);
}
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java
index 12d86f93c..076054482 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 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,69 +45,55 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
super(manager, type, deltaTree);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IMergeContext#reject(org.eclipse.team.core.diff.IDiff[], org.eclipse.core.runtime.IProgressMonitor)
- */
- public void reject(final IDiff[] diffs, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < diffs.length; i++) {
- IDiff node = diffs[i];
- reject(node, monitor);
- }
+ @Override
+ public void reject(final IDiff[] diffs, IProgressMonitor monitor) throws CoreException {
+ run(monitor1 -> {
+ for (int i = 0; i < diffs.length; i++) {
+ IDiff node = diffs[i];
+ reject(node, monitor1);
}
}, getMergeRule(diffs), IResource.NONE, monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IMergeContext#markAsMerged(org.eclipse.team.core.diff.IDiffNode[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void markAsMerged(final IDiff[] nodes, final boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < nodes.length; i++) {
- IDiff node = nodes[i];
- markAsMerged(node, inSyncHint, monitor);
- }
+ @Override
+ public void markAsMerged(final IDiff[] nodes, final boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
+ run(monitor1 -> {
+ for (int i = 0; i < nodes.length; i++) {
+ IDiff node = nodes[i];
+ markAsMerged(node, inSyncHint, monitor1);
}
}, getMergeRule(nodes), IResource.NONE, monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IMergeContext#merge(org.eclipse.team.core.delta.ISyncDelta[], boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus merge(final IDiff[] deltas, final boolean force, IProgressMonitor monitor) throws CoreException {
- final List failedFiles = new ArrayList();
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask(null, deltas.length * 100);
- for (int i = 0; i < deltas.length; i++) {
- IDiff delta = deltas[i];
- IStatus s = merge(delta, force, Policy.subMonitorFor(monitor, 100));
- if (!s.isOK()) {
- if (s.getCode() == IMergeStatus.CONFLICTS) {
- failedFiles.addAll(Arrays.asList(((IMergeStatus)s).getConflictingFiles()));
- } else {
- throw new CoreException(s);
- }
+ @Override
+ public IStatus merge(final IDiff[] deltas, final boolean force, IProgressMonitor monitor) throws CoreException {
+ final List<IFile> failedFiles = new ArrayList<>();
+ run(monitor1 -> {
+ try {
+ monitor1.beginTask(null, deltas.length * 100);
+ for (int i = 0; i < deltas.length; i++) {
+ IDiff delta = deltas[i];
+ IStatus s = merge(delta, force, Policy.subMonitorFor(monitor1, 100));
+ if (!s.isOK()) {
+ if (s.getCode() == IMergeStatus.CONFLICTS) {
+ failedFiles.addAll(Arrays.asList(((IMergeStatus)s).getConflictingFiles()));
+ } else {
+ throw new CoreException(s);
}
}
- } finally {
- monitor.done();
}
+ } finally {
+ monitor1.done();
}
}, getMergeRule(deltas), IWorkspace.AVOID_UPDATE, monitor);
if (failedFiles.isEmpty()) {
return Status.OK_STATUS;
} else {
- return new MergeStatus(TeamPlugin.ID, Messages.MergeContext_0, (IFile[]) failedFiles.toArray(new IFile[failedFiles.size()]));
+ return new MergeStatus(TeamPlugin.ID, Messages.MergeContext_0, failedFiles.toArray(new IFile[failedFiles.size()]));
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IMergeContext#merge(org.eclipse.team.core.diff.IDiffNode, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public IStatus merge(IDiff diff, boolean ignoreLocalChanges, IProgressMonitor monitor) throws CoreException {
Policy.checkCanceled(monitor);
IResource resource = getDiffTree().getResource(diff);
@@ -184,40 +170,38 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
*/
protected IStatus performThreeWayMerge(final IThreeWayDiff diff, IProgressMonitor monitor) throws CoreException {
final IStatus[] result = new IStatus[] { Status.OK_STATUS };
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(null, 100);
- IResourceDiff localDiff = (IResourceDiff)diff.getLocalChange();
- IResourceDiff remoteDiff = (IResourceDiff)diff.getRemoteChange();
- IStorageMerger merger = (IStorageMerger)getAdapter(IStorageMerger.class);
- if (merger == null)
- merger = DelegatingStorageMerger.getInstance();
- IFile file = (IFile)localDiff.getResource();
- monitor.subTask(NLS.bind(Messages.MergeContext_5, file.getFullPath().toString()));
- String osEncoding = file.getCharset();
- IFileRevision ancestorState = localDiff.getBeforeState();
- IFileRevision remoteState = remoteDiff.getAfterState();
- IStorage ancestorStorage;
- if (ancestorState != null)
- ancestorStorage = ancestorState.getStorage(Policy.subMonitorFor(monitor, 30));
- else
- ancestorStorage = null;
- IStorage remoteStorage = remoteState.getStorage(Policy.subMonitorFor(monitor, 30));
- OutputStream os = getTempOutputStream(file);
- try {
- IStatus status = merger.merge(os, osEncoding, ancestorStorage, file, remoteStorage, Policy.subMonitorFor(monitor, 30));
- if (status.isOK()) {
- file.setContents(getTempInputStream(file, os), false, true, Policy.subMonitorFor(monitor, 5));
- markAsMerged(diff, false, Policy.subMonitorFor(monitor, 5));
- } else {
- status = new MergeStatus(status.getPlugin(), status.getMessage(), new IFile[]{file});
- }
- result[0] = status;
- } finally {
- disposeTempOutputStream(file, os);
- }
- monitor.done();
- }
+ run(monitor1 -> {
+ monitor1.beginTask(null, 100);
+ IResourceDiff localDiff = (IResourceDiff)diff.getLocalChange();
+ IResourceDiff remoteDiff = (IResourceDiff)diff.getRemoteChange();
+ IStorageMerger merger = getAdapter(IStorageMerger.class);
+ if (merger == null)
+ merger = DelegatingStorageMerger.getInstance();
+ IFile file = (IFile)localDiff.getResource();
+ monitor1.subTask(NLS.bind(Messages.MergeContext_5, file.getFullPath().toString()));
+ String osEncoding = file.getCharset();
+ IFileRevision ancestorState = localDiff.getBeforeState();
+ IFileRevision remoteState = remoteDiff.getAfterState();
+ IStorage ancestorStorage;
+ if (ancestorState != null)
+ ancestorStorage = ancestorState.getStorage(Policy.subMonitorFor(monitor1, 30));
+ else
+ ancestorStorage = null;
+ IStorage remoteStorage = remoteState.getStorage(Policy.subMonitorFor(monitor1, 30));
+ OutputStream os = getTempOutputStream(file);
+ try {
+ IStatus status = merger.merge(os, osEncoding, ancestorStorage, file, remoteStorage, Policy.subMonitorFor(monitor1, 30));
+ if (status.isOK()) {
+ file.setContents(getTempInputStream(file, os), false, true, Policy.subMonitorFor(monitor1, 5));
+ markAsMerged(diff, false, Policy.subMonitorFor(monitor1, 5));
+ } else {
+ status = new MergeStatus(status.getPlugin(), status.getMessage(), new IFile[]{file});
+ }
+ result[0] = status;
+ } finally {
+ disposeTempOutputStream(file, os);
+ }
+ monitor1.done();
}, getMergeRule(diff), IWorkspace.AVOID_UPDATE, monitor);
return result[0];
}
@@ -342,36 +326,34 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
protected abstract void makeInSync(IDiff diff, IProgressMonitor monitor) throws CoreException;
private void performReplace(final IDiff diff, final IFile file, final IFileRevision remote, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask(null, 100);
- monitor.subTask(NLS.bind(Messages.MergeContext_6, file.getFullPath().toString()));
- if ((remote == null || !remote.exists()) && file.exists()) {
- file.delete(false, true, Policy.subMonitorFor(monitor, 95));
- } else if (remote != null) {
- ensureParentsExist(file, monitor);
- InputStream stream = remote.getStorage(monitor).getContents();
- stream = new BufferedInputStream(stream);
+ run(monitor1 -> {
+ try {
+ monitor1.beginTask(null, 100);
+ monitor1.subTask(NLS.bind(Messages.MergeContext_6, file.getFullPath().toString()));
+ if ((remote == null || !remote.exists()) && file.exists()) {
+ file.delete(false, true, Policy.subMonitorFor(monitor1, 95));
+ } else if (remote != null) {
+ ensureParentsExist(file, monitor1);
+ InputStream stream = remote.getStorage(monitor1).getContents();
+ stream = new BufferedInputStream(stream);
+ try {
+ if (file.exists()) {
+ file.setContents(stream, false, true, Policy.subMonitorFor(monitor1, 95));
+ } else {
+ file.create(stream, false, Policy.subMonitorFor(monitor1, 95));
+ }
+ } finally {
try {
- if (file.exists()) {
- file.setContents(stream, false, true, Policy.subMonitorFor(monitor, 95));
- } else {
- file.create(stream, false, Policy.subMonitorFor(monitor, 95));
- }
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- // Ignore
- }
+ stream.close();
+ } catch (IOException e) {
+ // Ignore
}
}
- // Performing a replace should leave the file in-sync
- makeInSync(diff, Policy.subMonitorFor(monitor, 5));
- } finally {
- monitor.done();
}
+ // Performing a replace should leave the file in-sync
+ makeInSync(diff, Policy.subMonitorFor(monitor1, 5));
+ } finally {
+ monitor1.done();
}
}, getMergeRule(diff), IWorkspace.AVOID_UPDATE, monitor);
}
@@ -404,6 +386,7 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
* corresponding <code>run</code> on {@link org.eclipse.core.resources.IWorkspace}.
* @see org.eclipse.team.core.mapping.IMergeContext#run(org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.jobs.ISchedulingRule, int, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void run(IWorkspaceRunnable runnable, ISchedulingRule rule, int flags, IProgressMonitor monitor) throws CoreException {
ResourcesPlugin.getWorkspace().run(runnable, rule, flags, monitor);
}
@@ -414,6 +397,7 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
* Subclass should override to provide the appropriate rule.
* @see org.eclipse.team.core.mapping.IMergeContext#getMergeRule(IDiff)
*/
+ @Override
public ISchedulingRule getMergeRule(IDiff diff) {
IResource resource = getDiffTree().getResource(diff);
IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
@@ -434,9 +418,7 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
return rule;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IMergeContext#getMergeRule(org.eclipse.team.core.diff.IDiff[])
- */
+ @Override
public ISchedulingRule getMergeRule(IDiff[] deltas) {
ISchedulingRule result = null;
for (int i = 0; i < deltas.length; i++) {
@@ -451,16 +433,16 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
return result;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IMergeContext#getMergeType()
- */
+ @Override
public int getMergeType() {
return getType();
}
- public Object getAdapter(Class adapter) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IStorageMerger.class) {
- return DelegatingStorageMerger.getInstance();
+ return (T) DelegatingStorageMerger.getInstance();
}
return super.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiff.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiff.java
index 3817873be..591f901a4 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiff.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiff.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
@@ -56,30 +56,22 @@ public class ResourceDiff extends TwoWayDiff implements IResourceDiff {
Assert.isTrue(resource.getType() != IResource.FILE);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IResourceDiff#getBeforeState()
- */
+ @Override
public IFileRevision getBeforeState() {
return before;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IResourceDiff#getAfterState()
- */
+ @Override
public IFileRevision getAfterState() {
return after;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IResourceDiff#getResource()
- */
+ @Override
public IResource getResource() {
return resource;
}
- /* (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/provider/ResourceDiffTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiffTree.java
index dd2571a03..c35f9b696 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiffTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/ResourceDiffTree.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
@@ -53,16 +53,12 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IResourceDiffTree#getDiff(org.eclipse.core.resources.IResource)
- */
+ @Override
public IDiff getDiff(IResource resource) {
return getDiff(resource.getFullPath());
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IResourceDiffTree#getResource(org.eclipse.team.core.diff.IDiffNode)
- */
+ @Override
public IResource getResource(IDiff diff) {
if (diff instanceof IThreeWayDiff) {
IThreeWayDiff twd = (IThreeWayDiff) diff;
@@ -75,9 +71,7 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IResourceDiffTree#accept(org.eclipse.team.core.diff.IDiffVisitor, org.eclipse.core.resources.mapping.ResourceTraversal[])
- */
+ @Override
public void accept(ResourceTraversal[] traversals, IDiffVisitor visitor) {
for (int i = 0; i < traversals.length; i++) {
ResourceTraversal traversal = traversals[i];
@@ -89,11 +83,9 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceDiffTree#getDiffs(org.eclipse.core.resources.mapping.ResourceTraversal[])
- */
+ @Override
public IDiff[] getDiffs(final ResourceTraversal[] traversals) {
- final Set result = new HashSet();
+ final Set<IDiff> result = new HashSet<>();
for (int i = 0; i < traversals.length; i++) {
ResourceTraversal traversal = traversals[i];
IResource[] resources = traversal.getResources();
@@ -102,24 +94,18 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
internalGetDiffs(resource, traversal.getDepth(), result);
}
}
- return (IDiff[]) result.toArray(new IDiff[result.size()]);
+ return result.toArray(new IDiff[result.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceDiffTree#getDiffs(org.eclipse.core.resources.IResource, int)
- */
+ @Override
public IDiff[] getDiffs(IResource resource, int depth) {
- final Set result = new HashSet();
+ final Set<IDiff> result = new HashSet<>();
internalGetDiffs(resource, depth, result);
- return (IDiff[]) result.toArray(new IDiff[result.size()]);
+ return result.toArray(new IDiff[result.size()]);
}
- private void internalGetDiffs(IResource resource, int depth, final Set result) {
- accept(resource.getFullPath(), new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- return result.add(diff);
- }
- }, depth);
+ private void internalGetDiffs(IResource resource, int depth, final Set<IDiff> result) {
+ accept(resource.getFullPath(), diff -> result.add(diff), depth);
}
private IResource internalGetResource(IPath fullPath, boolean container) {
@@ -131,11 +117,9 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
return ResourcesPlugin.getWorkspace().getRoot().getFile(fullPath);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IResourceDiffTree#members(org.eclipse.core.resources.IResource)
- */
+ @Override
public IResource[] members(IResource resource) {
- List result = new ArrayList();
+ List<IResource> result = new ArrayList<>();
IPath[] paths = getChildren(resource.getFullPath());
for (int i = 0; i < paths.length; i++) {
IPath path = paths[i];
@@ -146,25 +130,21 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
result.add(getResource(node));
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceDiffTree#getAffectedResources()
- */
+ @Override
public IResource[] getAffectedResources() {
- List result = new ArrayList();
+ List<IResource> result = new ArrayList<>();
IDiff[] nodes = getDiffs();
for (int i = 0; i < nodes.length; i++) {
IDiff node = nodes[i];
result.add(getResource(node));
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.provider.DiffTree#add(org.eclipse.team.core.diff.IDiffNode)
- */
+ @Override
public void add(IDiff delta) {
Assert.isTrue(delta instanceof IResourceDiff || delta instanceof IThreeWayDiff);
super.add(delta);
@@ -179,17 +159,15 @@ public class ResourceDiffTree extends DiffTree implements IResourceDiffTree {
remove(resource.getFullPath());
}
+ @Override
public boolean hasMatchingDiffs(ResourceTraversal[] traversals, final FastDiffFilter filter) {
final RuntimeException found = new RuntimeException();
try {
- accept(traversals, new IDiffVisitor() {
- public boolean visit(IDiff delta) {
- if (filter.select(delta)) {
- throw found;
- }
- return false;
+ accept(traversals, delta -> {
+ if (filter.select(delta)) {
+ throw found;
}
-
+ return false;
});
} catch (RuntimeException e) {
if (e == found)
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationContext.java
index 627e5afc6..915d5efa8 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationContext.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,9 +45,7 @@ public abstract class SynchronizationContext extends PlatformObject implements I
this.diffTree = diffTree;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public ISynchronizationScope getScope() {
return getScopeManager().getScope();
}
@@ -60,16 +58,12 @@ public abstract class SynchronizationContext extends PlatformObject implements I
return manager;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public int getType() {
return type;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void dispose() {
if (cache != null) {
cache.dispose();
@@ -77,9 +71,7 @@ public abstract class SynchronizationContext extends PlatformObject implements I
manager.dispose();
}
- /**
- * {@inheritDoc}
- */
+ @Override
public synchronized ICache getCache() {
if (cache == null) {
cache = new Cache();
@@ -87,16 +79,12 @@ public abstract class SynchronizationContext extends PlatformObject implements I
return cache;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public IResourceDiffTree getDiffTree() {
return diffTree;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void refresh(ResourceMapping[] mappings, IProgressMonitor monitor) throws CoreException {
monitor.beginTask(null, 100);
ISynchronizationScopeManager manager = getScopeManager();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java
index 997b0604a..6127884e4 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.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
@@ -78,7 +78,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
public static ResourceMapping[] getMappingsFromProviders(ResourceTraversal[] traversals,
ResourceMappingContext context,
IProgressMonitor monitor) throws CoreException {
- Set result = new HashSet();
+ Set<ResourceMapping> result = new HashSet<>();
IModelProviderDescriptor[] descriptors = ModelProvider
.getModelProviderDescriptors();
for (int i = 0; i < descriptors.length; i++) {
@@ -88,7 +88,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
result.addAll(Arrays.asList(mappings));
Policy.checkCanceled(monitor);
}
- return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
+ return result.toArray(new ResourceMapping[result.size()]);
}
private static ResourceMapping[] getMappings(IModelProviderDescriptor descriptor,
@@ -119,9 +119,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
scope = createScope(inputMappings);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingScopeManager#isInitialized()
- */
+ @Override
public boolean isInitialized() {
return initialized;
}
@@ -135,7 +133,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
* the scope
*/
public ISchedulingRule getSchedulingRule() {
- Set projects = new HashSet();
+ Set<IProject> projects = new HashSet<>();
ResourceMapping[] mappings = scope.getInputMappings();
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
@@ -154,29 +152,27 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
return ResourcesPlugin.getWorkspace().getRoot();
}
}
- return MultiRule.combine((IProject[]) projects.toArray(new IProject[projects.size()]));
+ return MultiRule.combine(projects.toArray(new IProject[projects.size()]));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingScopeManager#initialize(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void initialize(
IProgressMonitor monitor) throws CoreException {
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
internalPrepareContext(monitor);
}
}, getSchedulingRule(), IResource.NONE, monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingScopeManager#refresh(org.eclipse.core.resources.mapping.ResourceMapping[], org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public ResourceTraversal[] refresh(final ResourceMapping[] mappings, IProgressMonitor monitor) throws CoreException {
// We need to lock the workspace when building the scope
final ResourceTraversal[][] traversals = new ResourceTraversal[][] { new ResourceTraversal[0] };
IWorkspace workspace = ResourcesPlugin.getWorkspace();
workspace.run(new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
traversals[0] = internalRefreshScope(mappings, true, monitor);
}
@@ -414,7 +410,7 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
ResourceMapping[] inputMappings = scope.getInputMappings();
ResourceMapping[] mappings = scope.getMappings();
if (inputMappings.length == mappings.length) {
- Set testSet = new HashSet();
+ Set<ResourceMapping> testSet = new HashSet<>();
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
testSet.add(mapping);
@@ -430,23 +426,16 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
return true;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingScopeManager#getContext()
- */
public ResourceMappingContext getContext() {
return context;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingScopeManager#getScope()
- */
+ @Override
public ISynchronizationScope getScope() {
return scope;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingScopeManager#dispose()
- */
+ @Override
public void dispose() {
if (handler != null)
handler.shutdown();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.java
index ac56cb31d..75eeb7466 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberChangeEvent.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
@@ -39,23 +39,17 @@ public class SubscriberChangeEvent implements ISubscriberChangeEvent {
this.resource = resource;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberChangeEvent#getFlags()
- */
+ @Override
public int getFlags() {
return flags;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberChangeEvent#getResource()
- */
+ @Override
public IResource getResource() {
return resource;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberChangeEvent#getSubscriber()
- */
+ @Override
public Subscriber getSubscriber() {
return subscriber;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.java
index 7ff35bd3f..58a7b146e 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberMergeContext.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
@@ -73,9 +73,7 @@ public abstract class SubscriberMergeContext extends MergeContext {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.ISynchronizationContext#refresh(org.eclipse.core.resources.mapping.ResourceTraversal[], int, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void refresh(ResourceTraversal[] traversals, int flags,
IProgressMonitor monitor) throws CoreException {
GroupProgressMonitor group = getGroup(monitor);
@@ -96,9 +94,7 @@ public abstract class SubscriberMergeContext extends MergeContext {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.provider.SynchronizationContext#dispose()
- */
+ @Override
public void dispose() {
handler.shutdown();
super.dispose();
@@ -132,12 +128,11 @@ public abstract class SubscriberMergeContext extends MergeContext {
handler.run(runnable, false);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == SubscriberDiffTreeEventHandler.class)
- return handler;
+ return (T) handler;
return super.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.java
index 9aaadbf66..0ac945164 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberResourceMappingContext.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
@@ -34,8 +34,8 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
private final Subscriber subscriber;
// Lists used to keep track of resources that have been refreshed
- private Set shallowRefresh = new HashSet();
- private Set deepRefresh = new HashSet();
+ private Set<IResource> shallowRefresh = new HashSet<>();
+ private Set<IResource> deepRefresh = new HashSet<>();
private boolean autoRefresh;
/**
@@ -60,10 +60,8 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
this.autoRefresh = autoRefresh;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.internal.resources.mapping.RemoteResourceMappingContext#hasRemoteChange(org.eclipse.core.resources.IResource, org.eclipse.core.runtime.IProgressMonitor)
- */
- public final boolean hasRemoteChange(IResource resource, IProgressMonitor monitor) throws CoreException {
+ @Override
+ public final boolean hasRemoteChange(IResource resource, IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask(null, 100);
ensureRefreshed(resource, IResource.DEPTH_ONE, NONE, monitor);
@@ -77,20 +75,16 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.internal.resources.mapping.RemoteResourceMappingContext#hasLocalChange(org.eclipse.core.resources.IResource, org.eclipse.core.runtime.IProgressMonitor)
- */
- public boolean hasLocalChange(IResource resource, IProgressMonitor monitor) throws CoreException {
+ @Override
+ public boolean hasLocalChange(IResource resource, IProgressMonitor monitor) throws CoreException {
SyncInfo syncInfo = subscriber.getSyncInfo(resource);
if (syncInfo == null) return false;
int direction = SyncInfo.getDirection(syncInfo.getKind());
return direction == SyncInfo.OUTGOING || direction == SyncInfo.CONFLICTING;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.ResourceMappingContext#fetchContents(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor)
- */
- public final IStorage fetchRemoteContents(IFile file, IProgressMonitor monitor) throws CoreException {
+ @Override
+ public final IStorage fetchRemoteContents(IFile file, IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask(null, 100);
ensureRefreshed(file, IResource.DEPTH_ZERO, FILE_CONTENTS_REQUIRED, Policy.subMonitorFor(monitor, 10));
@@ -105,10 +99,8 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.internal.resources.mapping.RemoteResourceMappingContext#fetchBaseContents(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor)
- */
- public final IStorage fetchBaseContents(IFile file, IProgressMonitor monitor) throws CoreException {
+ @Override
+ public final IStorage fetchBaseContents(IFile file, IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask(null, 100);
ensureRefreshed(file, IResource.DEPTH_ZERO, FILE_CONTENTS_REQUIRED, Policy.subMonitorFor(monitor, 10));
@@ -123,10 +115,8 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.ResourceMappingContext#fetchMembers(org.eclipse.core.resources.IContainer, org.eclipse.core.runtime.IProgressMonitor)
- */
- public final IResource[] fetchMembers(IContainer container, IProgressMonitor monitor) throws CoreException {
+ @Override
+ public final IResource[] fetchMembers(IContainer container, IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask(null, 100);
ensureRefreshed(container, IResource.DEPTH_ONE, NONE, Policy.subMonitorFor(monitor, 100));
@@ -141,10 +131,8 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.ResourceMappingContext#refresh(org.eclipse.core.resources.mapping.ResourceTraversal[], int, org.eclipse.core.runtime.IProgressMonitor)
- */
- public final void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException {
+ @Override
+ public final void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException {
subscriber.refresh(traversals, monitor);
for (int i = 0; i < traversals.length; i++) {
ResourceTraversal traversal = traversals[i];
@@ -278,27 +266,23 @@ public class SubscriberResourceMappingContext extends RemoteResourceMappingConte
this.autoRefresh = autoRefresh;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.RemoteResourceMappingContext#isThreeWay()
- */
+ @Override
public boolean isThreeWay() {
return subscriber.getResourceComparator().isThreeWay();
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.RemoteResourceMappingContext#contentDiffers(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor)
- */
public boolean contentDiffers(IFile file, IProgressMonitor monitor) throws CoreException {
return hasRemoteChange(file, monitor) || hasLocalChange(file, monitor);
}
+ @Override
public IProject[] getProjects() {
- Set projects = new HashSet();
+ Set<IProject> projects = new HashSet<>();
IResource[] roots = subscriber.roots();
for (int i = 0; i < roots.length; i++) {
IResource resource = roots[i];
projects.add(resource.getProject());
}
- return (IProject[]) projects.toArray(new IProject[projects.size()]);
+ return projects.toArray(new IProject[projects.size()]);
}
}
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 b67c8bc0b..a5d032422 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
@@ -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
@@ -61,9 +61,7 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
return subscriber;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingScopeManager#dispose()
- */
+ @Override
public void dispose() {
for (Iterator iter = participants.values().iterator(); iter.hasNext();) {
ISynchronizationScopeParticipant p = (ISynchronizationScopeParticipant) iter.next();
@@ -72,11 +70,10 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.provider.ResourceMappingScopeManager#initialize(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @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();
@@ -85,12 +82,11 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
}, getSchedulingRule(), IResource.NONE, monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.provider.ResourceMappingScopeManager#refresh(org.eclipse.core.resources.mapping.ResourceMapping[], org.eclipse.core.runtime.IProgressMonitor)
- */
+ @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();
@@ -132,12 +128,10 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISubscriberChangeListener#subscriberResourceChanged(org.eclipse.team.core.subscribers.ISubscriberChangeEvent[])
- */
+ @Override
public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
- List changedResources = new ArrayList();
- List changedProjects = new ArrayList();
+ List<IResource> changedResources = new ArrayList<>();
+ List<IProject> changedProjects = new ArrayList<>();
for (int i = 0; i < deltas.length; i++) {
ISubscriberChangeEvent event = deltas[i];
if ((event.getFlags() & (ISubscriberChangeEvent.ROOT_ADDED | ISubscriberChangeEvent.ROOT_REMOVED)) != 0) {
@@ -147,7 +141,7 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
changedResources.add(event.getResource());
}
}
- fireChange((IResource[]) changedResources.toArray(new IResource[changedResources.size()]), (IProject[]) changedProjects.toArray(new IProject[changedProjects.size()]));
+ fireChange(changedResources.toArray(new IResource[changedResources.size()]), changedProjects.toArray(new IProject[changedProjects.size()]));
}
private void fireChange(final IResource[] resources, final IProject[] projects) {
@@ -156,6 +150,7 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
for (int i = 0; i < handlers.length; i++) {
final ISynchronizationScopeParticipant participant = handlers[i];
SafeRunner.run(new ISafeRunnable() {
+ @Override
public void run() throws Exception {
ResourceMapping[] mappings = participant.handleContextChange(SubscriberScopeManager.this.getScope(), resources, projects);
for (int j = 0; j < mappings.length; j++) {
@@ -163,6 +158,7 @@ public class SubscriberScopeManager extends SynchronizationScopeManager implemen
result.add(mapping);
}
}
+ @Override
public void handleException(Throwable exception) {
// Handled by platform
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.java
index 8f43e3432..c7cac9530 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfo.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
@@ -281,9 +281,7 @@ public class SyncInfo implements IAdaptable {
return kind & CHANGE_MASK;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ @Override
public boolean equals(Object other) {
if(other == this) return true;
if(other instanceof SyncInfo) {
@@ -292,9 +290,7 @@ public class SyncInfo implements IAdaptable {
return false;
}
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
+ @Override
public int hashCode() {
return getLocal().hashCode();
}
@@ -340,19 +336,16 @@ public class SyncInfo implements IAdaptable {
return o1.equals(o2);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IResource.class) {
- return getLocal();
+ return (T) getLocal();
}
return null;
}
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ @Override
public String toString() {
return getLocal().getName() + " " + kindToString(getKind()); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
index 8bf17b4ff..9ef599a08 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.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
@@ -37,13 +37,13 @@ import org.eclipse.team.internal.core.subscribers.SyncInfoStatistics;
public class SyncInfoSet {
// fields used to hold resources of interest
// {IPath -> SyncInfo}
- private Map resources = Collections.synchronizedMap(new HashMap());
+ private Map<IPath, SyncInfo> resources = Collections.synchronizedMap(new HashMap<>());
// keep track of number of sync kinds in the set
private SyncInfoStatistics statistics = new SyncInfoStatistics();
// keep track of errors that occurred while trying to populate the set
- private Map errors = new HashMap();
+ private Map<IResource, ITeamStatus> errors = new HashMap<>();
private boolean lockedForModification;
@@ -73,7 +73,7 @@ public class SyncInfoSet {
* @return an array of <code>SyncInfo</code>
*/
public synchronized SyncInfo[] getSyncInfos() {
- return (SyncInfo[]) resources.values().toArray(new SyncInfo[resources.size()]);
+ return resources.values().toArray(new SyncInfo[resources.size()]);
}
/**
@@ -85,12 +85,12 @@ public class SyncInfoSet {
*/
public IResource[] getResources() {
SyncInfo[] infos = getSyncInfos();
- List resources = new ArrayList();
+ List<IResource> resources = new ArrayList<>();
for (int i = 0; i < infos.length; i++) {
SyncInfo info = infos[i];
resources.add(info.getLocal());
}
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
+ return resources.toArray(new IResource[resources.size()]);
}
/**
@@ -102,7 +102,7 @@ public class SyncInfoSet {
* the resource is in-sync or doesn't have synchronization information in this set.
*/
public synchronized SyncInfo getSyncInfo(IResource resource) {
- return (SyncInfo)resources.get(resource.getFullPath());
+ return resources.get(resource.getFullPath());
}
/**
@@ -161,7 +161,7 @@ public class SyncInfoSet {
Assert.isTrue(!lockedForModification);
IResource local = info.getLocal();
IPath path = local.getFullPath();
- SyncInfo oldSyncInfo = (SyncInfo)resources.put(path, info);
+ SyncInfo oldSyncInfo = resources.put(path, info);
if(oldSyncInfo == null) {
statistics.add(info);
} else {
@@ -179,7 +179,7 @@ public class SyncInfoSet {
protected synchronized SyncInfo internalRemove(IResource resource) {
Assert.isTrue(!lockedForModification);
IPath path = resource.getFullPath();
- SyncInfo info = (SyncInfo)resources.remove(path);
+ SyncInfo info = resources.remove(path);
if (info != null) {
statistics.remove(info);
}
@@ -271,22 +271,20 @@ public class SyncInfoSet {
* @param monitor a progress monitor
*/
public void connect(final ISyncInfoSetChangeListener listener, IProgressMonitor monitor) {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- try {
- monitor.beginTask(null, 100);
- addSyncSetChangedListener(listener);
- listener.syncInfoSetReset(SyncInfoSet.this, Policy.subMonitorFor(monitor, 95));
- } finally {
- monitor.done();
- }
+ run(monitor1 -> {
+ try {
+ monitor1.beginTask(null, 100);
+ addSyncSetChangedListener(listener);
+ listener.syncInfoSetReset(SyncInfoSet.this, Policy.subMonitorFor(monitor1, 95));
+ } finally {
+ monitor1.done();
}
}, monitor);
}
private ILock lock = Job.getJobManager().newLock();
- private Set listeners = Collections.synchronizedSet(new HashSet());
+ private Set<ISyncInfoSetChangeListener> listeners = Collections.synchronizedSet(new HashSet<>());
private SyncInfoSetChangeEvent changes = createEmptyChangeEvent();
@@ -455,7 +453,7 @@ public class SyncInfoSet {
* @return the nodes that match the filter
*/
public SyncInfo[] getNodes(FastSyncInfoFilter filter) {
- List result = new ArrayList();
+ List<SyncInfo> result = new ArrayList<>();
SyncInfo[] infos = getSyncInfos();
for (int i = 0; i < infos.length; i++) {
SyncInfo info = infos[i];
@@ -463,7 +461,7 @@ public class SyncInfoSet {
result.add(info);
}
}
- return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]);
+ return result.toArray(new SyncInfo[result.size()]);
}
/**
@@ -562,9 +560,11 @@ public class SyncInfoSet {
for (int i = 0; i < allListeners.length; i++) {
final ISyncInfoSetChangeListener 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 {
try {
lockedForModification = true;
@@ -592,7 +592,7 @@ public class SyncInfoSet {
protected ISyncInfoSetChangeListener[] getListeners() {
ISyncInfoSetChangeListener[] allListeners;
synchronized(listeners) {
- allListeners = (ISyncInfoSetChangeListener[]) listeners.toArray(new ISyncInfoSetChangeListener[listeners.size()]);
+ allListeners = listeners.toArray(new ISyncInfoSetChangeListener[listeners.size()]);
}
return allListeners;
}
@@ -641,7 +641,7 @@ public class SyncInfoSet {
* @return the errors
*/
public ITeamStatus[] getErrors() {
- return (ITeamStatus[]) errors.values().toArray(new ITeamStatus[errors.size()]);
+ return errors.values().toArray(new ITeamStatus[errors.size()]);
}
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
index 16bfef87c..e06838150 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoTree.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
@@ -40,7 +40,7 @@ import org.eclipse.team.internal.core.subscribers.SyncInfoTreeChangeEvent;
*/
public class SyncInfoTree extends SyncInfoSet {
- protected Map parents = Collections.synchronizedMap(new HashMap());
+ protected Map<IPath, Set<IResource>> parents = Collections.synchronizedMap(new HashMap<>());
/**
* Create an empty sync info tree.
@@ -76,7 +76,7 @@ public class SyncInfoTree extends SyncInfoSet {
IContainer parent = (IContainer)resource;
if (parent.getType() == IResource.ROOT) return !isEmpty();
IPath path = parent.getFullPath();
- Set allDescendants = (Set)parents.get(path);
+ Set allDescendants = parents.get(path);
return (allDescendants != null && !allDescendants.isEmpty());
}
@@ -108,7 +108,7 @@ public class SyncInfoTree extends SyncInfoSet {
}
}
if (depth == IResource.DEPTH_ONE) {
- List result = new ArrayList();
+ List<SyncInfo> result = new ArrayList<>();
SyncInfo info = getSyncInfo(resource);
if (info != null) {
result.add(info);
@@ -121,7 +121,7 @@ public class SyncInfoTree extends SyncInfoSet {
result.add(info);
}
}
- return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]);
+ return result.toArray(new SyncInfo[result.size()]);
}
// if it's the root then return all out of sync resources.
if(resource.getType() == IResource.ROOT) {
@@ -138,7 +138,7 @@ public class SyncInfoTree extends SyncInfoSet {
* @return the <code>SyncInfo</code> for all out-of-sync resources at or below the given resource
*/
private synchronized SyncInfo[] internalGetDeepSyncInfo(IContainer resource) {
- List infos = new ArrayList();
+ List<SyncInfo> infos = new ArrayList<>();
IResource[] children = internalGetOutOfSyncDescendants(resource);
for (int i = 0; i < children.length; i++) {
IResource child = children[i];
@@ -149,20 +149,15 @@ public class SyncInfoTree extends SyncInfoSet {
TeamPlugin.log(IStatus.INFO, Messages.SyncInfoTree_0 + child.getFullPath(), null);
}
}
- return (SyncInfo[]) infos.toArray(new SyncInfo[infos.size()]);
+ return infos.toArray(new SyncInfo[infos.size()]);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.SyncInfoSet#createEmptyChangeEvent()
- */
+ @Override
protected SyncInfoSetChangeEvent createEmptyChangeEvent() {
return new SyncInfoTreeChangeEvent(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.SyncInfoSet#add(org.eclipse.team.core.synchronize.SyncInfo)
- */
+ @Override
public void add(SyncInfo info) {
try {
beginInput();
@@ -177,9 +172,7 @@ public class SyncInfoTree extends SyncInfoSet {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.SyncInfoSet#remove(org.eclipse.core.resources.IResource)
- */
+ @Override
public void remove(IResource resource) {
try {
beginInput();
@@ -191,9 +184,7 @@ public class SyncInfoTree extends SyncInfoSet {
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.synchronize.SyncInfoSet#clear()
- */
+ @Override
public void clear() {
try {
beginInput();
@@ -216,9 +207,9 @@ public class SyncInfoTree extends SyncInfoSet {
// the file is new
addedParent = true;
} else {
- Set children = (Set)parents.get(parent.getFullPath());
+ Set<IResource> children = parents.get(parent.getFullPath());
if (children == null) {
- children = new HashSet();
+ children = new HashSet<>();
parents.put(parent.getFullPath(), children);
// this is a new folder in the sync set
addedParent = true;
@@ -242,7 +233,7 @@ public class SyncInfoTree extends SyncInfoSet {
// the file will be removed
removedParent = true;
} else {
- Set children = (Set)parents.get(parent.getFullPath());
+ Set<IResource> children = parents.get(parent.getFullPath());
if (children != null) {
children.remove(resource);
if (children.isEmpty()) {
@@ -309,14 +300,14 @@ public class SyncInfoTree extends SyncInfoSet {
*/
protected synchronized IResource[] internalGetOutOfSyncDescendants(IContainer resource) {
// The parent map contains a set of all out-of-sync children
- Set allChildren = (Set)parents.get(resource.getFullPath());
+ Set<IResource> allChildren = parents.get(resource.getFullPath());
if (allChildren == null) return new IResource[0];
- return (IResource[]) allChildren.toArray(new IResource[allChildren.size()]);
+ return allChildren.toArray(new IResource[allChildren.size()]);
}
private synchronized IResource[] internalMembers(IWorkspaceRoot root) {
Set possibleChildren = parents.keySet();
- Set children = new HashSet();
+ Set<IResource> children = new HashSet<>();
for (Iterator it = possibleChildren.iterator(); it.hasNext();) {
Object next = it.next();
IResource element = root.findMember((IPath)next);
@@ -324,7 +315,7 @@ public class SyncInfoTree extends SyncInfoSet {
children.add(element.getProject());
}
}
- return (IResource[]) children.toArray(new IResource[children.size()]);
+ return children.toArray(new IResource[children.size()]);
}
/**
@@ -341,9 +332,9 @@ public class SyncInfoTree extends SyncInfoSet {
if (parent.getType() == IResource.ROOT) return internalMembers((IWorkspaceRoot)parent);
// OPTIMIZE: could be optimized so that we don't traverse all the deep
// children to find the immediate ones.
- Set children = new HashSet();
+ Set<IResource> children = new HashSet<>();
IPath path = parent.getFullPath();
- Set possibleChildren = (Set)parents.get(path);
+ Set possibleChildren = parents.get(path);
if(possibleChildren != null) {
for (Iterator it = possibleChildren.iterator(); it.hasNext();) {
Object next = it.next();
@@ -362,7 +353,7 @@ public class SyncInfoTree extends SyncInfoSet {
}
}
}
- return (IResource[]) children.toArray(new IResource[children.size()]);
+ return children.toArray(new IResource[children.size()]);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/CachedResourceVariant.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/CachedResourceVariant.java
index f5fd05872..2cf97e4ba 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/CachedResourceVariant.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/CachedResourceVariant.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
@@ -56,6 +56,7 @@ public abstract class CachedResourceVariant extends PlatformObject implements IR
* of this resource variant
*/
class ResourceVariantStorage implements IEncodedStorage {
+ @Override
public InputStream getContents() throws CoreException {
if (!isContentsCached()) {
// The cache may have been cleared if someone held
@@ -64,18 +65,23 @@ public abstract class CachedResourceVariant extends PlatformObject implements IR
}
return getCachedContents();
}
+ @Override
public IPath getFullPath() {
return getDisplayPath();
}
+ @Override
public String getName() {
return CachedResourceVariant.this.getName();
}
+ @Override
public boolean isReadOnly() {
return true;
}
- public Object getAdapter(Class adapter) {
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
return CachedResourceVariant.this.getAdapter(adapter);
}
+ @Override
public String getCharset() throws CoreException {
InputStream contents = getContents();
try {
@@ -96,6 +102,7 @@ public abstract class CachedResourceVariant extends PlatformObject implements IR
/* (non-Javadoc)
* @see org.eclipse.team.core.variants.IResourceVariant#getStorage(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public IStorage getStorage(IProgressMonitor monitor) throws TeamException {
if (isContainer()) return null;
ensureContentsCached(monitor);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/IResourceVariant.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/IResourceVariant.java
index 9685f54eb..2c31a9183 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/IResourceVariant.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/IResourceVariant.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
@@ -80,6 +80,7 @@ public interface IResourceVariant {
* @param object the object to be compared
* @return whether the object is equal to the remote resource
*/
+ @Override
public boolean equals(Object object);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.java
index ddc2bae32..d1c168130 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/SessionResourceVariantByteStore.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
@@ -27,28 +27,22 @@ import org.eclipse.team.core.TeamException;
public class SessionResourceVariantByteStore extends ResourceVariantByteStore {
private static final byte[] NO_REMOTE = new byte[0];
- private Map membersCache = new HashMap();
+ private Map<IResource, List<IResource>> membersCache = new HashMap<>();
- private Map syncBytesCache = new HashMap();
+ private Map<IResource, byte[]> syncBytesCache = new HashMap<>();
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#deleteBytes(org.eclipse.core.resources.IResource)
- */
+ @Override
public boolean deleteBytes(IResource resource) throws TeamException {
return flushBytes(resource, IResource.DEPTH_ZERO);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#dispose()
- */
+ @Override
public void dispose() {
syncBytesCache.clear();
membersCache.clear();
}
- /* (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 (getSyncBytesCache().containsKey(resource)) {
if (depth != IResource.DEPTH_ZERO) {
@@ -65,9 +59,7 @@ public class SessionResourceVariantByteStore extends ResourceVariantByteStore {
return false;
}
- /* (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)) {
@@ -85,20 +77,16 @@ public class SessionResourceVariantByteStore extends ResourceVariantByteStore {
return syncBytesCache.isEmpty();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantByteStore#members(org.eclipse.core.resources.IResource)
- */
+ @Override
public IResource[] members(IResource resource) {
- List members = (List)membersCache.get(resource);
+ List<IResource> members = membersCache.get(resource);
if (members == null) {
return new IResource[0];
}
- return (IResource[]) members.toArray(new IResource[members.size()]);
+ return members.toArray(new IResource[members.size()]);
}
- /* (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);
@@ -107,28 +95,28 @@ public class SessionResourceVariantByteStore extends ResourceVariantByteStore {
return true;
}
- private Map getSyncBytesCache() {
+ private Map<IResource, byte[]> getSyncBytesCache() {
return syncBytesCache;
}
private void internalAddToParent(IResource resource) {
IContainer parent = resource.getParent();
if (parent == null) return;
- List members = (List)membersCache.get(parent);
+ List<IResource> members = membersCache.get(parent);
if (members == null) {
- members = new ArrayList();
+ members = new ArrayList<>();
membersCache.put(parent, members);
}
members.add(resource);
}
private byte[] internalGetSyncBytes(IResource resource) {
- return (byte[])getSyncBytesCache().get(resource);
+ return getSyncBytesCache().get(resource);
}
private void internalRemoveFromParent(IResource resource) {
IContainer parent = resource.getParent();
- List members = (List)membersCache.get(parent);
+ List members = membersCache.get(parent);
if (members != null) {
members.remove(resource);
if (members.isEmpty()) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayRemoteTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayRemoteTree.java
index 87279ebc9..565f8704b 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayRemoteTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayRemoteTree.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
@@ -39,15 +39,19 @@ public abstract class ThreeWayRemoteTree extends ResourceVariantTree {
public RemoteResourceVariantByteStore(ThreeWaySynchronizer synchronizer) {
this.synchronizer = synchronizer;
}
+ @Override
public void dispose() {
// Nothing to do as contents are owned by the TargetSynchronizer
}
+ @Override
public byte[] getBytes(IResource resource) throws TeamException {
return getSynchronizer().getRemoteBytes(resource);
}
+ @Override
public boolean setBytes(IResource resource, byte[] bytes) throws TeamException {
return getSynchronizer().setRemoteBytes(resource, bytes);
}
+ @Override
public boolean flushBytes(IResource resource, int depth) throws TeamException {
// This method is invoked when the remote bytes are stale and should be removed
// This is handled by the ThreeWaySynchronizer so nothing needs to be done here.
@@ -56,9 +60,11 @@ public abstract class ThreeWayRemoteTree extends ResourceVariantTree {
public boolean isVariantKnown(IResource resource) throws TeamException {
return getSynchronizer().hasSyncBytes(resource);
}
+ @Override
public boolean deleteBytes(IResource resource) throws TeamException {
return getSynchronizer().removeRemoteBytes(resource);
}
+ @Override
public IResource[] members(IResource resource) throws TeamException {
return synchronizer.members(resource);
}
@@ -78,16 +84,12 @@ public abstract class ThreeWayRemoteTree extends ResourceVariantTree {
this.subscriber = subscriber;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.IResourceVariantTree#roots()
- */
+ @Override
public IResource[] roots() {
return getSubscriber().roots();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.IResourceVariantTree#getResourceVariant(org.eclipse.core.resources.IResource)
- */
+ @Override
public IResourceVariant getResourceVariant(IResource resource) throws TeamException {
return getSubscriber().getResourceVariant(resource, getByteStore().getBytes(resource));
}
@@ -100,14 +102,13 @@ public abstract class ThreeWayRemoteTree extends ResourceVariantTree {
return subscriber;
}
- /* (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 };
getSubscriber().getSynchronizer().run(local, new IWorkspaceRunnable() {
+ @Override
public void run(IProgressMonitor monitor) throws CoreException {
resources[0] = ThreeWayRemoteTree.super.collectChanges(local, remote, depth, monitor);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.java
index 87d200e39..64e9376ce 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySubscriber.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
@@ -52,16 +52,12 @@ public abstract class ThreeWaySubscriber extends ResourceVariantTreeSubscriber i
getSynchronizer().addListener(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantTreeSubscriber#getBaseTree()
- */
+ @Override
protected final IResourceVariantTree getBaseTree() {
return baseTree;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ResourceVariantTreeSubscriber#getRemoteTree()
- */
+ @Override
protected final IResourceVariantTree getRemoteTree() {
if (remoteTree == null) {
remoteTree = createRemoteTree();
@@ -69,9 +65,7 @@ public abstract class ThreeWaySubscriber extends ResourceVariantTreeSubscriber i
return remoteTree;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.Subscriber#getResourceComparator()
- */
+ @Override
public final IResourceVariantComparator getResourceComparator() {
if (comparator == null) {
comparator = new ThreeWayResourceComparator(this.getSynchronizer());
@@ -79,9 +73,7 @@ public abstract class ThreeWaySubscriber extends ResourceVariantTreeSubscriber i
return comparator;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.ISynchronizerChangeListener#syncStateChanged(org.eclipse.core.resources.IResource[])
- */
+ @Override
public void syncStateChanged(IResource[] resources) {
fireTeamResourceChange(SubscriberChangeEvent.asSyncChangedDeltas(this, resources));
}
@@ -93,6 +85,7 @@ public abstract class ThreeWaySubscriber extends ResourceVariantTreeSubscriber i
* <code>true</code> otherwise.
* @see org.eclipse.team.core.subscribers.Subscriber#isSupervised(IResource)
*/
+ @Override
public boolean isSupervised(IResource resource) throws TeamException {
if (!isChildOfRoot(resource)) return false;
if (getSynchronizer().isIgnored(resource)) return false;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.java
index 8bf860306..a69f71812 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWaySynchronizer.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
@@ -43,6 +43,7 @@ public class ThreeWaySynchronizer {
*
* @see BatchingLock#flush(IProgressMonitor)
*/
+ @Override
public void flush(ThreadInfo info, IProgressMonitor monitor)
throws TeamException {
if (info != null && !info.isEmpty()) {
@@ -56,7 +57,7 @@ public class ThreeWaySynchronizer {
private ILock lock = Job.getJobManager().newLock();
private BatchingLock batchingLock = new BatchingLock();
private ResourceVariantByteStore cache;
- private Set listeners = new HashSet();
+ private Set<ISynchronizerChangeListener> listeners = new HashSet<>();
/**
* Create a three-way synchronizer that uses a persistent
@@ -329,20 +330,19 @@ public class ThreeWaySynchronizer {
return new IResource[0];
}
try {
- Set potentialChildren = new HashSet();
+ Set<IResource> potentialChildren = new HashSet<>();
IContainer container = (IContainer)resource;
if (container.exists()) {
potentialChildren.addAll(Arrays.asList(container.members()));
}
potentialChildren.addAll(Arrays.asList(cache.members(resource)));
- List result = new ArrayList();
- for (Iterator iter = potentialChildren.iterator(); iter.hasNext();) {
- IResource child = (IResource) iter.next();
+ List<IResource> result = new ArrayList<>();
+ for (IResource child : potentialChildren) {
if (child.exists() || hasSyncBytes(child)) {
result.add(child);
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
} catch (CoreException e) {
throw TeamException.asTeamException(e);
}
@@ -398,15 +398,17 @@ public class ThreeWaySynchronizer {
ISynchronizerChangeListener[] allListeners;
// Copy the listener list so we're not calling client code while synchronized
synchronized(listeners) {
- allListeners = (ISynchronizerChangeListener[]) listeners.toArray(new ISynchronizerChangeListener[listeners.size()]);
+ allListeners = listeners.toArray(new ISynchronizerChangeListener[listeners.size()]);
}
// Notify the listeners safely so all will receive notification
for (int i = 0; i < allListeners.length; i++) {
final ISynchronizerChangeListener 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.syncStateChanged(resources);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/AdapterFactory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/AdapterFactory.java
index f9177ad19..9b5ca39cb 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/AdapterFactory.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/AdapterFactory.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
@@ -17,21 +17,18 @@ import org.eclipse.team.internal.core.mapping.ModelProviderResourceMapping;
public class AdapterFactory implements IAdapterFactory {
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adaptableObject instanceof ModelProvider && adapterType == ResourceMapping.class) {
ModelProvider mp = (ModelProvider) adaptableObject;
- return new ModelProviderResourceMapping(mp);
+ return (T) new ModelProviderResourceMapping(mp);
}
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
+ @Override
+ public Class<?>[] getAdapterList() {
return new Class[] { ResourceMapping.class};
}
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 82b522361..82eb1c4a5 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
@@ -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
@@ -101,6 +101,7 @@ public abstract class BackgroundEventHandler {
public int getType() {
return type;
}
+ @Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("Background Event: "); //$NON-NLS-1$
@@ -129,9 +130,11 @@ public abstract class BackgroundEventHandler {
public int getDepth() {
return depth;
}
+ @Override
public IResource getResource() {
return resource;
}
+ @Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("resource: "); //$NON-NLS-1$
@@ -199,20 +202,25 @@ public abstract class BackgroundEventHandler {
*/
protected void createEventHandlingJob() {
eventHandlerJob = new Job(getName()) {
+ @Override
public IStatus run(IProgressMonitor monitor) {
return processEvents(monitor);
}
+ @Override
public boolean shouldRun() {
return ! isQueueEmpty();
}
+ @Override
public boolean shouldSchedule() {
return ! isQueueEmpty();
}
+ @Override
public boolean belongsTo(Object family) {
return BackgroundEventHandler.this.belongsTo(family);
}
};
eventHandlerJob.addJobChangeListener(new JobChangeAdapter() {
+ @Override
public void done(IJobChangeEvent event) {
jobDone(event);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java
index e578f4cf6..b01abf667 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/Cache.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
@@ -27,28 +27,25 @@ import org.eclipse.team.core.ICacheListener;
*/
public class Cache implements ICache {
- Map properties;
- ListenerList listeners;
+ Map<String, Object> properties;
+ ListenerList<ICacheListener> listeners;
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext#addProperty(java.lang.String, java.lang.Object)
- */
+ @Override
public synchronized void put(String name, Object value) {
if (properties == null) {
- properties = new HashMap();
+ properties = new HashMap<>();
}
properties.put(name, value);
}
+ @Override
public synchronized Object get(String name) {
if (properties == null)
return null;
return properties.get(name);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext#removeProperty(java.lang.String)
- */
+ @Override
public synchronized void remove(String name) {
if (properties != null)
properties.remove(name);
@@ -58,43 +55,34 @@ public class Cache implements ICache {
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext#addDisposeListener(org.eclipse.team.ui.mapping.IDisposeListener)
- */
+ @Override
public synchronized void addCacheListener(ICacheListener listener) {
if (listeners == null)
- listeners = new ListenerList(ListenerList.IDENTITY);
+ listeners = new ListenerList<>(ListenerList.IDENTITY);
listeners.add(listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizeOperationContext#removeDisposeListener(org.eclipse.team.ui.mapping.IDisposeListener)
- */
+ @Override
public synchronized void removeDisposeListener(ICacheListener listener) {
removeCacheListener(listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.ICache#removeCacheListener(org.eclipse.team.core.ICacheListener)
- */
+ @Override
public synchronized void removeCacheListener(ICacheListener listener) {
if (listeners != null)
listeners.remove(listener);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.ISynchronizationContext#dispose()
- */
public void dispose() {
if (listeners != null) {
- Object[] allListeners = listeners.getListeners();
- for (int i = 0; i < allListeners.length; i++) {
- final Object listener = allListeners[i];
+ for (ICacheListener listener : listeners) {
SafeRunner.run(new ISafeRunnable(){
+ @Override
public void run() throws Exception {
- ((ICacheListener)listener).cacheDisposed(Cache.this);
+ listener.cacheDisposed(Cache.this);
}
+ @Override
public void handleException(Throwable exception) {
// Ignore since the platform logs the error
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java
index 033ba299d..a14410124 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/DefaultMoveDeleteHook.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,9 +26,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
public class DefaultMoveDeleteHook implements IMoveDeleteHook {
- /**
- * @see IMoveDeleteHook#deleteFile(IResourceTree, IFile, int, IProgressMonitor)
- */
+ @Override
public boolean deleteFile(
IResourceTree tree,
IFile file,
@@ -37,9 +35,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /**
- * @see IMoveDeleteHook#deleteFolder(IResourceTree, IFolder, int, IProgressMonitor)
- */
+ @Override
public boolean deleteFolder(
IResourceTree tree,
IFolder folder,
@@ -48,9 +44,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /**
- * @see IMoveDeleteHook#deleteProject(IResourceTree, IProject, int, IProgressMonitor)
- */
+ @Override
public boolean deleteProject(
IResourceTree tree,
IProject project,
@@ -59,9 +53,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /**
- * @see IMoveDeleteHook#moveFile(IResourceTree, IFile, IFile, int, IProgressMonitor)
- */
+ @Override
public boolean moveFile(
IResourceTree tree,
IFile source,
@@ -71,9 +63,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /**
- * @see IMoveDeleteHook#moveFolder(IResourceTree, IFolder, IFolder, int, IProgressMonitor)
- */
+ @Override
public boolean moveFolder(
IResourceTree tree,
IFolder source,
@@ -83,9 +73,7 @@ public class DefaultMoveDeleteHook implements IMoveDeleteHook {
return false;
}
- /**
- * @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/FileModificationValidatorManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java
index 07a511564..b62b49bab 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/FileModificationValidatorManager.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
@@ -29,11 +29,12 @@ public class FileModificationValidatorManager extends FileModificationValidator
* Ask each provider once for its files.
* Collect the resulting status' and return a MultiStatus.
*/
+ @Override
public IStatus validateEdit(IFile[] files, FileModificationValidationContext context) {
- ArrayList returnStati = new ArrayList();
+ ArrayList<IStatus> returnStati = new ArrayList<>();
//map provider to the files under that provider's control
- Map providersToFiles = new HashMap(files.length);
+ Map<RepositoryProvider, List<IFile>> providersToFiles = new HashMap<>(files.length);
//for each file, determine which provider, map providers to files
for (int i = 0; i < files.length; i++) {
@@ -41,21 +42,21 @@ public class FileModificationValidatorManager extends FileModificationValidator
RepositoryProvider provider = RepositoryProvider.getProvider(file.getProject());
if (!providersToFiles.containsKey(provider)) {
- providersToFiles.put(provider, new ArrayList());
+ providersToFiles.put(provider, new ArrayList<>());
}
- ((ArrayList)providersToFiles.get(provider)).add(file);
+ providersToFiles.get(provider).add(file);
}
- Iterator providersIterator = providersToFiles.keySet().iterator();
+ Iterator<RepositoryProvider> providersIterator = providersToFiles.keySet().iterator();
boolean allOK = true;
//for each provider, validate its files
while(providersIterator.hasNext()) {
- RepositoryProvider provider = (RepositoryProvider)providersIterator.next();
- ArrayList filesList = (ArrayList)providersToFiles.get(provider);
- IFile[] filesArray = (IFile[])filesList.toArray(new IFile[filesList.size()]);
+ RepositoryProvider provider = providersIterator.next();
+ List<IFile> filesList = providersToFiles.get(provider);
+ IFile[] filesArray = filesList.toArray(new IFile[filesList.size()]);
FileModificationValidator validator = getDefaultValidator();
//if no provider or no validator use the default validator
@@ -72,21 +73,14 @@ public class FileModificationValidatorManager extends FileModificationValidator
}
if (returnStati.size() == 1) {
- return (IStatus)returnStati.get(0);
+ return returnStati.get(0);
}
- return new MultiStatus(TeamPlugin.ID,
- 0,
- (IStatus[])returnStati.toArray(new IStatus[returnStati.size()]),
- allOK
- ? Messages.ok
- : Messages.FileModificationValidator_editFailed,
- null);
+ return new MultiStatus(TeamPlugin.ID, 0, returnStati.toArray(new IStatus[returnStati.size()]),
+ allOK ? Messages.ok : Messages.FileModificationValidator_editFailed, null);
}
- /*
- * @see IFileModificationValidator#validateSave(IFile)
- */
+ @Override
public IStatus validateSave(IFile file) {
RepositoryProvider provider = RepositoryProvider.getProvider(file.getProject());
FileModificationValidator validator = getDefaultValidator();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java
index 882620548..17f99cb2a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/NullSubProgressMonitor.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,33 +31,23 @@ public class NullSubProgressMonitor extends SubProgressMonitor {
super(monitor, 0, 0);
}
- /**
- * @see IProgressMonitor#beginTask(String, int)
- */
+ @Override
public void beginTask(String name, int totalWork) {
}
- /**
- * @see IProgressMonitor#done()
- */
+ @Override
public void done() {
}
- /**
- * @see IProgressMonitor#internalWorked(double)
- */
+ @Override
public void internalWorked(double work) {
}
- /**
- * @see IProgressMonitor#subTask(String)
- */
+ @Override
public void subTask(String name) {
}
- /**
- * @see IProgressMonitor#worked(int)
- */
+ @Override
public void worked(int work) {
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PessimisticResourceRuleFactory.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PessimisticResourceRuleFactory.java
index 68bf8e7f8..e7a3d8028 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PessimisticResourceRuleFactory.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/PessimisticResourceRuleFactory.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
@@ -23,52 +23,36 @@ public class PessimisticResourceRuleFactory extends ResourceRuleFactory {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceRuleFactory#copyRule(org.eclipse.core.resources.IResource, org.eclipse.core.resources.IResource)
- */
+ @Override
public ISchedulingRule copyRule(IResource source, IResource destination) {
return root;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceRuleFactory#createRule(org.eclipse.core.resources.IResource)
- */
+ @Override
public ISchedulingRule createRule(IResource resource) {
return root;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceRuleFactory#deleteRule(org.eclipse.core.resources.IResource)
- */
+ @Override
public ISchedulingRule deleteRule(IResource resource) {
return root;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceRuleFactory#modifyRule(org.eclipse.core.resources.IResource)
- */
+ @Override
public ISchedulingRule modifyRule(IResource resource) {
return root;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceRuleFactory#moveRule(org.eclipse.core.resources.IResource, org.eclipse.core.resources.IResource)
- */
+ @Override
public ISchedulingRule moveRule(IResource source, IResource destination) {
return root;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceRuleFactory#refreshRule(org.eclipse.core.resources.IResource)
- */
+ @Override
public ISchedulingRule refreshRule(IResource resource) {
return root;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceRuleFactory#validateEditRule(org.eclipse.core.resources.IResource[])
- */
+ @Override
public ISchedulingRule validateEditRule(IResource[] resources) {
return root;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.team.ResourceRuleFactory#charsetRule(org.eclipse.core.resources.IResource)
- */
+ @Override
public ISchedulingRule charsetRule(IResource resource) {
return root;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
index 8795d504c..3d45864f5 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamPlugin.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
@@ -76,23 +76,19 @@ final public class TeamPlugin extends Plugin {
plugin = this;
}
- /**
- * @see Plugin#start(BundleContext)
- */
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
// register debug options listener
- Hashtable properties = new Hashtable(2);
+ Hashtable<String, String> properties = new Hashtable<>(2);
properties.put(DebugOptions.LISTENER_SYMBOLICNAME, ID);
debugRegistration = context.registerService(DebugOptionsListener.class, Policy.DEBUG_OPTIONS_LISTENER, properties);
Team.startup();
}
- /**
- * @see Plugin#stop(BundleContext)
- */
+ @Override
public void stop(BundleContext context) throws Exception {
try {
// unregister debug options listener
@@ -202,14 +198,14 @@ final public class TeamPlugin extends Plugin {
}
private static IPath[] getPaths(String metaFilePaths) {
- List result = new ArrayList();
+ List<IPath> result = new ArrayList<>();
StringTokenizer t = new StringTokenizer(metaFilePaths, ","); //$NON-NLS-1$
while (t.hasMoreTokens()) {
String next = t.nextToken();
IPath path = new Path(null, next);
result.add(path);
}
- return (IPath[]) result.toArray(new IPath[result.size()]);
+ return result.toArray(new IPath[result.size()]);
}
/**
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java
index f93a0163d..613189dc4 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/TeamResourceChangeListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -8,12 +8,6 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-/*
- * Created on Jan 17, 2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
package org.eclipse.team.internal.core;
import java.util.*;
@@ -29,10 +23,10 @@ import org.eclipse.team.core.RepositoryProviderType;
*/
public final class TeamResourceChangeListener implements IResourceChangeListener {
- private static final Map metaFilePaths; // Map of String (repository id) -> IPath[]
+ private static final Map<String, IPath[]> metaFilePaths; // Map of String (repository id) -> IPath[]
static {
- metaFilePaths = new HashMap();
+ metaFilePaths = new HashMap<>();
String[] ids = RepositoryProvider.getAllProviderTypeIds();
for (int i = 0; i < ids.length; i++) {
String id = ids[i];
@@ -43,6 +37,7 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
}
}
+ @Override
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta[] projectDeltas = event.getDelta().getAffectedChildren();
for (int i = 0; i < projectDeltas.length; i++) {
@@ -70,8 +65,8 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
private void handleUnsharedProjectChanges(IProject project, IResourceDelta delta) {
String repositoryId = null;
- Set metaFileContainers = new HashSet();
- Set badIds = new HashSet();
+ Set<IContainer> metaFileContainers = new HashSet<>();
+ Set<String> badIds = new HashSet<>();
IFile[] files = getAddedFiles(delta);
for (int i = 0; i < files.length; i++) {
IFile file = files[i];
@@ -92,12 +87,12 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
}
if (repositoryId != null) {
RepositoryProviderType type = RepositoryProviderType.getProviderType(repositoryId);
- type.metaFilesDetected(project, (IContainer[]) metaFileContainers.toArray(new IContainer[metaFileContainers.size()]));
+ type.metaFilesDetected(project, metaFileContainers.toArray(new IContainer[metaFileContainers.size()]));
}
}
private IContainer getContainer(String typeId, IFile file) {
- IPath[] paths = (IPath[])metaFilePaths.get(typeId);
+ IPath[] paths = metaFilePaths.get(typeId);
IPath foundPath = null;
IPath projectRelativePath = file.getProjectRelativePath();
for (int i = 0; i < paths.length; i++) {
@@ -119,9 +114,9 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
}
private String getMetaFileType(IFile file) {
- for (Iterator iter = metaFilePaths.keySet().iterator(); iter.hasNext();) {
- String id = (String) iter.next();
- IPath[] paths = (IPath[])metaFilePaths.get(id);
+ for (Iterator<String> iter = metaFilePaths.keySet().iterator(); iter.hasNext();) {
+ String id = iter.next();
+ IPath[] paths = metaFilePaths.get(id);
for (int i = 0; i < paths.length; i++) {
IPath path = paths[i];
if (isSuffix(file.getProjectRelativePath(), path)) {
@@ -144,20 +139,18 @@ public final class TeamResourceChangeListener implements IResourceChangeListener
}
private IFile[] getAddedFiles(IResourceDelta delta) {
- final List result = new ArrayList();
+ final List<IFile> result = new ArrayList<>();
try {
- delta.accept(new IResourceDeltaVisitor() {
- public boolean visit(IResourceDelta delta) throws CoreException {
- if ((delta.getKind() & IResourceDelta.ADDED) != 0
- && delta.getResource().getType() == IResource.FILE) {
- result.add(delta.getResource());
- }
- return true;
+ delta.accept(delta1 -> {
+ if ((delta1.getKind() & IResourceDelta.ADDED) != 0
+ && delta1.getResource().getType() == IResource.FILE) {
+ result.add((IFile) delta1.getResource());
}
+ return true;
});
} catch (CoreException e) {
TeamPlugin.log(IStatus.ERROR, "An error occurred while scanning for meta-file changes", e); //$NON-NLS-1$
}
- return (IFile[]) result.toArray(new IFile[result.size()]);
+ return result.toArray(new IFile[result.size()]);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileRevision.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileRevision.java
index 4b6895b59..1274e0c65 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileRevision.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/history/LocalFileRevision.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
@@ -62,41 +62,31 @@ public class LocalFileRevision extends FileRevision {
this.state = null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.FileRevision#getContentIdentifier()
- */
+ @Override
public String getContentIdentifier() {
if (file != null)
return baseRevision == null ? NLS.bind(Messages.LocalFileRevision_currentVersion, "") : NLS.bind(Messages.LocalFileRevision_currentVersion, baseRevision.getContentIdentifier()); //$NON-NLS-1$
return ""; //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.FileRevision#getAuthor()
- */
+ @Override
public String getAuthor() {
return ""; //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.FileRevision#getComment()
- */
+ @Override
public String getComment() {
if (file != null)
return Messages.LocalFileRevision_currentVersionTag;
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.FileRevision#getTags()
- */
+ @Override
public ITag[] getTags() {
return new ITag[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileState#getStorage(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public IStorage getStorage(IProgressMonitor monitor) throws CoreException {
if (file != null) {
return file;
@@ -104,9 +94,7 @@ public class LocalFileRevision extends FileRevision {
return state;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.history.IFileState#getName()
- */
+ @Override
public String getName() {
if (file != null) {
return file.getName();
@@ -115,9 +103,7 @@ public class LocalFileRevision extends FileRevision {
return state.getName();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.variants.FileState#getTimestamp()
- */
+ @Override
public long getTimestamp() {
if (file != null) {
return file.getLocalTimeStamp();
@@ -131,6 +117,7 @@ public class LocalFileRevision extends FileRevision {
* A LocalFileRevision generally should exist, but if it doesn't, this
* method should tell the truth.
*/
+ @Override
public boolean exists() {
if (file != null) {
return file.exists();
@@ -147,11 +134,13 @@ public class LocalFileRevision extends FileRevision {
this.baseRevision = baseRevision;
}
+ @Override
public boolean isPropertyMissing() {
return true;
}
+ @Override
public IFileRevision withAllProperties(IProgressMonitor monitor) {
return this;
}
@@ -166,6 +155,7 @@ public class LocalFileRevision extends FileRevision {
return (this.getTimestamp() > compareRevisionTime);
}
+ @Override
public URI getURI() {
if (file != null)
return file.getLocationURI();
@@ -185,6 +175,7 @@ public class LocalFileRevision extends FileRevision {
return file != null;
}
+ @Override
public boolean equals(Object obj) {
if (obj == this)
return true;
@@ -202,6 +193,7 @@ public class LocalFileRevision extends FileRevision {
return (s1.getFullPath().equals(s2.getFullPath()) && s1.getModificationTime() == s2.getModificationTime());
}
+ @Override
public int hashCode() {
if (file != null)
return file.hashCode();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java
index 4f133c782..196fe5039 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/importing/BundleImporterExtension.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
@@ -38,9 +38,7 @@ public class BundleImporterExtension implements IBundleImporter {
this.element = element;
}
- /* (non-Javadoc)
- * @see org.eclipse.pde.core.project.IBundleImporterDelegate#validateImport(java.util.Map[])
- */
+ @Override
public ScmUrlImportDescription[] validateImport(Map[] manifests) {
try {
return getDelegate().validateImport(manifests);
@@ -59,18 +57,20 @@ public class BundleImporterExtension implements IBundleImporter {
private synchronized IBundleImporterDelegate getDelegate() throws CoreException {
if (delegate == null) {
delegate = new BundleImporterDelegate() {
- private Set supportedValues;
+ private Set<String> supportedValues;
private RepositoryProviderType providerType;
+ @Override
protected Set getSupportedValues() {
if (supportedValues == null) {
IConfigurationElement[] supported = element.getChildren("supports"); //$NON-NLS-1$
- supportedValues = new HashSet(supported.length);
+ supportedValues = new HashSet<>(supported.length);
for (int i = 0; i < supported.length; i++) {
supportedValues.add(supported[i].getAttribute("prefix")); //$NON-NLS-1$
}
}
return supportedValues;
}
+ @Override
protected RepositoryProviderType getProviderType() {
if (providerType == null)
providerType = RepositoryProviderType.getProviderType(element.getAttribute("repository")); //$NON-NLS-1$
@@ -81,30 +81,22 @@ public class BundleImporterExtension implements IBundleImporter {
return delegate;
}
- /* (non-Javadoc)
- * @see org.eclipse.pde.core.importing.IBundleImporterDelegate#performImport(org.eclipse.pde.core.importing.BundleImportDescription[], org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public IProject[] performImport(ScmUrlImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException {
return getDelegate().performImport(descriptions, monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.pde.core.project.IBundleImporter#getId()
- */
+ @Override
public String getId() {
return element.getAttribute("id"); //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.pde.core.project.IBundleImporter#getDescription()
- */
+ @Override
public String getDescription() {
return element.getAttribute("description"); //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.eclipse.pde.core.project.IBundleImporter#getName()
- */
+ @Override
public String getName() {
return element.getAttribute("name"); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LineComparator.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LineComparator.java
index e601c04c4..21e1ff04c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LineComparator.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/LineComparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others.
+ * Copyright (c) 2004, 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,6 +38,7 @@ class LineComparator implements IRangeComparator {
super(in);
}
+ @Override
public int read() throws IOException {
int c = super.read();
trailingLF = isLineFeed(c);
@@ -49,6 +50,7 @@ class LineComparator implements IRangeComparator {
* FilterInputStream states that it will call read(byte[] buffer, int
* off, int len)
*/
+ @Override
public int read(byte[] buffer, int off, int len) throws IOException {
int length = super.read(buffer, off, len);
if (length != -1) {
@@ -103,7 +105,7 @@ class LineComparator implements IRangeComparator {
try (BufferedReader br = new BufferedReader(new InputStreamReader(
trailingLineFeedDetector, encoding))) {
String line;
- ArrayList ar = new ArrayList();
+ ArrayList<String> ar = new ArrayList<>();
while ((line = br.readLine()) != null) {
ar.add(line);
}
@@ -114,7 +116,7 @@ class LineComparator implements IRangeComparator {
if (trailingLineFeedDetector.hadTrailingLineFeed()) {
ar.add(""); //$NON-NLS-1$
}
- fLines = (String[]) ar.toArray(new String[ar.size()]);
+ fLines = ar.toArray(new String[ar.size()]);
}
}
@@ -122,23 +124,12 @@ class LineComparator implements IRangeComparator {
return fLines[ix];
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.compare.rangedifferencer.IRangeComparator#getRangeCount()
- */
+ @Override
public int getRangeCount() {
return fLines.length;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.compare.rangedifferencer.IRangeComparator#rangesEqual(int,
- * org.eclipse.compare.rangedifferencer.IRangeComparator, int)
- */
+ @Override
public boolean rangesEqual(int thisIndex, IRangeComparator other,
int otherIndex) {
String s1 = fLines[thisIndex];
@@ -146,13 +137,7 @@ class LineComparator implements IRangeComparator {
return s1.equals(s2);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.compare.rangedifferencer.IRangeComparator#skipRangeComparison
- * (int, int, org.eclipse.compare.rangedifferencer.IRangeComparator)
- */
+ @Override
public boolean skipRangeComparison(int length, int maxLength,
IRangeComparator other) {
return false;
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingScope.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingScope.java
index 6e832a4b5..d94e4b535 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingScope.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceMappingScope.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
@@ -30,7 +30,7 @@ import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager;
public class ResourceMappingScope extends AbstractResourceMappingScope {
private ResourceMapping[] inputMappings;
- private final Map mappingsToTraversals = Collections.synchronizedMap(new HashMap());
+ private final Map<ResourceMapping, ResourceTraversal[]> mappingsToTraversals = Collections.synchronizedMap(new HashMap<>());
private boolean hasAdditionalMappings;
private boolean hasAdditionalResources;
private final CompoundResourceTraversal compoundTraversal = new CompoundResourceTraversal();
@@ -55,39 +55,29 @@ public class ResourceMappingScope extends AbstractResourceMappingScope {
return newTraversals;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getInputMappings()
- */
+ @Override
public ResourceMapping[] getInputMappings() {
return inputMappings;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getMappings()
- */
+ @Override
public ResourceMapping[] getMappings() {
if (mappingsToTraversals.isEmpty())
return inputMappings;
- return (ResourceMapping[]) mappingsToTraversals.keySet().toArray(new ResourceMapping[mappingsToTraversals.size()]);
+ return mappingsToTraversals.keySet().toArray(new ResourceMapping[mappingsToTraversals.size()]);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getTraversals()
- */
+ @Override
public ResourceTraversal[] getTraversals() {
return compoundTraversal.asTraversals();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#getTraversals(org.eclipse.core.resources.mapping.ResourceMapping)
- */
+ @Override
public ResourceTraversal[] getTraversals(ResourceMapping mapping) {
- return (ResourceTraversal[])mappingsToTraversals.get(mapping);
+ return mappingsToTraversals.get(mapping);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.IResourceMappingOperationScope#hasAdditionalMappings()
- */
+ @Override
public boolean hasAdditionalMappings() {
return hasAdditionalMappings;
}
@@ -110,9 +100,7 @@ public class ResourceMappingScope extends AbstractResourceMappingScope {
this.hasAdditionalResources = hasAdditionalResources;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingScope#hasAdditonalResources()
- */
+ @Override
public boolean hasAdditonalResources() {
return hasAdditionalResources;
}
@@ -121,16 +109,12 @@ public class ResourceMappingScope extends AbstractResourceMappingScope {
return compoundTraversal;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.IResourceMappingScope#asInputScope()
- */
+ @Override
public ISynchronizationScope asInputScope() {
return new ResourceMappingInputScope(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.ISynchronizationScope#getProjects()
- */
+ @Override
public IProject[] getProjects() {
ResourceMappingContext context = getContext();
if (context instanceof RemoteResourceMappingContext) {
@@ -140,13 +124,12 @@ public class ResourceMappingScope extends AbstractResourceMappingScope {
return ResourcesPlugin.getWorkspace().getRoot().getProjects();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.mapping.ISynchronizationScope#getContext()
- */
+ @Override
public ResourceMappingContext getContext() {
return manager.getContext();
}
+ @Override
public void refresh(ResourceMapping[] mappings) {
manager.refresh(mappings);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceVariantFileRevision.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceVariantFileRevision.java
index b199f8704..3f1ebf227 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceVariantFileRevision.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ResourceVariantFileRevision.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,14 +23,17 @@ public class ResourceVariantFileRevision extends FileRevision implements IAdapta
this.variant = variant;
}
+ @Override
public IStorage getStorage(IProgressMonitor monitor) throws CoreException {
return variant.getStorage(monitor);
}
+ @Override
public String getName() {
return variant.getName();
}
+ @Override
public String getContentIdentifier() {
return variant.getContentIdentifier();
}
@@ -39,20 +42,24 @@ public class ResourceVariantFileRevision extends FileRevision implements IAdapta
return variant;
}
+ @Override
public boolean isPropertyMissing() {
return false;
}
+ @Override
public IFileRevision withAllProperties(IProgressMonitor monitor) throws CoreException {
return this;
}
- public Object getAdapter(Class adapter) {
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IResourceVariant.class)
- return variant;
+ return (T) variant;
Object object = Platform.getAdapterManager().getAdapter(this, adapter);
if (object != null)
- return object;
+ return (T) object;
if (variant instanceof IAdaptable ) {
IAdaptable adaptable = (IAdaptable ) variant;
return adaptable.getAdapter(adapter);
@@ -60,6 +67,7 @@ public class ResourceVariantFileRevision extends FileRevision implements IAdapta
return null;
}
+ @Override
public boolean equals(Object obj) {
if (obj instanceof ResourceVariantFileRevision) {
ResourceVariantFileRevision fileRevision = (ResourceVariantFileRevision) obj;
@@ -68,6 +76,7 @@ public class ResourceVariantFileRevision extends FileRevision implements IAdapta
return false;
}
+ @Override
public int hashCode() {
return getVariant().hashCode();
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java
index 059fabddf..3fdc4906d 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/mapping/ScopeManagerEventHandler.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
@@ -26,7 +26,7 @@ import org.eclipse.team.internal.core.Messages;
public class ScopeManagerEventHandler extends BackgroundEventHandler {
public static final int REFRESH = 10;
- private Set toRefresh = new HashSet();
+ private Set<ResourceMapping> toRefresh = new HashSet<>();
private ISynchronizationScopeManager manager;
class ResourceMappingEvent extends Event {
@@ -42,9 +42,10 @@ public class ScopeManagerEventHandler extends BackgroundEventHandler {
this.manager = manager;
}
+ @Override
protected boolean doDispatchEvents(IProgressMonitor monitor)
throws TeamException {
- ResourceMapping[] mappings = (ResourceMapping[]) toRefresh.toArray(new ResourceMapping[toRefresh.size()]);
+ ResourceMapping[] mappings = toRefresh.toArray(new ResourceMapping[toRefresh.size()]);
toRefresh.clear();
if (mappings.length > 0) {
try {
@@ -56,6 +57,7 @@ public class ScopeManagerEventHandler extends BackgroundEventHandler {
return mappings.length > 0;
}
+ @Override
protected void processEvent(Event event, IProgressMonitor monitor)
throws CoreException {
if (event instanceof ResourceMappingEvent) {
@@ -72,6 +74,7 @@ public class ScopeManagerEventHandler extends BackgroundEventHandler {
queueEvent(new ResourceMappingEvent(mappings), false);
}
+ @Override
protected Object getJobFamiliy() {
return manager;
}
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 4f12c624b..17a7584e4 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 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
@@ -53,28 +53,22 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.ChangeSetManager#add(org.eclipse.team.internal.core.subscribers.ChangeSet)
- */
- public void add(ChangeSet set) {
+ @Override
+ public void add(ChangeSet set) {
Assert.isTrue(set instanceof ActiveChangeSet);
super.add(set);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.AbstractChangeSetCollector#handleSetAdded(org.eclipse.team.internal.core.subscribers.ChangeSet)
- */
- protected void handleSetAdded(ChangeSet set) {
+ @Override
+ protected void handleSetAdded(ChangeSet set) {
Assert.isTrue(set instanceof ActiveChangeSet);
((DiffChangeSet)set).getDiffTree().addDiffChangeListener(getDiffTreeListener());
super.handleSetAdded(set);
handleAddedResources(set, ((ActiveChangeSet)set).internalGetDiffTree().getDiffs());
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.AbstractChangeSetCollector#handleSetRemoved(org.eclipse.team.internal.core.subscribers.ChangeSet)
- */
- protected void handleSetRemoved(ChangeSet set) {
+ @Override
+ protected void handleSetRemoved(ChangeSet set) {
((DiffChangeSet)set).getDiffTree().removeDiffChangeListener(getDiffTreeListener());
super.handleSetRemoved(set);
}
@@ -89,21 +83,18 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
return this;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#diffsChanged(org.eclipse.team.core.diff.IDiffChangeEvent, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
IResourceDiffTree tree = (IResourceDiffTree)event.getTree();
handleSyncSetChange(tree, event.getAdditions(), getAllResources(event));
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.diff.IDiffChangeListener#propertyChanged(org.eclipse.team.core.diff.IDiffTree, int, org.eclipse.core.runtime.IPath[])
- */
+ @Override
public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
// ignore
}
+ @Override
public boolean isModified(IFile file) throws CoreException {
IDiff diff = getDiff(file);
if (diff != null)
@@ -437,10 +428,8 @@ public abstract class ActiveChangeSetManager extends ChangeSetManager implements
return changeSet;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.IChangeGroupingRequestor#ensureChangesGrouped(org.eclipse.core.resources.IProject, org.eclipse.core.resources.IFile[], java.lang.String)
- */
- public void ensureChangesGrouped(IProject project, IFile[] files,
+ @Override
+ public void ensureChangesGrouped(IProject project, IFile[] files,
String name) throws CoreException {
ActiveChangeSet set = getSet(name);
if (set == null) {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java
index c52cc1ae8..7a07c6dc6 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager.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
@@ -26,9 +26,9 @@ public class BatchingChangeSetManager extends ChangeSetManager {
public static class CollectorChangeEvent {
- Set added = new HashSet();
- Set removed = new HashSet();
- Map changed = new HashMap();
+ Set<ChangeSet> added = new HashSet<>();
+ Set<ChangeSet> removed = new HashSet<>();
+ Map<ChangeSet, IPath[]> changed = new HashMap<>();
private final BatchingChangeSetManager collector;
public CollectorChangeEvent(BatchingChangeSetManager collector) {
@@ -50,11 +50,11 @@ public class BatchingChangeSetManager extends ChangeSetManager {
private void changed(ChangeSet changeSet, IPath[] allAffectedResources) {
if (added.contains(changeSet))
return;
- IPath[] paths = (IPath[])changed.get(changeSet);
+ IPath[] paths = changed.get(changeSet);
if (paths == null) {
changed.put(changeSet, allAffectedResources);
} else {
- Set allPaths = new HashSet();
+ Set<IPath> allPaths = new HashSet<>();
for (int i = 0; i < paths.length; i++) {
IPath path = paths[i];
allPaths.add(path);
@@ -63,7 +63,7 @@ public class BatchingChangeSetManager extends ChangeSetManager {
IPath path = allAffectedResources[i];
allPaths.add(path);
}
- changed.put(changeSet, (IPath[]) allPaths.toArray(new IPath[allPaths.size()]));
+ changed.put(changeSet, allPaths.toArray(new IPath[allPaths.size()]));
}
}
@@ -72,19 +72,19 @@ public class BatchingChangeSetManager extends ChangeSetManager {
}
public ChangeSet[] getAddedSets() {
- return (ChangeSet[]) added.toArray(new ChangeSet[added.size()]);
+ return added.toArray(new ChangeSet[added.size()]);
}
public ChangeSet[] getRemovedSets() {
- return (ChangeSet[]) removed.toArray(new ChangeSet[removed.size()]);
+ return removed.toArray(new ChangeSet[removed.size()]);
}
public ChangeSet[] getChangedSets() {
- return (ChangeSet[]) changed.keySet().toArray(new ChangeSet[changed.size()]);
+ return changed.keySet().toArray(new ChangeSet[changed.size()]);
}
public IPath[] getChangesFor(ChangeSet set) {
- return (IPath[])changed.get(set);
+ return changed.get(set);
}
public BatchingChangeSetManager getSource() {
@@ -126,9 +126,11 @@ public class BatchingChangeSetManager extends ChangeSetManager {
if (listener instanceof IChangeSetCollectorChangeListener) {
final IChangeSetCollectorChangeListener csccl = (IChangeSetCollectorChangeListener) listener;
SafeRunner.run(new ISafeRunnable() {
+ @Override
public void handleException(Throwable exception) {
// Exceptions are logged by the platform
}
+ @Override
public void run() throws Exception {
csccl.changeSetChanges(event, monitor);
}
@@ -137,7 +139,8 @@ public class BatchingChangeSetManager extends ChangeSetManager {
}
}
- public void add(ChangeSet set) {
+ @Override
+ public void add(ChangeSet set) {
try {
beginInput();
super.add(set);
@@ -147,7 +150,8 @@ public class BatchingChangeSetManager extends ChangeSetManager {
}
}
- public void remove(ChangeSet set) {
+ @Override
+ public void remove(ChangeSet set) {
try {
beginInput();
super.remove(set);
@@ -157,7 +161,8 @@ public class BatchingChangeSetManager extends ChangeSetManager {
}
}
- protected void fireResourcesChangedEvent(ChangeSet changeSet, IPath[] allAffectedResources) {
+ @Override
+ protected void fireResourcesChangedEvent(ChangeSet changeSet, IPath[] allAffectedResources) {
super.fireResourcesChangedEvent(changeSet, allAffectedResources);
try {
beginInput();
@@ -167,7 +172,8 @@ public class BatchingChangeSetManager extends ChangeSetManager {
}
}
- protected void initializeSets() {
+ @Override
+ protected void initializeSets() {
// Nothing to do
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.java
index 6164daae2..f72362c6a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ChangeSetManager.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
@@ -19,8 +19,8 @@ import org.eclipse.core.runtime.*;
*/
public abstract class ChangeSetManager {
- private ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
- private Set sets;
+ private ListenerList<IChangeSetChangeListener> listeners = new ListenerList<IChangeSetChangeListener>(ListenerList.IDENTITY);
+ private Set<ChangeSet> sets;
private boolean initializing;
/**
@@ -44,10 +44,12 @@ public abstract class ChangeSetManager {
for (int i = 0; i < listeners.length; i++) {
final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
+ @Override
+ public void handleException(Throwable exception) {
// Exceptions are logged by the platform
}
- public void run() throws Exception {
+ @Override
+ public void run() throws Exception {
listener.nameChanged(set);
}
});
@@ -68,10 +70,12 @@ public abstract class ChangeSetManager {
for (int i = 0; i < listeners.length; i++) {
final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
+ @Override
+ public void handleException(Throwable exception) {
// Exceptions are logged by the platform
}
- public void run() throws Exception {
+ @Override
+ public void run() throws Exception {
listener.defaultSetChanged(oldSet, defaultSet);
}
});
@@ -100,10 +104,12 @@ public abstract class ChangeSetManager {
for (int i = 0; i < listeners.length; i++) {
final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
+ @Override
+ public void handleException(Throwable exception) {
// Exceptions are logged by the platform
}
- public void run() throws Exception {
+ @Override
+ public void run() throws Exception {
listener.setAdded(set);
}
});
@@ -132,10 +138,12 @@ public abstract class ChangeSetManager {
for (int i = 0; i < listeners.length; i++) {
final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
+ @Override
+ public void handleException(Throwable exception) {
// Exceptions are logged by the platform
}
- public void run() throws Exception {
+ @Override
+ public void run() throws Exception {
listener.setRemoved(set);
}
});
@@ -172,8 +180,8 @@ public abstract class ChangeSetManager {
* @return the list of active commit sets
*/
public ChangeSet[] getSets() {
- Set sets = internalGetSets();
- return (ChangeSet[]) sets.toArray(new ChangeSet[sets.size()]);
+ Set<ChangeSet> sets = internalGetSets();
+ return sets.toArray(new ChangeSet[sets.size()]);
}
/**
@@ -195,19 +203,21 @@ public abstract class ChangeSetManager {
for (int i = 0; i < listeners.length; i++) {
final IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
SafeRunner.run(new ISafeRunnable() {
- public void handleException(Throwable exception) {
+ @Override
+ public void handleException(Throwable exception) {
// Exceptions are logged by the platform
}
- public void run() throws Exception {
+ @Override
+ public void run() throws Exception {
listener.resourcesChanged(changeSet, allAffectedResources);
}
});
}
}
- private Set internalGetSets() {
+ private Set<ChangeSet> internalGetSets() {
if (sets == null) {
- sets = Collections.synchronizedSet(new HashSet());
+ sets = Collections.synchronizedSet(new HashSet<>());
try {
initializing = true;
initializeSets();
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.java
index 473238e35..bbabf4a6b 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/CheckedInChangeSet.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
@@ -48,7 +48,8 @@ public abstract class CheckedInChangeSet extends ChangeSet {
* Return the resources that are contained in this set.
* @return the resources that are contained in this set
*/
- public IResource[] getResources() {
+ @Override
+ public IResource[] getResources() {
return set.getResources();
}
@@ -56,7 +57,8 @@ public abstract class CheckedInChangeSet extends ChangeSet {
* Return whether the set contains any files.
* @return whether the set contains any files
*/
- public boolean isEmpty() {
+ @Override
+ public boolean isEmpty() {
return set.isEmpty();
}
@@ -65,7 +67,8 @@ public abstract class CheckedInChangeSet extends ChangeSet {
* @param local a local file
* @return true if the given file is included in this set
*/
- public boolean contains(IResource local) {
+ @Override
+ public boolean contains(IResource local) {
return set.getSyncInfo(local) != null;
}
@@ -112,7 +115,8 @@ public abstract class CheckedInChangeSet extends ChangeSet {
* Remove the resource from the set.
* @param resource the resource to be removed
*/
- public void remove(IResource resource) {
+ @Override
+ public void remove(IResource resource) {
if (contains(resource)) {
set.remove(resource);
}
@@ -122,7 +126,8 @@ public abstract class CheckedInChangeSet extends ChangeSet {
* Remove the resources from the set.
* @param resources the resources to be removed
*/
- public void remove(IResource[] resources) {
+ @Override
+ public void remove(IResource[] resources) {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
remove(resource);
@@ -135,7 +140,8 @@ public abstract class CheckedInChangeSet extends ChangeSet {
* @param depth the depth of the removal (one of
* <code>IResource.DEPTH_ZERO, IResource.DEPTH_ONE, IResource.DEPTH_INFINITE)</code>
*/
- public void rootRemoved(IResource resource, int depth) {
+ @Override
+ public void rootRemoved(IResource resource, int depth) {
SyncInfo[] infos = set.getSyncInfos(resource, depth);
if (infos.length > 0) {
IResource[] resources = new IResource[infos.length];
@@ -146,7 +152,8 @@ public abstract class CheckedInChangeSet extends ChangeSet {
}
}
- public boolean containsChildren(IResource resource, int depth) {
+ @Override
+ public boolean containsChildren(IResource resource, int depth) {
return set.getSyncInfos(resource, depth).length > 0;
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.java
index d29fd15b3..fa5c9f4a1 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffChangeSet.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
@@ -44,7 +44,8 @@ public class DiffChangeSet extends ChangeSet {
* Return the resources that are contained in this set.
* @return the resources that are contained in this set
*/
- public IResource[] getResources() {
+ @Override
+ public IResource[] getResources() {
return tree.getAffectedResources();
}
@@ -52,7 +53,8 @@ public class DiffChangeSet extends ChangeSet {
* Return whether the set contains any files.
* @return whether the set contains any files
*/
- public boolean isEmpty() {
+ @Override
+ public boolean isEmpty() {
return tree.isEmpty();
}
@@ -61,7 +63,8 @@ public class DiffChangeSet extends ChangeSet {
* @param local a local file
* @return true if the given file is included in this set
*/
- public boolean contains(IResource local) {
+ @Override
+ public boolean contains(IResource local) {
return tree.getDiff(local) != null;
}
@@ -108,7 +111,8 @@ public class DiffChangeSet extends ChangeSet {
* Remove the resource from the set.
* @param resource the resource to be removed
*/
- public void remove(IResource resource) {
+ @Override
+ public void remove(IResource resource) {
if (contains(resource)) {
tree.remove(resource);
}
@@ -120,7 +124,8 @@ public class DiffChangeSet extends ChangeSet {
* @param depth the depth of the removal (one of
* <code>IResource.DEPTH_ZERO, IResource.DEPTH_ONE, IResource.DEPTH_INFINITE)</code>
*/
- public void rootRemoved(IResource resource, int depth) {
+ @Override
+ public void rootRemoved(IResource resource, int depth) {
IDiff[] diffs = tree.getDiffs(resource, depth);
if (diffs.length > 0) {
try {
@@ -141,6 +146,7 @@ public class DiffChangeSet extends ChangeSet {
return getDiffTree().getDiff(path) != null;
}
+ @Override
public boolean containsChildren(IResource resource, int depth) {
return getDiffTree().getDiffs(resource, depth).length > 0;
}
@@ -157,6 +163,7 @@ public class DiffChangeSet extends ChangeSet {
}
}
+ @Override
public void remove(IResource[] resources) {
try {
tree.beginInput();
@@ -169,6 +176,7 @@ public class DiffChangeSet extends ChangeSet {
}
}
+ @Override
public String getComment() {
return null;
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java
index 13706b9c6..6ff14004c 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/DiffTreeStatistics.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 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
@@ -20,7 +20,7 @@ public class DiffTreeStatistics {
/**
* {Integer sync kind -> Long number of infos with that sync kind in this sync set}
*/
- protected Map stats = Collections.synchronizedMap(new HashMap());
+ protected Map<Integer, Long> stats = Collections.synchronizedMap(new HashMap<>());
/**
* Count this sync state.
@@ -28,7 +28,7 @@ public class DiffTreeStatistics {
*/
public void add(int state) {
// update statistics
- Long count = (Long)stats.get(new Integer(state));
+ Long count = stats.get(new Integer(state));
if(count == null) {
count = new Long(0);
}
@@ -42,7 +42,7 @@ public class DiffTreeStatistics {
public void remove(int state) {
// update stats
Integer kind = new Integer(state);
- 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.
@@ -68,7 +68,7 @@ public class DiffTreeStatistics {
*/
public long countFor(int state, int mask) {
if(mask == 0) {
- Long count = (Long)stats.get(new Integer(state));
+ Long count = stats.get(new Integer(state));
return count == null ? 0 : count.longValue();
} else {
Set keySet = stats.keySet();
@@ -78,7 +78,7 @@ public class DiffTreeStatistics {
while (it.hasNext()) {
Integer key = (Integer) it.next();
if((key.intValue() & mask) == state) {
- count += ((Long)stats.get(key)).intValue();
+ count += stats.get(key).intValue();
}
}
}
@@ -97,6 +97,7 @@ public class DiffTreeStatistics {
/**
* 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/SubscriberChangeSetManager.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberChangeSetManager.java
index 2d7466c62..a499a32b2 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberChangeSetManager.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberChangeSetManager.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
@@ -42,26 +42,22 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
*/
private class EventHandler extends BackgroundEventHandler {
- private List dispatchEvents = new ArrayList();
+ private List<Event> dispatchEvents = new ArrayList<>();
protected EventHandler(String jobName, String errorTitle) {
super(jobName, errorTitle);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#processEvent(org.eclipse.team.internal.core.BackgroundEventHandler.Event, org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void processEvent(Event event, IProgressMonitor monitor) throws CoreException {
+ @Override
+ protected void processEvent(Event event, IProgressMonitor monitor) throws CoreException {
// Handle everything in the dispatch
if (isShutdown())
throw new OperationCanceledException();
dispatchEvents.add(event);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#doDispatchEvents(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected boolean doDispatchEvents(IProgressMonitor monitor) throws TeamException {
+ @Override
+ protected boolean doDispatchEvents(IProgressMonitor monitor) throws TeamException {
if (dispatchEvents.isEmpty()) {
return false;
}
@@ -104,7 +100,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
*/
private ResourceDiffTree[] beginDispath() {
ChangeSet[] sets = getSets();
- List lockedSets = new ArrayList();
+ List<ResourceDiffTree> lockedSets = new ArrayList<>();
try {
for (int i = 0; i < sets.length; i++) {
ActiveChangeSet set = (ActiveChangeSet)sets[i];
@@ -112,7 +108,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
lockedSets.add(tree);
tree.beginInput();
}
- return (ResourceDiffTree[]) lockedSets.toArray(new ResourceDiffTree[lockedSets.size()]);
+ return lockedSets.toArray(new ResourceDiffTree[lockedSets.size()]);
} catch (RuntimeException e) {
try {
for (Iterator iter = lockedSets.iterator(); iter.hasNext();) {
@@ -150,10 +146,8 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
monitor.done();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#queueEvent(org.eclipse.team.internal.core.BackgroundEventHandler.Event, boolean)
- */
- protected synchronized void queueEvent(Event event, boolean front) {
+ @Override
+ protected synchronized void queueEvent(Event event, boolean front) {
// Override to allow access from enclosing class
super.queueEvent(event, front);
}
@@ -209,7 +203,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
}
private void removeFromAllSets(IResource resource) {
- List toRemove = new ArrayList();
+ List<ChangeSet> toRemove = new ArrayList<>();
ChangeSet[] sets = getSets();
for (int i = 0; i < sets.length; i++) {
ChangeSet set = sets[i];
@@ -220,22 +214,22 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
}
}
}
- for (Iterator iter = toRemove.iterator(); iter.hasNext();) {
- ActiveChangeSet set = (ActiveChangeSet) iter.next();
+ for (Object element : toRemove) {
+ ActiveChangeSet set = (ActiveChangeSet) element;
remove(set);
}
}
private ActiveChangeSet[] getContainingSets(IResource resource) {
- Set result = new HashSet();
+ Set<ActiveChangeSet> result = new HashSet<>();
ChangeSet[] sets = getSets();
for (int i = 0; i < sets.length; i++) {
ChangeSet set = sets[i];
if (set.contains(resource)) {
- result.add(set);
+ result.add((ActiveChangeSet) set);
}
}
- return (ActiveChangeSet[]) result.toArray(new ActiveChangeSet[result.size()]);
+ return result.toArray(new ActiveChangeSet[result.size()]);
}
}
@@ -245,23 +239,20 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
super(subscriber);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#remove(org.eclipse.core.resources.IResource)
- */
- protected void remove(IResource resource) {
+ @Override
+ protected void remove(IResource resource) {
if (handler != null)
handler.queueEvent(new BackgroundEventHandler.ResourceEvent(resource, RESOURCE_REMOVAL, IResource.DEPTH_INFINITE), false);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#change(org.eclipse.core.resources.IResource, int)
- */
- protected void change(IResource resource, int depth) {
+ @Override
+ protected void change(IResource resource, int depth) {
if (handler != null)
handler.queueEvent(new BackgroundEventHandler.ResourceEvent(resource, RESOURCE_CHANGE, depth), false);
}
- protected boolean hasMembers(IResource resource) {
+ @Override
+ protected boolean hasMembers(IResource resource) {
return SubscriberChangeSetManager.this.hasMembers(resource);
}
}
@@ -271,10 +262,8 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
handler = new EventHandler(NLS.bind(Messages.SubscriberChangeSetCollector_1, new String[] { subscriber.getName() }), NLS.bind(Messages.SubscriberChangeSetCollector_2, new String[] { subscriber.getName() })); //
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.ChangeSetManager#initializeSets()
- */
- protected void initializeSets() {
+ @Override
+ protected void initializeSets() {
load(getPreferences());
}
@@ -297,7 +286,8 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
* @return the sync info for the resource
* @throws CoreException
*/
- public IDiff getDiff(IResource resource) throws CoreException {
+ @Override
+ public IDiff getDiff(IResource resource) throws CoreException {
Subscriber subscriber = getSubscriber();
return subscriber.getDiff(resource);
}
@@ -310,10 +300,8 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
return collector.getSubscriber();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#dispose()
- */
- public void dispose() {
+ @Override
+ public void dispose() {
handler.shutdown();
collector.dispose();
super.dispose();
@@ -360,9 +348,7 @@ public class SubscriberChangeSetManager extends ActiveChangeSetManager {
monitor.worked(1);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager#getName()
- */
+ @Override
protected String getName() {
return getSubscriber().getName();
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
index 3a183527a..04ac32b72 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.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
@@ -15,7 +15,6 @@ import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
@@ -38,7 +37,7 @@ import org.eclipse.team.internal.core.*;
public abstract class SubscriberEventHandler extends BackgroundEventHandler {
// Changes accumulated by the event handler
- private List resultCache = new ArrayList();
+ private List<Event> resultCache = new ArrayList<>();
private boolean started = false;
private boolean initializing = true;
@@ -63,6 +62,7 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
SubscriberEvent(IResource resource, int type, int depth) {
super(resource, type, depth);
}
+ @Override
protected String getTypeString() {
switch (getType()) {
case REMOVAL :
@@ -92,13 +92,7 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
NLS.bind(Messages.SubscriberEventHandler_errors, new String[] { subscriber.getName() }));
this.subscriber = subscriber;
this.scope = scope;
- scopeChangeListener = new ISynchronizationScopeChangeListener() {
- public void scopeChanged(ISynchronizationScope scope,
- ResourceMapping[] newMappings,
- ResourceTraversal[] newTraversals) {
- reset(new ResourceTraversal[0], scope.getTraversals());
- }
- };
+ scopeChangeListener = (scope1, newMappings, newTraversals) -> reset(new ResourceTraversal[0], scope1.getTraversals());
this.scope.addScopeChangeListener(scopeChangeListener);
}
@@ -124,6 +118,7 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
initializing = false;
}
+ @Override
protected synchronized void queueEvent(Event event, boolean front) {
// Only post events if the handler is started
if (started) {
@@ -133,6 +128,7 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
/**
* Schedule the job or process the events now.
*/
+ @Override
public void schedule() {
Job job = getEventHandlerJob();
if (job.getState() == Job.NONE) {
@@ -151,9 +147,7 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#jobDone(org.eclipse.core.runtime.jobs.IJobChangeEvent)
- */
+ @Override
protected void jobDone(IJobChangeEvent event) {
super.jobDone(event);
progressGroup = null;
@@ -294,6 +288,7 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
}
}
+ @Override
protected void processEvent(Event event, IProgressMonitor monitor) {
try {
// Cancellation is dangerous because this will leave the sync info in a bad state.
@@ -367,12 +362,10 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.BackgroundEventHandler#dispatchEvents()
- */
+ @Override
protected boolean doDispatchEvents(IProgressMonitor monitor) {
if (!resultCache.isEmpty()) {
- dispatchEvents((SubscriberEvent[]) resultCache.toArray(new SubscriberEvent[resultCache.size()]), monitor);
+ dispatchEvents(resultCache.toArray(new SubscriberEvent[resultCache.size()]), monitor);
resultCache.clear();
return true;
}
@@ -414,9 +407,7 @@ public abstract class SubscriberEventHandler extends BackgroundEventHandler {
return scope;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.BackgroundEventHandler#shutdown()
- */
+ @Override
public void shutdown() {
super.shutdown();
scope.removeScopeChangeListener(scopeChangeListener);
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java
index 8a49a57cd..ba554f3cc 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.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
@@ -51,6 +51,7 @@ public final class SubscriberSyncInfoCollector extends SubscriberResourceCollect
this.subscriberInput = eventHandler.getSyncSetInput();
filteredInput = new SyncSetInputFromSyncSet(subscriberInput.getSyncSet(), getEventHandler());
filteredInput.setFilter(new SyncInfoFilter() {
+ @Override
public boolean select(SyncInfo info, IProgressMonitor monitor) {
return true;
}
@@ -112,6 +113,7 @@ public final class SubscriberSyncInfoCollector extends SubscriberResourceCollect
* all it's listeners. This method must be called when the collector is no longer
* referenced and could be garbage collected.
*/
+ @Override
public void dispose() {
eventHandler.shutdown();
subscriberInput.disconnect();
@@ -127,6 +129,7 @@ public final class SubscriberSyncInfoCollector extends SubscriberResourceCollect
* subscriber. However, the set can be reduced using {@link #setRoots(IResource[])}.
* @return the roots
*/
+ @Override
public IResource[] getRoots() {
if (roots == null) {
return super.getRoots();
@@ -141,6 +144,7 @@ public final class SubscriberSyncInfoCollector extends SubscriberResourceCollect
* @return <code>true</code> if the collector is considering all
* roots of the subscriber and <code>false</code> otherwise
*/
+ @Override
public boolean isAllRootsIncluded() {
return roots == null;
}
@@ -186,24 +190,18 @@ public final class SubscriberSyncInfoCollector extends SubscriberResourceCollect
reset();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#hasMembers(org.eclipse.core.resources.IResource)
- */
- protected boolean hasMembers(IResource resource) {
+ @Override
+ protected boolean hasMembers(IResource resource) {
return getSubscriberSyncInfoSet().hasMembers(resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#remove(org.eclipse.core.resources.IResource)
- */
- protected void remove(IResource resource) {
+ @Override
+ protected void remove(IResource resource) {
eventHandler.remove(resource);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberResourceCollector#change(org.eclipse.core.resources.IResource, int)
- */
- protected void change(IResource resource, int depth) {
+ @Override
+ protected void change(IResource resource, int depth) {
eventHandler.change(resource, depth);
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java
index cc5ed5b17..2a4a0c63a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler.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
@@ -58,17 +58,13 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler {
this.syncSetInput = new SyncSetInputFromSubscriber(subscriber, this);
}
- /* (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);
syncSetInput.handleError(new TeamStatus(IStatus.ERROR, TeamPlugin.ID, code, message, e, resource));
}
- /* (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);
syncSetInput.handleError(new TeamStatus(IStatus.ERROR, TeamPlugin.ID, ITeamStatus.SYNC_INFO_SET_CANCELLATION, Messages.SubscriberEventHandler_12, e, ResourcesPlugin.getWorkspace().getRoot()));
@@ -82,9 +78,7 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler {
return syncSetInput;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberEventHandler#handleChange(org.eclipse.core.resources.IResource)
- */
+ @Override
protected void handleChange(IResource resource) throws TeamException {
SyncInfo info = syncSetInput.getSubscriber().getSyncInfo(resource);
// resource is no longer under the subscriber control
@@ -97,9 +91,7 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler {
}
}
- /* (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,
@@ -111,6 +103,7 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler {
// Create a monitor that will handle preemption and dispatch if required
IProgressMonitor collectionMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN) {
boolean dispatching = false;
+ @Override
public void subTask(String name) {
dispatch();
super.subTask(name);
@@ -125,6 +118,7 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler {
dispatching = false;
}
}
+ @Override
public void worked(int work) {
dispatch();
super.worked(work);
@@ -133,11 +127,13 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler {
// Create a sync set that queues up resources and errors for dispatch
SyncInfoSet collectionSet = new SyncInfoSet() {
+ @Override
public void add(SyncInfo info) {
super.add(info);
queueDispatchEvent(
new SubscriberSyncInfoEvent(info.getLocal(), SubscriberEvent.CHANGE, IResource.DEPTH_ZERO, info));
}
+ @Override
public void addError(ITeamStatus status) {
if (status instanceof TeamStatus) {
TeamStatus ts = (TeamStatus) status;
@@ -152,6 +148,7 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler {
TeamPlugin.getPlugin().getLog().log(status);
syncSetInput.handleError(status);
}
+ @Override
public void remove(IResource resource) {
super.remove(resource);
queueDispatchEvent(
@@ -166,9 +163,7 @@ public class SubscriberSyncInfoEventHandler 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) {
// this will batch the following set changes until endInput is called.
SubscriberSyncInfoSet syncSet = syncSetInput.getSyncSet();
@@ -212,16 +207,10 @@ public class SubscriberSyncInfoEventHandler extends SubscriberEventHandler {
scope.setRoots(roots);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.SubscriberEventHandler#reset(org.eclipse.core.resources.mapping.ResourceTraversal[], org.eclipse.core.resources.mapping.ResourceTraversal[])
- */
+ @Override
protected synchronized void reset(ResourceTraversal[] oldTraversals, ResourceTraversal[] newTraversals) {
// First, reset the sync set input to clear the sync set
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- syncSetInput.reset(monitor);
- }
- }, false /* keep ordering the same */);
+ run(monitor -> syncSetInput.reset(monitor), false /* keep ordering the same */);
// Then, prime the set from the subscriber
super.reset(oldTraversals, newTraversals);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.java
index 5a4d9ec5a..5ec9951db 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncInfoTreeChangeEvent.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
@@ -17,8 +17,8 @@ import org.eclipse.team.core.synchronize.*;
public class SyncInfoTreeChangeEvent extends SyncInfoSetChangeEvent implements ISyncInfoTreeChangeEvent {
- private Set removedSubtrees = new HashSet();
- private Set addedSubtrees = new HashSet();
+ private Set<IResource> removedSubtrees = new HashSet<>();
+ private Set<IResource> addedSubtrees = new HashSet<>();
public SyncInfoTreeChangeEvent(SyncInfoSet set) {
super(set);
@@ -35,8 +35,8 @@ public class SyncInfoTreeChangeEvent extends SyncInfoSetChangeEvent implements I
// (in which case it need not be added).
// Also, remove any exisiting roots that are children
// of the new root
- for (Iterator iter = removedSubtrees.iterator(); iter.hasNext();) {
- IResource element = (IResource) iter.next();
+ for (Iterator<IResource> iter = removedSubtrees.iterator(); iter.hasNext();) {
+ IResource element = iter.next();
// check if the root is already in the list
if (root.equals(element)) return;
if (isParent(root, element)) {
@@ -80,14 +80,17 @@ public class SyncInfoTreeChangeEvent extends SyncInfoSetChangeEvent implements I
return false;
}
+ @Override
public IResource[] getAddedSubtreeRoots() {
- return (IResource[]) addedSubtrees.toArray(new IResource[addedSubtrees.size()]);
+ return addedSubtrees.toArray(new IResource[addedSubtrees.size()]);
}
+ @Override
public IResource[] getRemovedSubtreeRoots() {
- return (IResource[]) removedSubtrees.toArray(new IResource[removedSubtrees.size()]);
+ return removedSubtrees.toArray(new IResource[removedSubtrees.size()]);
}
+ @Override
public boolean isEmpty() {
return super.isEmpty() && removedSubtrees.isEmpty() && addedSubtrees.isEmpty();
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.java
index 09f7d7b59..24baae3ec 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber.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
@@ -28,6 +28,7 @@ public class SyncSetInputFromSubscriber extends SyncSetInput {
this.subscriber = subscriber;
}
+ @Override
public void disconnect() {
}
@@ -35,9 +36,7 @@ public class SyncSetInputFromSubscriber extends SyncSetInput {
return subscriber;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.sync.views.SyncSetInput#fetchInput(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected void fetchInput(IProgressMonitor monitor) throws TeamException {
// don't calculate changes. The SubscriberEventHandler will fetch the
// input in a job and update this sync set when the changes are
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java
index 87da1959b..57c1044fe 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet.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
@@ -29,15 +29,14 @@ public class SyncSetInputFromSyncSet extends SyncSetInput implements ISyncInfoSe
inputSyncSet.addSyncSetChangedListener(this);
}
+ @Override
public void disconnect() {
if (inputSyncSet == null) return;
inputSyncSet.removeSyncSetChangedListener(this);
inputSyncSet = null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.AbstractSyncSet#initialize(java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected void fetchInput(IProgressMonitor monitor) {
if (inputSyncSet == null) return;
SyncInfo[] infos = inputSyncSet.getSyncInfos();
@@ -46,9 +45,7 @@ public class SyncSetInputFromSyncSet extends SyncSetInput implements ISyncInfoSe
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ccvs.syncviews.views.ISyncSetChangedListener#syncSetChanged(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent)
- */
+ @Override
public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor) {
SyncInfoSet syncSet = getSyncSet();
try {
@@ -78,9 +75,7 @@ public class SyncSetInputFromSyncSet extends SyncSetInput implements ISyncInfoSe
inputSyncSet.connect(this);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISyncInfoSetChangeListener#syncInfoSetReset(org.eclipse.team.core.subscribers.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor) {
if(inputSyncSet == null) {
set.removeSyncSetChangedListener(this);
@@ -98,9 +93,7 @@ public class SyncSetInputFromSyncSet extends SyncSetInput implements ISyncInfoSe
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.core.subscribers.ISyncInfoSetChangeListener#syncInfoSetError(org.eclipse.team.core.subscribers.SyncInfoSet, org.eclipse.team.core.ITeamStatus[], org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
SubscriberSyncInfoSet syncSet = getSyncSet();
try {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ThreeWayBaseTree.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ThreeWayBaseTree.java
index c4a1a20cd..7b1ec07de 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ThreeWayBaseTree.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/ThreeWayBaseTree.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,24 +36,30 @@ public final class ThreeWayBaseTree extends ResourceVariantTree {
public BaseResourceVariantByteStore(ThreeWaySubscriber subscriber) {
this.subscriber = subscriber;
}
+ @Override
public void dispose() {
// Nothing to do
}
+ @Override
public byte[] getBytes(IResource resource) throws TeamException {
return subscriber.getSynchronizer().getBaseBytes(resource);
}
+ @Override
public boolean setBytes(IResource resource, byte[] bytes) throws TeamException {
// Base bytes are set directly in the synchronizer
return false;
}
+ @Override
public boolean flushBytes(IResource resource, int depth) throws TeamException {
// Base bytes are flushed directly in the synchronizer
return false;
}
+ @Override
public boolean deleteBytes(IResource resource) throws TeamException {
// Base bytes are deleted directly in the synchronizer
return false;
}
+ @Override
public IResource[] members(IResource resource) throws TeamException {
return subscriber.getSynchronizer().members(resource);
}
@@ -69,39 +75,29 @@ public final class ThreeWayBaseTree extends ResourceVariantTree {
this.subscriber = subscriber;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.AbstractResourceVariantTree#refresh(org.eclipse.core.resources.IResource[], int, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
public IResource[] refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException {
return new IResource[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.AbstractResourceVariantTree#fetchMembers(org.eclipse.team.core.synchronize.IResourceVariant, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected IResourceVariant[] fetchMembers(IResourceVariant variant, IProgressMonitor progress) throws TeamException {
// Refresh not supported
return new IResourceVariant[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.AbstractResourceVariantTree#fetchVariant(org.eclipse.core.resources.IResource, int, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException {
// Refresh not supported
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.IResourceVariantTree#roots()
- */
+ @Override
public IResource[] roots() {
return getSubscriber().roots();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.core.subscribers.caches.IResourceVariantTree#getResourceVariant(org.eclipse.core.resources.IResource)
- */
+ @Override
public IResourceVariant getResourceVariant(IResource resource) throws TeamException {
return getSubscriber().getResourceVariant(resource, getByteStore().getBytes(resource));
}

Back to the top