Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-10-30 03:29:54 -0400
committerAlexander Kurtakov2018-10-30 08:37:09 -0400
commit293a2626f262d8048c6667b56ca6348a83aefc91 (patch)
tree5188d7251ebd50a9399d7ec644f09c48b24125f2
parenta6c8c68869fed5544105d9c25733be3a64b64ce1 (diff)
downloadeclipse.platform.team-293a2626f262d8048c6667b56ca6348a83aefc91.tar.gz
eclipse.platform.team-293a2626f262d8048c6667b56ca6348a83aefc91.tar.xz
eclipse.platform.team-293a2626f262d8048c6667b56ca6348a83aefc91.zip
Lambda conversions.
Change-Id: I82abbfbcfd6d7485cf76711d685f79030f5b7306 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.jsch.core/pom.xml2
-rw-r--r--bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java28
-rw-r--r--bundles/org.eclipse.jsch.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.jsch.ui/pom.xml2
-rw-r--r--bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java53
-rw-r--r--bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java142
-rw-r--r--bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/ui/UserInfoPrompter.java49
-rw-r--r--bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.ui.prefs8
-rw-r--r--bundles/org.eclipse.team.core/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.team.core/pom.xml2
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/SynchronizationScopeManager.java16
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/variants/ThreeWayRemoteTree.java11
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java7
-rw-r--r--bundles/org.eclipse.team.cvs.core/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.team.cvs.core/pom.xml2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java202
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java330
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java60
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java160
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java38
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java18
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java10
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java18
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java80
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java18
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResponsiveSocketFactory.java14
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java52
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java32
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java67
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java57
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java43
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java68
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java124
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java67
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java35
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java35
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java54
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java25
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java14
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java33
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java25
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java49
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java47
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java27
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java16
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java38
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java144
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java65
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelReplaceOperation.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceModelParticipant.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java171
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java36
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java94
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java38
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ClipboardDiffOperation.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java58
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java56
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java73
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java66
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java52
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java54
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java41
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java65
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java109
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java101
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AlternativeLocationWizard.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java35
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java30
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java66
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java85
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java92
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java133
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java55
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java7
-rw-r--r--examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF2
-rw-r--r--examples/org.eclipse.compare.examples.xml/pom.xml2
-rw-r--r--examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java7
-rw-r--r--examples/org.eclipse.team.examples.filesystem/META-INF/MANIFEST.MF2
-rw-r--r--examples/org.eclipse.team.examples.filesystem/pom.xml2
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergeOperation.java6
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java35
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java16
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java22
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java220
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticModificationValidator.java46
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ResourceChangeListener.java74
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/AddToControlAction.java21
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/DisconnectAction.java42
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/PessimisticDecorator.java8
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/RemoveFromControlAction.java21
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java20
-rw-r--r--tests/org.eclipse.team.tests.core/META-INF/MANIFEST.MF2
-rw-r--r--tests/org.eclipse.team.tests.core/pom.xml2
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/PessimisticRepositoryProvider.java19
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/META-INF/MANIFEST.MF2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/pom.xml2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java60
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseFolderTest.java20
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java38
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java9
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/Bug152581Test.java6
135 files changed, 2621 insertions, 2854 deletions
diff --git a/bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF
index ad6bb4198..79af158fb 100644
--- a/bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jsch.core;singleton:=true
-Bundle-Version: 1.3.200.qualifier
+Bundle-Version: 1.3.300.qualifier
Bundle-Activator: org.eclipse.jsch.internal.core.JSchCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.jsch.core/pom.xml b/bundles/org.eclipse.jsch.core/pom.xml
index f2de4a92b..59a93639a 100644
--- a/bundles/org.eclipse.jsch.core/pom.xml
+++ b/bundles/org.eclipse.jsch.core/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.jsch</groupId>
<artifactId>org.eclipse.jsch.core</artifactId>
- <version>1.3.200-SNAPSHOT</version>
+ <version>1.3.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java
index e472dc3e6..3f93d8fe6 100644
--- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java
+++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java
@@ -69,23 +69,21 @@ public class ResponsiveSocketFactory implements SocketFactory {
// Start a thread to open a socket
final Socket[] socket = new Socket[] { null };
final Exception[] exception = new Exception[] {null };
- final Thread thread = new Thread(new Runnable() {
- public void run() {
- try {
- Socket newSocket = internalCreateSocket(host, port);
- synchronized (socket) {
- if (Thread.interrupted()) {
- // we we're either canceled or timed out so just close the socket
- newSocket.close();
- } else {
- socket[0] = newSocket;
- }
+ final Thread thread = new Thread(() -> {
+ try {
+ Socket newSocket = internalCreateSocket(host, port);
+ synchronized (socket) {
+ if (Thread.interrupted()) {
+ // we we're either canceled or timed out so just close the socket
+ newSocket.close();
+ } else {
+ socket[0] = newSocket;
}
- } catch (UnknownHostException e) {
- exception[0] = e;
- } catch (IOException e) {
- exception[0] = e;
}
+ } catch (UnknownHostException e1) {
+ exception[0] = e1;
+ } catch (IOException e2) {
+ exception[0] = e2;
}
});
thread.start();
diff --git a/bundles/org.eclipse.jsch.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jsch.ui/META-INF/MANIFEST.MF
index 870e35229..85d9ddbb3 100644
--- a/bundles/org.eclipse.jsch.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.jsch.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jsch.ui;singleton:=true
-Bundle-Version: 1.3.200.qualifier
+Bundle-Version: 1.3.300.qualifier
Bundle-Activator: org.eclipse.jsch.internal.ui.JSchUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.jsch.ui/pom.xml b/bundles/org.eclipse.jsch.ui/pom.xml
index b17701cb5..c9ba24c43 100644
--- a/bundles/org.eclipse.jsch.ui/pom.xml
+++ b/bundles/org.eclipse.jsch.ui/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.jsch</groupId>
<artifactId>org.eclipse.jsch.ui</artifactId>
- <version>1.3.200-SNAPSHOT</version>
+ <version>1.3.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java
index 2c6964335..bbbedc72b 100644
--- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java
+++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java
@@ -17,14 +17,15 @@
package org.eclipse.jsch.internal.ui.authenticator;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jsch.core.IJSchLocation;
import org.eclipse.jsch.internal.core.IUserAuthenticator;
import org.eclipse.jsch.internal.core.IUserInfo;
import org.eclipse.jsch.internal.ui.Messages;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
/**
* An authenticator that prompts the user for authentication info,
@@ -42,7 +43,8 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator{
/**
* @see IUserAuthenticator#promptForUserInfo(IJSchLocation, IUserInfo, String)
*/
- public void promptForUserInfo(final IJSchLocation location,
+ @Override
+public void promptForUserInfo(final IJSchLocation location,
final IUserInfo userinfo, final String message){
// ask the user for a password
@@ -55,12 +57,8 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator{
}
else{
// sync exec in default thread
- Display.getDefault().syncExec(new Runnable(){
- public void run(){
- allowCaching[0]=promptForPassword(location, userinfo.getUsername(),
- message, userinfo.isUsernameMutable(), result);
- }
- });
+ Display.getDefault().syncExec(() -> allowCaching[0] = promptForPassword(location, userinfo.getUsername(),
+ message, userinfo.isUsernameMutable(), result));
}
if(result[0]==null){
@@ -124,7 +122,8 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator{
* @param echo '*' should be used or not
* @return the entered values, or null if user canceled.
*/
- public String[] promptForKeyboradInteractive(
+ @Override
+public String[] promptForKeyboradInteractive(
final IJSchLocation location, final String destination,
final String name, final String instruction, final String[] prompt,
final boolean[] echo){
@@ -137,12 +136,8 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator{
}
else{
// sync exec in default thread
- Display.getDefault().syncExec(new Runnable(){
- public void run(){
- result[0]=_promptForUserInteractive(location, destination, name,
- instruction, prompt, echo, allowCaching);
- }
- });
+ Display.getDefault().syncExec(() -> result[0] = _promptForUserInteractive(location, destination, name,
+ instruction, prompt, echo, allowCaching));
}
if(result[0]!=null && location!=null &&
prompt!=null && prompt.length==1 && prompt[0].trim().equalsIgnoreCase("password:")){ //$NON-NLS-1$
@@ -177,7 +172,8 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator{
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.IUserAuthenticator#prompt(org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation, int, java.lang.String, java.lang.String, int[], int)
*/
- public int prompt(IJSchLocation location, final int promptType,
+ @Override
+public int prompt(IJSchLocation location, final int promptType,
final String title, final String message, final int[] promptResponses,
final int defaultResponse){
final Display display=getStandardDisplay();
@@ -201,27 +197,20 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator{
}
}
- display.syncExec(new Runnable(){
- public void run(){
+ display.syncExec(() -> {
final MessageDialog dialog=new MessageDialog(new Shell(display), title,
null, message, promptType, buttons, 1);
retval[0]=dialog.open();
- }
- });
+ });
return retval[0];
}
- public boolean promptForHostKeyChange(final IJSchLocation location){
+ @Override
+public boolean promptForHostKeyChange(final IJSchLocation location){
final boolean[] openConfirm=new boolean[] {false};
final Display display=getStandardDisplay();
- display.syncExec(new Runnable(){
- public void run(){
- openConfirm[0]=MessageDialog.openConfirm(null,
- Messages.WorkbenchUserAuthenticator_1, NLS.bind(
- Messages.WorkbenchUserAuthenticator_2, new String[] {location
- .getHost()})); //
- }
- });
+ display.syncExec(() -> openConfirm[0] = MessageDialog.openConfirm(null, Messages.WorkbenchUserAuthenticator_1,
+ NLS.bind(Messages.WorkbenchUserAuthenticator_2, new String[] { location.getHost() })));
if(!openConfirm[0]){
throw new OperationCanceledException();
}
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
index 09038d03e..cd208f6ac 100644
--- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
+++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java
@@ -125,7 +125,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
setDescription(Messages.CVSSSH2PreferencePage_18);
}
- protected Control createContents(Composite parent){
+ @Override
+protected Control createContents(Composite parent){
Composite container=new Composite(parent, SWT.NULL);
GridLayout layout=new GridLayout();
container.setLayout(layout);
@@ -216,7 +217,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
privateKeyAdd.setLayoutData(gd);
ssh2HomeBrowse.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
String home=ssh2HomeText.getText();
if(!new File(home).exists()){
@@ -242,7 +244,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
});
privateKeyAdd.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
String home=ssh2HomeText.getText();
FileDialog fd=new FileDialog(getShell(), SWT.OPEN|SWT.MULTI);
@@ -340,7 +343,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
keyCommentText.setLayoutData(gd);
keyCommentText.addModifyListener(new ModifyListener(){
- public void modifyText(ModifyEvent e){
+ @Override
+ public void modifyText(ModifyEvent e){
if(kpair==null)
return;
try{
@@ -375,7 +379,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
keyPassphrase2Text.setLayoutData(gd);
keyPassphrase1Text.addModifyListener(new ModifyListener(){
- public void modifyText(ModifyEvent e){
+ @Override
+ public void modifyText(ModifyEvent e){
String pass1=keyPassphrase1Text.getText();
String pass2=keyPassphrase2Text.getText();
if(kpair!=null&&pass1.equals(pass2)){
@@ -398,7 +403,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
});
keyPassphrase2Text.addModifyListener(new ModifyListener(){
- public void modifyText(ModifyEvent e){
+ @Override
+ public void modifyText(ModifyEvent e){
String pass1=keyPassphrase1Text.getText();
String pass2=keyPassphrase2Text.getText();
if(kpair!=null&&pass1.equals(pass2)){
@@ -426,7 +432,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
});
keyPassphrase2Text.addFocusListener(new FocusListener(){
- public void focusGained(FocusEvent e){
+ @Override
+ public void focusGained(FocusEvent e){
String pass1=keyPassphrase1Text.getText();
String pass2=keyPassphrase2Text.getText();
if(pass2.length()<pass1.length()){
@@ -446,7 +453,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
}
- public void focusLost(FocusEvent e){
+ @Override
+ public void focusLost(FocusEvent e){
String pass1=keyPassphrase1Text.getText();
String pass2=keyPassphrase2Text.getText();
if(pass1.equals(pass2)){
@@ -479,7 +487,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
saveKeyPair.setLayoutData(gd);
SelectionAdapter keygenadapter=new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
boolean ok=true;
String _type=""; //$NON-NLS-1$
@@ -500,16 +509,13 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
final KeyPair[] _kpair=new KeyPair[1];
final int __type=type;
final JSchException[] _e=new JSchException[1];
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable(){
- public void run(){
- try{
- _kpair[0]=KeyPair.genKeyPair(getJSch(), __type);
- }
- catch(JSchException e){
- _e[0]=e;
- }
- }
- });
+ BusyIndicator.showWhile(getShell().getDisplay(), () -> {
+ try {
+ _kpair[0] = KeyPair.genKeyPair(getJSch(), __type);
+ } catch (JSchException e1) {
+ _e[0] = e1;
+ }
+ });
if(_e[0]!=null){
throw _e[0];
}
@@ -543,7 +549,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
keyGenerateRSA.addSelectionListener(keygenadapter);
keyLoad.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
boolean ok=true;
String home=ssh2HomeText.getText();
FileDialog fd=new FileDialog(getShell(), SWT.OPEN);
@@ -642,7 +649,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
});
keyExport.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
if(kpair==null)
return;
@@ -650,20 +658,18 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
final String[] target=new String[1];
final String title=Messages.CVSSSH2PreferencePage_106;
- final String message=Messages.CVSSSH2PreferencePage_107;
- Display.getDefault().syncExec(new Runnable(){
- public void run(){
- Display display=Display.getCurrent();
- Shell shell=new Shell(display);
- ExportDialog dialog=new ExportDialog(shell, title, message);
- dialog.open();
- shell.dispose();
- target[0]=dialog.getTarget();
- }
- });
- if(target[0]==null){
- return;
- }
+ final String message = Messages.CVSSSH2PreferencePage_107;
+ Display.getDefault().syncExec(() -> {
+ Display display = Display.getCurrent();
+ Shell shell = new Shell(display);
+ ExportDialog dialog = new ExportDialog(shell, title, message);
+ dialog.open();
+ shell.dispose();
+ target[0] = dialog.getTarget();
+ });
+ if (target[0] == null) {
+ return;
+ }
String user=""; //$NON-NLS-1$
String host=""; //$NON-NLS-1$
int port=22;
@@ -713,7 +719,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
});
saveKeyPair.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
if(kpair==null)
return;
@@ -834,7 +841,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
Button mac_down;
class TableLabelProvider extends LabelProvider implements ITableLabelProvider{
- public String getColumnText(Object element, int columnIndex){
+ @Override
+ public String getColumnText(Object element, int columnIndex){
HostKey entry=(HostKey)element;
switch(columnIndex){
case 0:
@@ -848,7 +856,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
}
- public Image getColumnImage(Object element, int columnIndex){
+ @Override
+ public Image getColumnImage(Object element, int columnIndex){
return null;
}
}
@@ -889,7 +898,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
gd.heightHint=100;
table.setLayoutData(gd);
table.addListener(SWT.Selection, new Listener(){
- public void handleEvent(Event e){
+ @Override
+ public void handleEvent(Event e){
handleSelection();
}
});
@@ -907,15 +917,18 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
Messages.CVSSSH2PreferencePage_136});
viewer.setLabelProvider(new TableLabelProvider());
viewer.setContentProvider(new IStructuredContentProvider(){
- public void dispose(){
+ @Override
+ public void dispose(){
// nothing to do
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput){
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput){
// nothing to do
}
- public Object[] getElements(Object inputElement){
+ @Override
+ public Object[] getElements(Object inputElement){
if(inputElement==null)
return null;
return (Object[])inputElement;
@@ -943,7 +956,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
SWT.DEFAULT, SWT.END, SWT.CENTER, false, false));
removeHostKeyButton.setEnabled(false);
removeHostKeyButton.addListener(SWT.Selection, new Listener(){
- public void handleEvent(Event e){
+ @Override
+ public void handleEvent(Event e){
removeHostKey();
}
});
@@ -995,7 +1009,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
preferedAuthMethodTable.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
boolean anySelected = false;
for(int i = 0; i < preferedAuthMethodTable.getItemCount(); i++){
anySelected |= preferedAuthMethodTable.getItem(i).getChecked();
@@ -1018,7 +1033,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
});
up.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
int selectedIndex=preferedAuthMethodTable.getSelectionIndex();
if(selectedIndex == 1){ //this is the last possible swap
up.setEnabled(false);
@@ -1043,7 +1059,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
down.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
int selectedIndex=preferedAuthMethodTable.getSelectionIndex();
if(selectedIndex == preferedAuthMethodTable.getItemCount()-2){ //this is the last possible swap
down.setEnabled(false);
@@ -1121,7 +1138,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
preferedKeyExchangeMethodTable.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
boolean anySelected = false;
for(int i = 0; i < preferedKeyExchangeMethodTable.getItemCount(); i++){
anySelected |= preferedKeyExchangeMethodTable.getItem(i).getChecked();
@@ -1144,7 +1162,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
});
kex_up.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
int selectedIndex=preferedKeyExchangeMethodTable.getSelectionIndex();
if(selectedIndex == 1){ //this is the last possible swap
kex_up.setEnabled(false);
@@ -1169,7 +1188,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
kex_down.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
int selectedIndex=preferedKeyExchangeMethodTable.getSelectionIndex();
if(selectedIndex == preferedKeyExchangeMethodTable.getItemCount()-2){ //this is the last possible swap
kex_down.setEnabled(false);
@@ -1247,7 +1267,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
preferedMACMethodTable.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
boolean anySelected = false;
for(int i = 0; i < preferedMACMethodTable.getItemCount(); i++){
anySelected |= preferedMACMethodTable.getItem(i).getChecked();
@@ -1270,7 +1291,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
});
mac_up.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
int selectedIndex=preferedMACMethodTable.getSelectionIndex();
if(selectedIndex == 1){ //this is the last possible swap
mac_up.setEnabled(false);
@@ -1295,7 +1317,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
mac_down.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e){
+ @Override
+ public void widgetSelected(SelectionEvent e){
int selectedIndex=preferedMACMethodTable.getSelectionIndex();
if(selectedIndex == preferedMACMethodTable.getItemCount()-2){ //this is the last possible swap
mac_down.setEnabled(false);
@@ -1505,7 +1528,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
mac_down.setEnabled(false);
}
- public void init(IWorkbench workbench){
+ @Override
+public void init(IWorkbench workbench){
// super.init(workbench);
// initControls();
}
@@ -1523,7 +1547,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
updateControls();
}
- public boolean performOk(){
+ @Override
+public boolean performOk(){
boolean result=super.performOk();
storeAuthenticationMethodSettings();
storeSSHAgentSettings();
@@ -1641,11 +1666,13 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
Utils.setEnabledPreferredMACMethods(selected, order);
}
- public void performApply(){
+ @Override
+public void performApply(){
performOk();
}
- protected void performDefaults(){
+ @Override
+protected void performDefaults(){
super.performDefaults();
Utils.setEnabledPreferredAuthMethods(Utils.getDefaultAuthMethods(), Utils
.getDefaultAuthMethods());
@@ -1678,7 +1705,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
this.message=message;
}
- public void run(){
+ @Override
+ public void run(){
Display display=Display.getCurrent();
Shell shell=new Shell(display);
PassphraseDialog dialog=new PassphraseDialog(shell, message);
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/ui/UserInfoPrompter.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/ui/UserInfoPrompter.java
index 71017e650..4504fb848 100644
--- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/ui/UserInfoPrompter.java
+++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/ui/UserInfoPrompter.java
@@ -17,11 +17,15 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jsch.core.IJSchService;
-import org.eclipse.jsch.internal.ui.*;
+import org.eclipse.jsch.internal.ui.KeyboardInteractiveDialog;
+import org.eclipse.jsch.internal.ui.Messages;
+import org.eclipse.jsch.internal.ui.UserValidationDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import com.jcraft.jsch.*;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.UIKeyboardInteractive;
+import com.jcraft.jsch.UserInfo;
/**
* A {@link UserInfo} prompter implementation that can be used when connecting a
@@ -68,7 +72,8 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
*
* @see com.jcraft.jsch.UserInfo#getPassphrase()
*/
- public String getPassphrase(){
+ @Override
+public String getPassphrase(){
return passphrase;
}
@@ -77,7 +82,8 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
*
* @see com.jcraft.jsch.UserInfo#getPassword()
*/
- public String getPassword(){
+ @Override
+public String getPassword(){
return password;
}
@@ -110,7 +116,8 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
*
* @see com.jcraft.jsch.UserInfo#promptPassphrase(java.lang.String)
*/
- public boolean promptPassphrase(String message){
+ @Override
+public boolean promptPassphrase(String message){
String _passphrase=promptSecret(message);
if(_passphrase!=null){
setPassphrase(_passphrase);
@@ -123,7 +130,8 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
*
* @see com.jcraft.jsch.UserInfo#promptPassword(java.lang.String)
*/
- public boolean promptPassword(String message){
+ @Override
+public boolean promptPassword(String message){
String _password=promptSecret(message);
if(_password!=null){
setPassword(_password);
@@ -140,11 +148,7 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
}
else{
// sync exec in default thread
- Display.getDefault().syncExec(new Runnable(){
- public void run(){
- result[0]=promptForPassword(message);
- }
- });
+ Display.getDefault().syncExec(() -> result[0] = promptForPassword(message));
}
if(result[0]==null){
@@ -168,7 +172,8 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
* @see com.jcraft.jsch.UIKeyboardInteractive#promptKeyboardInteractive(java.lang.String,
* java.lang.String, java.lang.String, java.lang.String[], boolean[])
*/
- public String[] promptKeyboardInteractive(String destination, String name,
+ @Override
+public String[] promptKeyboardInteractive(String destination, String name,
String instruction, String[] prompt, boolean[] echo){
if(prompt.length==0){
// No need to prompt, just return an empty String array
@@ -209,12 +214,8 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
}
else{
// sync exec in default thread
- Display.getDefault().syncExec(new Runnable(){
- public void run(){
- result[0]=internalPromptForUserInteractive(destination, name,
- instruction, prompt, echo);
- }
- });
+ Display.getDefault().syncExec(
+ () -> result[0] = internalPromptForUserInteractive(destination, name, instruction, prompt, echo));
}
return result[0];
}
@@ -235,7 +236,8 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
*
* @see com.jcraft.jsch.UserInfo#promptYesNo(java.lang.String)
*/
- public boolean promptYesNo(String question){
+ @Override
+public boolean promptYesNo(String question){
int prompt=prompt(MessageDialog.QUESTION, Messages.UserInfoPrompter_0,
question, new int[] {IDialogConstants.YES_ID, IDialogConstants.NO_ID},
0 // yes
@@ -250,7 +252,8 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
*
* @see com.jcraft.jsch.UserInfo#showMessage(java.lang.String)
*/
- public void showMessage(String message){
+ @Override
+public void showMessage(String message){
prompt(MessageDialog.INFORMATION, Messages.UserInfoPrompter_1, message,
new int[] {IDialogConstants.OK_ID}, 0);
}
@@ -279,14 +282,12 @@ public class UserInfoPrompter implements UserInfo, UIKeyboardInteractive{
}
}
- display.syncExec(new Runnable(){
- public void run(){
+ display.syncExec(() -> {
final MessageDialog dialog=new MessageDialog(new Shell(display), title,
null /* title image */, message, promptType, buttons,
defaultResponse);
retval[0]=dialog.open();
- }
- });
+ });
return retval[0];
}
diff --git a/bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.ui.prefs
index e7234c08b..522639ef0 100644
--- a/bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.team.core/.settings/org.eclipse.jdt.ui.prefs
@@ -5,7 +5,7 @@ org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;org;com;
org.eclipse.jdt.ui.ondemandthreshold=3
org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n *\n * This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License 2.0\r\n * which accompanies this distribution, and is available at\r\n * https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n *\n * This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License 2.0\r\n * which accompanies this distribution, and is available at\r\n * https\://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier\: EPL-2.0\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
sp_cleanup.add_default_serial_version_id=false
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=false
@@ -22,8 +22,8 @@ sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=false
@@ -40,6 +40,8 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=false
+sp_cleanup.remove_redundant_modifiers=false
+sp_cleanup.remove_redundant_semicolons=false
sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
diff --git a/bundles/org.eclipse.team.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.core/META-INF/MANIFEST.MF
index 6f818ba7a..979fa6ad8 100644
--- a/bundles/org.eclipse.team.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.team.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.team.core; singleton:=true
-Bundle-Version: 3.8.300.qualifier
+Bundle-Version: 3.8.400.qualifier
Bundle-Activator: org.eclipse.team.internal.core.TeamPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.team.core/pom.xml b/bundles/org.eclipse.team.core/pom.xml
index 176302b2b..5d82e9ac9 100644
--- a/bundles/org.eclipse.team.core/pom.xml
+++ b/bundles/org.eclipse.team.core/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.team</groupId>
<artifactId>org.eclipse.team.core</artifactId>
- <version>3.8.300-SNAPSHOT</version>
+ <version>3.8.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
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 12a3957a1..a7c430a92 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
@@ -161,12 +161,8 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
@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);
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor1 -> internalPrepareContext(monitor1),
+ getSchedulingRule(), IResource.NONE, monitor);
}
@Override
@@ -174,12 +170,8 @@ public class SynchronizationScopeManager extends PlatformObject implements ISync
// 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);
- }
- }, getSchedulingRule(), IResource.NONE, monitor);
+ workspace.run((IWorkspaceRunnable) monitor1 -> traversals[0] = internalRefreshScope(mappings, true, monitor1),
+ getSchedulingRule(), IResource.NONE, monitor);
return traversals[0];
}
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 63f2ea1ff..1db774d12 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
@@ -14,8 +14,6 @@
package org.eclipse.team.core.variants;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
@@ -110,12 +108,9 @@ public abstract class ThreeWayRemoteTree extends ResourceVariantTree {
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);
- }
- }, monitor);
+ getSubscriber().getSynchronizer().run(local,
+ monitor1 -> resources[0] = ThreeWayRemoteTree.super.collectChanges(local, remote, depth, monitor1),
+ monitor);
return resources[0];
}
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
index 566693733..8214b3c5a 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutInputStream.java
@@ -63,12 +63,7 @@ public class TimeoutInputStream extends FilterInputStream {
this.readTimeout = readTimeout;
this.closeTimeout = closeTimeout;
this.iobuffer = new byte[bufferSize];
- thread = new Thread(new Runnable() {
- @Override
- public void run() {
- runThread();
- }
- }, "TimeoutInputStream");//$NON-NLS-1$
+ thread = new Thread((Runnable) () -> runThread(), "TimeoutInputStream");//$NON-NLS-1$
thread.setDaemon(true);
thread.start();
}
diff --git a/bundles/org.eclipse.team.cvs.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.cvs.core/META-INF/MANIFEST.MF
index 087e6cf66..498a5d86b 100644
--- a/bundles/org.eclipse.team.cvs.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.team.cvs.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.team.cvs.core; singleton:=true
-Bundle-Version: 3.4.300.qualifier
+Bundle-Version: 3.4.400.qualifier
Bundle-Activator: org.eclipse.team.internal.ccvs.core.CVSProviderPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.team.cvs.core/pom.xml b/bundles/org.eclipse.team.cvs.core/pom.xml
index cf8d358ef..8461cc750 100644
--- a/bundles/org.eclipse.team.cvs.core/pom.xml
+++ b/bundles/org.eclipse.team.cvs.core/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.team</groupId>
<artifactId>org.eclipse.team.cvs.core</artifactId>
- <version>3.4.300-SNAPSHOT</version>
+ <version>3.4.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java
index 85a5506af..67fe69b65 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java
@@ -250,23 +250,21 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
final List result = new ArrayList();
try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("", 1000 * projects.length); //$NON-NLS-1$
- try {
- for (int i = 0; i < projects.length; i++) {
- if (monitor.isCanceled())
- break;
- IProject project = projects[i];
- LoadInfo info = (LoadInfo) infoMap.get(project);
- if (info != null && info.checkout(SubMonitor.convert(monitor, 1000)))
- result.add(project);
- }
- }
- finally {
- monitor.done();
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor1 -> {
+ monitor1.beginTask("", 1000 * projects.length); //$NON-NLS-1$
+ try {
+ for (int i = 0; i < projects.length; i++) {
+ if (monitor1.isCanceled())
+ break;
+ IProject project = projects[i];
+ LoadInfo info = (LoadInfo) infoMap.get(project);
+ if (info != null && info.checkout(SubMonitor.convert(monitor1, 1000)))
+ result.add(project);
}
}
+ finally {
+ monitor1.done();
+ }
}, getCheckoutRule(projects), IResource.NONE, monitor);
} catch (CoreException e) {
throw TeamException.asTeamException(e);
@@ -406,108 +404,104 @@ public class CVSProjectSetCapability extends ProjectSetCapability {
public static void checkout(final ICVSRemoteFolder[] resources, final IProject[] projects, final IProgressMonitor monitor) throws TeamException {
final TeamException[] eHolder = new TeamException[1];
try {
- IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor pm) throws CoreException {
- try {
- pm.beginTask(null, 1000 * resources.length);
+ IWorkspaceRunnable workspaceRunnable = pm -> {
+ try {
+ pm.beginTask(null, 1000 * resources.length);
+
+ // Get the location of the workspace root
+ ICVSFolder root = CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot());
+
+ for (int i=0;i<resources.length;i++) {
+ IProject project = null;
+ RemoteFolder resource = (RemoteFolder)resources[i];
- // Get the location of the workspace root
- ICVSFolder root = CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot());
+ // Determine the provided target project if there is one
+ if (projects != null)
+ project = projects[i];
- for (int i=0;i<resources.length;i++) {
- IProject project = null;
- RemoteFolder resource = (RemoteFolder)resources[i];
-
- // Determine the provided target project if there is one
- if (projects != null)
- project = projects[i];
-
- // Determine the remote module to be checked out
- String moduleName;
- if (resource instanceof RemoteModule) {
- moduleName = ((RemoteModule)resource).getName();
- } else {
- moduleName = resource.getRepositoryRelativePath();
- }
+ // Determine the remote module to be checked out
+ String moduleName;
+ if (resource instanceof RemoteModule) {
+ moduleName = ((RemoteModule)resource).getName();
+ } else {
+ moduleName = resource.getRepositoryRelativePath();
+ }
+
+ // Open a connection session to the repository
+ ICVSRepositoryLocation repository = resource.getRepository();
+ Session session = new Session(repository, root);
+ try {
+ session.open(Policy.subMonitorFor(pm, 50), false /* read-only */);
- // Open a connection session to the repository
- ICVSRepositoryLocation repository = resource.getRepository();
- Session session = new Session(repository, root);
- try {
- session.open(Policy.subMonitorFor(pm, 50), false /* read-only */);
+ // Determine the local target projects (either the project provider or the module expansions)
+ final Set targetProjects = new HashSet();
+ if (project == null) {
- // Determine the local target projects (either the project provider or the module expansions)
- final Set targetProjects = new HashSet();
- if (project == null) {
-
- // Fetch the module expansions
- IStatus status = Request.EXPAND_MODULES.execute(session, new String[] {moduleName}, Policy.subMonitorFor(pm, 50));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
-
- // Convert the module expansions to local projects
- String[] expansions = session.getModuleExpansions();
- for (int j = 0; j < expansions.length; j++) {
- targetProjects.add(ResourcesPlugin.getWorkspace().getRoot().getProject(new Path(null, expansions[j]).segment(0)));
- }
-
- } else {
- targetProjects.add(project);
+ // Fetch the module expansions
+ IStatus status1 = Request.EXPAND_MODULES.execute(session, new String[] {moduleName}, Policy.subMonitorFor(pm, 50));
+ if (status1.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status1);
}
- // Prepare the target projects to receive resources
- root.run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- scrubProjects((IProject[]) targetProjects.toArray(new IProject[targetProjects.size()]), monitor);
- }
- }, Policy.subMonitorFor(pm, 100));
-
- // Build the local options
- List localOptions = new ArrayList();
- // Add the option to load into the target project if one was supplied
- if (project != null) {
- localOptions.add(Checkout.makeDirectoryNameOption(project.getName()));
- }
- // Prune empty directories if pruning enabled
- if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories())
- localOptions.add(Command.PRUNE_EMPTY_DIRECTORIES);
- // Add the options related to the CVSTag
- CVSTag tag = resource.getTag();
- if (tag == null) {
- // A null tag in a remote resource indicates HEAD
- tag = CVSTag.DEFAULT;
- }
- localOptions.add(Update.makeTagOption(tag));
-
- // Perform the checkout
- IStatus status = Command.CHECKOUT.execute(session,
- Command.NO_GLOBAL_OPTIONS,
- (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
- new String[]{moduleName},
- null,
- Policy.subMonitorFor(pm, 800));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- // XXX Should we cleanup any partially checked out projects?
- throw new CVSServerException(status);
+ // Convert the module expansions to local projects
+ String[] expansions = session.getModuleExpansions();
+ for (int j = 0; j < expansions.length; j++) {
+ targetProjects.add(ResourcesPlugin.getWorkspace().getRoot().getProject(new Path(null, expansions[j]).segment(0)));
}
- // Bring the project into the workspace
- refreshProjects((IProject[])targetProjects.toArray(new IProject[targetProjects.size()]), Policy.subMonitorFor(pm, 100));
+ } else {
+ targetProjects.add(project);
+ }
+
+ // Prepare the target projects to receive resources
+ root.run(monitor1 -> scrubProjects(
+ (IProject[]) targetProjects.toArray(new IProject[targetProjects.size()]), monitor1),
+ Policy.subMonitorFor(pm, 100));
- } finally {
- session.close();
+ // Build the local options
+ List localOptions = new ArrayList();
+ // Add the option to load into the target project if one was supplied
+ if (project != null) {
+ localOptions.add(Checkout.makeDirectoryNameOption(project.getName()));
+ }
+ // Prune empty directories if pruning enabled
+ if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories())
+ localOptions.add(Command.PRUNE_EMPTY_DIRECTORIES);
+ // Add the options related to the CVSTag
+ CVSTag tag = resource.getTag();
+ if (tag == null) {
+ // A null tag in a remote resource indicates HEAD
+ tag = CVSTag.DEFAULT;
}
+ localOptions.add(Update.makeTagOption(tag));
+
+ // Perform the checkout
+ IStatus status2 = Command.CHECKOUT.execute(session,
+ Command.NO_GLOBAL_OPTIONS,
+ (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]),
+ new String[]{moduleName},
+ null,
+ Policy.subMonitorFor(pm, 800));
+ if (status2.getCode() == CVSStatus.SERVER_ERROR) {
+ // XXX Should we cleanup any partially checked out projects?
+ throw new CVSServerException(status2);
+ }
+
+ // Bring the project into the workspace
+ refreshProjects((IProject[])targetProjects.toArray(new IProject[targetProjects.size()]), Policy.subMonitorFor(pm, 100));
+
+ } finally {
+ session.close();
}
}
- catch (TeamException e) {
- // Pass it outside the workspace runnable
- eHolder[0] = e;
- } finally {
- pm.done();
- }
- // CoreException and OperationCanceledException are propagated
}
+ catch (TeamException e) {
+ // Pass it outside the workspace runnable
+ eHolder[0] = e;
+ } finally {
+ pm.done();
+ }
+ // CoreException and OperationCanceledException are propagated
};
ResourcesPlugin.getWorkspace().run(workspaceRunnable, getCheckoutRule(projects), 0, monitor);
} catch (CoreException e) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 2f79aabb8..02e7a32af 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -235,32 +235,30 @@ public class CVSTeamProvider extends RepositoryProvider {
return;
try {
- workspaceRoot.getLocalRoot().run(new ICVSRunnable() {
- public void run(IProgressMonitor progress) throws CVSException {
- try {
- // 256 ticks gives us a maximum of 1024 which seems reasonable for folders is a project
- progress.beginTask(null, 100);
- final IProgressMonitor monitor = Policy.infiniteSubMonitorFor(progress, 100);
- monitor.beginTask(null, 256);
-
- // Visit all the children folders in order to set the root in the folder sync info
- workspaceRoot.getLocalRoot().accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {}
- public void visitFolder(ICVSFolder folder) throws CVSException {
- monitor.worked(1);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- if (info != null) {
- monitor.subTask(NLS.bind(CVSMessages.CVSTeamProvider_updatingFolder, new String[] { info.getRepository() }));
- MutableFolderSyncInfo newInfo = info.cloneMutable();
- newInfo.setRoot(root);
- folder.setFolderSyncInfo(newInfo);
- folder.acceptChildren(this);
- }
+ workspaceRoot.getLocalRoot().run(progress -> {
+ try {
+ // 256 ticks gives us a maximum of 1024 which seems reasonable for folders is a project
+ progress.beginTask(null, 100);
+ final IProgressMonitor monitor1 = Policy.infiniteSubMonitorFor(progress, 100);
+ monitor1.beginTask(null, 256);
+
+ // Visit all the children folders in order to set the root in the folder sync info
+ workspaceRoot.getLocalRoot().accept(new ICVSResourceVisitor() {
+ public void visitFile(ICVSFile file) throws CVSException {}
+ public void visitFolder(ICVSFolder folder) throws CVSException {
+ monitor1.worked(1);
+ FolderSyncInfo info = folder.getFolderSyncInfo();
+ if (info != null) {
+ monitor1.subTask(NLS.bind(CVSMessages.CVSTeamProvider_updatingFolder, new String[] { info.getRepository() }));
+ MutableFolderSyncInfo newInfo = info.cloneMutable();
+ newInfo.setRoot(root);
+ folder.setFolderSyncInfo(newInfo);
+ folder.acceptChildren(this);
}
- });
- } finally {
- progress.done();
- }
+ }
+ });
+ } finally {
+ progress.done();
}
}, monitor);
} finally {
@@ -307,121 +305,119 @@ public class CVSTeamProvider extends RepositoryProvider {
final String comment,
IProgressMonitor monitor) throws TeamException {
final IStatus[] result = new IStatus[] { ICommandOutputListener.OK };
- workspaceRoot.getLocalRoot().run(new ICVSRunnable() {
- public void run(final IProgressMonitor monitor) throws CVSException {
- final Map /* from KSubstOption to List of String */ filesToAdmin = new HashMap();
- final Collection /* of ICVSFile */ filesToCommitAsText = new HashSet(); // need fast lookup
- final boolean useCRLF = IS_CRLF_PLATFORM && (CVSProviderPlugin.getPlugin().isUsePlatformLineend());
-
- /*** determine the resources to be committed and/or admin'd ***/
- for (Iterator it = changeSet.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- IFile file = (IFile) entry.getKey();
- KSubstOption toKSubst = (KSubstOption) entry.getValue();
+ workspaceRoot.getLocalRoot().run(monitor1 -> {
+ final Map /* from KSubstOption to List of String */ filesToAdmin = new HashMap();
+ final Collection /* of ICVSFile */ filesToCommitAsText = new HashSet(); // need fast lookup
+ final boolean useCRLF = IS_CRLF_PLATFORM && (CVSProviderPlugin.getPlugin().isUsePlatformLineend());
- // only set keyword substitution if resource is a managed file
- checkIsChild(file);
- ICVSFile mFile = CVSWorkspaceRoot.getCVSFileFor(file);
- if (! mFile.isManaged()) continue;
-
- // only set keyword substitution if new differs from actual
- byte[] syncBytes = mFile.getSyncBytes();
- KSubstOption fromKSubst = ResourceSyncInfo.getKeywordMode(syncBytes);
- if (toKSubst.equals(fromKSubst)) continue;
-
- // change resource sync info immediately for an outgoing addition
- if (ResourceSyncInfo.isAddition(syncBytes)) {
- mFile.setSyncBytes(ResourceSyncInfo.setKeywordMode(syncBytes, toKSubst), ICVSFile.UNKNOWN);
- continue;
- }
+ /*** determine the resources to be committed and/or admin'd ***/
+ for (Iterator it1 = changeSet.entrySet().iterator(); it1.hasNext();) {
+ Map.Entry entry1 = (Map.Entry) it1.next();
+ IFile file = (IFile) entry1.getKey();
+ KSubstOption toKSubst1 = (KSubstOption) entry1.getValue();
- // nothing do to for deletions
- if (ResourceSyncInfo.isDeletion(syncBytes)) continue;
+ // only set keyword substitution if resource is a managed file
+ checkIsChild(file);
+ ICVSFile mFile = CVSWorkspaceRoot.getCVSFileFor(file);
+ if (! mFile.isManaged()) continue;
+
+ // only set keyword substitution if new differs from actual
+ byte[] syncBytes = mFile.getSyncBytes();
+ KSubstOption fromKSubst = ResourceSyncInfo.getKeywordMode(syncBytes);
+ if (toKSubst1.equals(fromKSubst)) continue;
+
+ // change resource sync info immediately for an outgoing addition
+ if (ResourceSyncInfo.isAddition(syncBytes)) {
+ mFile.setSyncBytes(ResourceSyncInfo.setKeywordMode(syncBytes, toKSubst1), ICVSFile.UNKNOWN);
+ continue;
+ }
- // file exists remotely so we'll have to commit it
- if (fromKSubst.isBinary() && ! toKSubst.isBinary()) {
- // converting from binary to text
- cleanLineDelimiters(file, useCRLF, new NullProgressMonitor()); // XXX need better progress monitoring
- // remember to commit the cleaned resource as text before admin
- filesToCommitAsText.add(mFile);
- }
- // remember to admin the resource
- List list = (List) filesToAdmin.get(toKSubst);
- if (list == null) {
- list = new ArrayList();
- filesToAdmin.put(toKSubst, list);
- }
- list.add(mFile);
+ // nothing do to for deletions
+ if (ResourceSyncInfo.isDeletion(syncBytes)) continue;
+
+ // file exists remotely so we'll have to commit it
+ if (fromKSubst.isBinary() && ! toKSubst1.isBinary()) {
+ // converting from binary to text
+ cleanLineDelimiters(file, useCRLF, new NullProgressMonitor()); // XXX need better progress monitoring
+ // remember to commit the cleaned resource as text before admin
+ filesToCommitAsText.add(mFile);
}
-
- /*** commit then admin the resources ***/
- // compute the total work to be performed
- int totalWork = filesToCommitAsText.size() + 1;
- for (Iterator it = filesToAdmin.values().iterator(); it.hasNext();) {
- List list = (List) it.next();
- totalWork += list.size();
- totalWork += 1; // Add 1 for each connection that needs to be made
+ // remember to admin the resource
+ List list1 = (List) filesToAdmin.get(toKSubst1);
+ if (list1 == null) {
+ list1 = new ArrayList();
+ filesToAdmin.put(toKSubst1, list1);
}
- if (totalWork != 0) {
- monitor.beginTask(CVSMessages.CVSTeamProvider_settingKSubst, totalWork);
- try {
- // commit files that changed from binary to text
- // NOTE: The files are committed as text with conversions even if the
- // resource sync info still says "binary".
- if (filesToCommitAsText.size() != 0) {
- Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 1), true /* open for modification */);
- try {
- String keywordChangeComment = comment;
- if (keywordChangeComment == null || keywordChangeComment.length() == 0)
- keywordChangeComment = CVSMessages.CVSTeamProvider_changingKeywordComment;
- result[0] = Command.COMMIT.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] { Command.DO_NOT_RECURSE, Commit.FORCE,
- Command.makeArgumentOption(Command.MESSAGE_OPTION, keywordChangeComment) },
- (ICVSResource[]) filesToCommitAsText.toArray(new ICVSResource[filesToCommitAsText.size()]),
- filesToCommitAsText,
- null,
- Policy.subMonitorFor(monitor, filesToCommitAsText.size()));
- } finally {
- session.close();
- }
-
- // if errors were encountered, abort
- if (! result[0].isOK()) return;
+ list1.add(mFile);
+ }
+
+ /*** commit then admin the resources ***/
+ // compute the total work to be performed
+ int totalWork = filesToCommitAsText.size() + 1;
+ for (Iterator it2 = filesToAdmin.values().iterator(); it2.hasNext();) {
+ List list2 = (List) it2.next();
+ totalWork += list2.size();
+ totalWork += 1; // Add 1 for each connection that needs to be made
+ }
+ if (totalWork != 0) {
+ monitor1.beginTask(CVSMessages.CVSTeamProvider_settingKSubst, totalWork);
+ try {
+ // commit files that changed from binary to text
+ // NOTE: The files are committed as text with conversions even if the
+ // resource sync info still says "binary".
+ if (filesToCommitAsText.size() != 0) {
+ Session session1 = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
+ session1.open(Policy.subMonitorFor(monitor1, 1), true /* open for modification */);
+ try {
+ String keywordChangeComment = comment;
+ if (keywordChangeComment == null || keywordChangeComment.length() == 0)
+ keywordChangeComment = CVSMessages.CVSTeamProvider_changingKeywordComment;
+ result[0] = Command.COMMIT.execute(
+ session1,
+ Command.NO_GLOBAL_OPTIONS,
+ new LocalOption[] { Command.DO_NOT_RECURSE, Commit.FORCE,
+ Command.makeArgumentOption(Command.MESSAGE_OPTION, keywordChangeComment) },
+ (ICVSResource[]) filesToCommitAsText.toArray(new ICVSResource[filesToCommitAsText.size()]),
+ filesToCommitAsText,
+ null,
+ Policy.subMonitorFor(monitor1, filesToCommitAsText.size()));
+ } finally {
+ session1.close();
}
-
- // admin files that changed keyword substitution mode
- // NOTE: As confirmation of the completion of a command, the server replies
- // with the RCS command output if a change took place. Rather than
- // assume that the command succeeded, we listen for these lines
- // and update the local ResourceSyncInfo for the particular files that
- // were actually changed remotely.
- for (Iterator it = filesToAdmin.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- final KSubstOption toKSubst = (KSubstOption) entry.getKey();
- final List list = (List) entry.getValue();
- // do it
- Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
- session.open(Policy.subMonitorFor(monitor, 1), true /* open for modification */);
- try {
- result[0] = Command.ADMIN.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] { toKSubst },
- (ICVSResource[]) list.toArray(new ICVSResource[list.size()]),
- new AdminKSubstListener(toKSubst),
- Policy.subMonitorFor(monitor, list.size()));
- } finally {
- session.close();
- }
- // if errors were encountered, abort
- if (! result[0].isOK()) return;
+
+ // if errors were encountered, abort
+ if (! result[0].isOK()) return;
+ }
+
+ // admin files that changed keyword substitution mode
+ // NOTE: As confirmation of the completion of a command, the server replies
+ // with the RCS command output if a change took place. Rather than
+ // assume that the command succeeded, we listen for these lines
+ // and update the local ResourceSyncInfo for the particular files that
+ // were actually changed remotely.
+ for (Iterator it3 = filesToAdmin.entrySet().iterator(); it3.hasNext();) {
+ Map.Entry entry2 = (Map.Entry) it3.next();
+ final KSubstOption toKSubst2 = (KSubstOption) entry2.getKey();
+ final List list3 = (List) entry2.getValue();
+ // do it
+ Session session2 = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
+ session2.open(Policy.subMonitorFor(monitor1, 1), true /* open for modification */);
+ try {
+ result[0] = Command.ADMIN.execute(
+ session2,
+ Command.NO_GLOBAL_OPTIONS,
+ new LocalOption[] { toKSubst2 },
+ (ICVSResource[]) list3.toArray(new ICVSResource[list3.size()]),
+ new AdminKSubstListener(toKSubst2),
+ Policy.subMonitorFor(monitor1, list3.size()));
+ } finally {
+ session2.close();
}
- } finally {
- monitor.done();
+ // if errors were encountered, abort
+ if (! result[0].isOK()) return;
}
+ } finally {
+ monitor1.done();
}
}
}, Policy.monitorFor(monitor));
@@ -579,45 +575,43 @@ public class CVSTeamProvider extends RepositoryProvider {
*/
private void notifyEditUnedit(final IResource[] resources, final boolean recurse, final boolean notifyServer, final ICVSResourceVisitor editUneditVisitor, ISchedulingRule rule, IProgressMonitor monitor) throws CVSException {
final CVSException[] exception = new CVSException[] { null };
- IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- final ICVSResource[] cvsResources = getCVSArguments(resources);
-
- // mark the files locally as being checked out
- try {
- for (int i = 0; i < cvsResources.length; i++) {
- cvsResources[i].accept(editUneditVisitor, recurse);
- }
- } catch (CVSException e) {
- exception[0] = e;
- return;
+ IWorkspaceRunnable workspaceRunnable = monitor1 -> {
+ final ICVSResource[] cvsResources = getCVSArguments(resources);
+
+ // mark the files locally as being checked out
+ try {
+ for (int i = 0; i < cvsResources.length; i++) {
+ cvsResources[i].accept(editUneditVisitor, recurse);
}
-
- // send the noop command to the server in order to deliver the notifications
- if (notifyServer) {
- monitor.beginTask(null, 100);
- Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true);
+ } catch (CVSException e2) {
+ exception[0] = e2;
+ return;
+ }
+
+ // send the noop command to the server in order to deliver the notifications
+ if (notifyServer) {
+ monitor1.beginTask(null, 100);
+ Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true);
+ try {
try {
- try {
- session.open(Policy.subMonitorFor(monitor, 10), true /* open for modification */);
- } catch (CVSException e1) {
- // If the connection cannot be opened, just exit normally.
- // The notifications will be sent when a connection can be made
- return;
- }
- Command.NOOP.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- cvsResources,
- null,
- Policy.subMonitorFor(monitor, 90));
- } catch (CVSException e) {
- exception[0] = e;
- } finally {
- session.close();
- monitor.done();
+ session.open(Policy.subMonitorFor(monitor1, 10), true /* open for modification */);
+ } catch (CVSException e1) {
+ // If the connection cannot be opened, just exit normally.
+ // The notifications will be sent when a connection can be made
+ return;
}
+ Command.NOOP.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ Command.NO_LOCAL_OPTIONS,
+ cvsResources,
+ null,
+ Policy.subMonitorFor(monitor1, 90));
+ } catch (CVSException e3) {
+ exception[0] = e3;
+ } finally {
+ session.close();
+ monitor1.done();
}
}
};
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
index 8a26bca41..e9a6ebee8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
@@ -303,38 +303,36 @@ public abstract class Command extends Request {
final LocalOption[] localOptions, final String[] arguments, final ICommandOutputListener listener,
IProgressMonitor pm) throws CVSException {
final IStatus[] status = new IStatus[1];
- ICVSRunnable job = new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- // update the global and local options
- GlobalOption[] gOptions = filterGlobalOptions(session, globalOptions);
- LocalOption[] lOptions = filterLocalOptions(session, gOptions, localOptions);
-
- // print the invocation string to the console
- if (session.isOutputToConsole() || Policy.isDebugProtocol()) {
- IPath commandRootPath;
- IResource resource = session.getLocalRoot().getIResource();
- if (resource == null) {
- commandRootPath = Path.EMPTY;
- } else {
- commandRootPath = resource.getFullPath();
- }
- String line = constructCommandInvocationString(commandRootPath, gOptions, lOptions, arguments);
- ConsoleListeners.getInstance().commandInvoked(session, line);
- if (Policy.isDebugProtocol()) Policy.printProtocolLine("CMD> " + line); //$NON-NLS-1$
- }
-
- // run the command
- try {
- session.setCurrentCommand(Command.this);
- status[0] = doExecute(session, gOptions, lOptions, arguments, listener, monitor);
- notifyConsoleOnCompletion(session, status[0], null);
- } catch (CVSException e) {
- notifyConsoleOnCompletion(session, null, e);
- throw e;
- } catch (RuntimeException e) {
- notifyConsoleOnCompletion(session, null, e);
- throw e;
+ ICVSRunnable job = monitor -> {
+ // update the global and local options
+ GlobalOption[] gOptions = filterGlobalOptions(session, globalOptions);
+ LocalOption[] lOptions = filterLocalOptions(session, gOptions, localOptions);
+
+ // print the invocation string to the console
+ if (session.isOutputToConsole() || Policy.isDebugProtocol()) {
+ IPath commandRootPath;
+ IResource resource = session.getLocalRoot().getIResource();
+ if (resource == null) {
+ commandRootPath = Path.EMPTY;
+ } else {
+ commandRootPath = resource.getFullPath();
}
+ String line = constructCommandInvocationString(commandRootPath, gOptions, lOptions, arguments);
+ ConsoleListeners.getInstance().commandInvoked(session, line);
+ if (Policy.isDebugProtocol()) Policy.printProtocolLine("CMD> " + line); //$NON-NLS-1$
+ }
+
+ // run the command
+ try {
+ session.setCurrentCommand(Command.this);
+ status[0] = doExecute(session, gOptions, lOptions, arguments, listener, monitor);
+ notifyConsoleOnCompletion(session, status[0], null);
+ } catch (CVSException e1) {
+ notifyConsoleOnCompletion(session, null, e1);
+ throw e1;
+ } catch (RuntimeException e2) {
+ notifyConsoleOnCompletion(session, null, e2);
+ throw e2;
}
};
if (isWorkspaceModification()) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
index 984eb27cd..c25f311e0 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
@@ -348,49 +348,47 @@ public class EclipseFile extends EclipseResource implements ICVSFile {
*/
public void edit(final int notifications, boolean notifyForWritable, IProgressMonitor monitor) throws CVSException {
if (!notifyForWritable && !isReadOnly()) return;
- run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- byte[] syncBytes = getSyncBytes();
- if (syncBytes == null || ResourceSyncInfo.isAddition(syncBytes)) return;
-
- // convert the notifications to internal form
- char[] internalFormat;
- if (notifications == NO_NOTIFICATION) {
- internalFormat = null;
- } else if (notifications == NOTIFY_ON_ALL) {
- internalFormat = NotifyInfo.ALL;
- } else {
- List notificationCharacters = new ArrayList();
- if ((notifications & NOTIFY_ON_EDIT) >0)
- notificationCharacters.add(Character.valueOf(NotifyInfo.EDIT));
- if ((notifications & NOTIFY_ON_UNEDIT) >0)
- notificationCharacters.add(Character.valueOf(NotifyInfo.UNEDIT));
- if ((notifications & NOTIFY_ON_COMMIT) >0)
- notificationCharacters.add(Character.valueOf(NotifyInfo.COMMIT));
- internalFormat = new char[notificationCharacters.size()];
- for (int i = 0; i < internalFormat.length; i++) {
- internalFormat[i] = ((Character)notificationCharacters.get(i)).charValue();
- }
- }
-
- // record the notification
- NotifyInfo notifyInfo = new NotifyInfo(getName(), NotifyInfo.EDIT, new Date(), internalFormat);
- setNotifyInfo(notifyInfo);
-
- // Only record the base if the file is not modified
- if (!isModified(null)) {
- EclipseSynchronizer.getInstance().copyFileToBaseDirectory(getIFile(), monitor);
- setBaserevInfo(new BaserevInfo(getName(), ResourceSyncInfo.getRevision(syncBytes)));
+ run(monitor1 -> {
+ byte[] syncBytes = getSyncBytes();
+ if (syncBytes == null || ResourceSyncInfo.isAddition(syncBytes)) return;
+
+ // convert the notifications to internal form
+ char[] internalFormat;
+ if (notifications == NO_NOTIFICATION) {
+ internalFormat = null;
+ } else if (notifications == NOTIFY_ON_ALL) {
+ internalFormat = NotifyInfo.ALL;
+ } else {
+ List notificationCharacters = new ArrayList();
+ if ((notifications & NOTIFY_ON_EDIT) >0)
+ notificationCharacters.add(Character.valueOf(NotifyInfo.EDIT));
+ if ((notifications & NOTIFY_ON_UNEDIT) >0)
+ notificationCharacters.add(Character.valueOf(NotifyInfo.UNEDIT));
+ if ((notifications & NOTIFY_ON_COMMIT) >0)
+ notificationCharacters.add(Character.valueOf(NotifyInfo.COMMIT));
+ internalFormat = new char[notificationCharacters.size()];
+ for (int i = 0; i < internalFormat.length; i++) {
+ internalFormat[i] = ((Character)notificationCharacters.get(i)).charValue();
}
-
- try {
- // allow editing
- setReadOnly(false);
- } catch (CVSException e) {
- // Just log and keep going
- CVSProviderPlugin.log(e);
- }
}
+
+ // record the notification
+ NotifyInfo notifyInfo = new NotifyInfo(getName(), NotifyInfo.EDIT, new Date(), internalFormat);
+ setNotifyInfo(notifyInfo);
+
+ // Only record the base if the file is not modified
+ if (!isModified(null)) {
+ EclipseSynchronizer.getInstance().copyFileToBaseDirectory(getIFile(), monitor1);
+ setBaserevInfo(new BaserevInfo(getName(), ResourceSyncInfo.getRevision(syncBytes)));
+ }
+
+ try {
+ // allow editing
+ setReadOnly(false);
+ } catch (CVSException e) {
+ // Just log and keep going
+ CVSProviderPlugin.log(e);
+ }
}, monitor);
}
@@ -400,46 +398,44 @@ public class EclipseFile extends EclipseResource implements ICVSFile {
*/
public void unedit(IProgressMonitor monitor) throws CVSException {
if (isReadOnly()) return;
- run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- // record the notification
- NotifyInfo info = getNotifyInfo();
- if (info != null && info.getNotificationType() == NotifyInfo.EDIT) {
- info = null;
- } else {
- info = new NotifyInfo(getName(), NotifyInfo.UNEDIT, new Date(), null);
- }
- setNotifyInfo(info);
-
- if (isModified(null)) {
- ResourceSyncInfo syncInfo = getSyncInfo();
- BaserevInfo baserevInfo = getBaserevInfo();
- EclipseSynchronizer.getInstance().restoreFileFromBaseDirectory(getIFile(), monitor);
- // reset any changes that may have been merged from the server
- if (!syncInfo.getRevision().equals(baserevInfo.getRevision())) {
- MutableResourceSyncInfo newInfo = syncInfo.cloneMutable();
- newInfo.setRevision(baserevInfo.getRevision());
- newInfo.setTimeStamp(getTimeStamp());
- newInfo.setDeleted(false);
- setSyncInfo(newInfo, ICVSFile.CLEAN);
- } else {
- // an unedited file is no longer modified
- EclipseSynchronizer.getInstance().setModified(EclipseFile.this, CLEAN);
- }
+ run(monitor1 -> {
+ // record the notification
+ NotifyInfo info = getNotifyInfo();
+ if (info != null && info.getNotificationType() == NotifyInfo.EDIT) {
+ info = null;
+ } else {
+ info = new NotifyInfo(getName(), NotifyInfo.UNEDIT, new Date(), null);
+ }
+ setNotifyInfo(info);
+
+ if (isModified(null)) {
+ ResourceSyncInfo syncInfo = getSyncInfo();
+ BaserevInfo baserevInfo = getBaserevInfo();
+ EclipseSynchronizer.getInstance().restoreFileFromBaseDirectory(getIFile(), monitor1);
+ // reset any changes that may have been merged from the server
+ if (!syncInfo.getRevision().equals(baserevInfo.getRevision())) {
+ MutableResourceSyncInfo newInfo = syncInfo.cloneMutable();
+ newInfo.setRevision(baserevInfo.getRevision());
+ newInfo.setTimeStamp(getTimeStamp());
+ newInfo.setDeleted(false);
+ setSyncInfo(newInfo, ICVSFile.CLEAN);
} else {
- // We still need to report a state change
- setSyncBytes(getSyncBytes(), ICVSFile.CLEAN);
+ // an unedited file is no longer modified
+ EclipseSynchronizer.getInstance().setModified(EclipseFile.this, CLEAN);
}
- setBaserevInfo(null);
-
- try {
- // prevent editing
- setReadOnly(true);
- } catch (CVSException e) {
- // Just log and keep going
- CVSProviderPlugin.log(e);
- }
+ } else {
+ // We still need to report a state change
+ setSyncBytes(getSyncBytes(), ICVSFile.CLEAN);
}
+ setBaserevInfo(null);
+
+ try {
+ // prevent editing
+ setReadOnly(true);
+ } catch (CVSException e) {
+ // Just log and keep going
+ CVSProviderPlugin.log(e);
+ }
}, monitor);
}
@@ -546,11 +542,9 @@ public class EclipseFile extends EclipseResource implements ICVSFile {
* @see org.eclipse.team.internal.ccvs.core.ICVSResource#unmanage(org.eclipse.core.runtime.IProgressMonitor)
*/
public void unmanage(IProgressMonitor monitor) throws CVSException {
- run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- EclipseFile.super.unmanage(monitor);
- clearCachedBase();
- }
+ run(monitor1 -> {
+ EclipseFile.super.unmanage(monitor1);
+ clearCachedBase();
}, monitor);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
index 18eea02e8..c044d0031 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
@@ -214,19 +214,17 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
public void setFolderSyncInfo(final FolderSyncInfo folderInfo) throws CVSException {
// ignore folder sync on the root (i.e. CVSROOT/config/TopLevelAdmin=yes but we just ignore it)
if (resource.getType() == IResource.ROOT) return;
- run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- EclipseSynchronizer synchronizer = EclipseSynchronizer.getInstance();
- synchronizer.setFolderSync((IContainer)resource, folderInfo);
- // the server won't add directories as sync info, therefore it must be done when
- // a directory is shared with the repository.
- byte[] newSyncBytes = new ResourceSyncInfo(getName()).getBytes();
- byte[] oldSyncBytes = getSyncBytes();
- // only set the bytes if the new differes from the old.
- // this avoids unnecessary saving of sync files
- if (oldSyncBytes == null || ! Util.equals(newSyncBytes, oldSyncBytes))
- setSyncBytes(newSyncBytes);
- }
+ run((ICVSRunnable) monitor -> {
+ EclipseSynchronizer synchronizer = EclipseSynchronizer.getInstance();
+ synchronizer.setFolderSync((IContainer)resource, folderInfo);
+ // the server won't add directories as sync info, therefore it must be done when
+ // a directory is shared with the repository.
+ byte[] newSyncBytes = new ResourceSyncInfo(getName()).getBytes();
+ byte[] oldSyncBytes = getSyncBytes();
+ // only set the bytes if the new differes from the old.
+ // this avoids unnecessary saving of sync files
+ if (oldSyncBytes == null || ! Util.equals(newSyncBytes, oldSyncBytes))
+ setSyncBytes(newSyncBytes);
}, null);
}
@@ -242,14 +240,12 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
* @see ICVSResource#unmanage()
*/
public void unmanage(IProgressMonitor monitor) throws CVSException {
- run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- recursiveUnmanage((IContainer) resource, Policy.subMonitorFor(monitor, 99));
- EclipseFolder.super.unmanage(Policy.subMonitorFor(monitor, 1));
- monitor.done();
- }
+ run((ICVSRunnable) monitor1 -> {
+ monitor1 = Policy.monitorFor(monitor1);
+ monitor1.beginTask(null, 100);
+ recursiveUnmanage((IContainer) resource, Policy.subMonitorFor(monitor1, 99));
+ EclipseFolder.super.unmanage(Policy.subMonitorFor(monitor1, 1));
+ monitor1.done();
}, Policy.subMonitorFor(monitor, 99));
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
index 8e3bab9db..e2cd4e056 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java
@@ -138,11 +138,7 @@ abstract class EclipseResource implements ICVSResource, Comparable {
* @see ICVSResource#setIgnoredAs(String)
*/
public void setIgnoredAs(final String pattern) throws CVSException {
- run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- EclipseSynchronizer.getInstance().addIgnored(resource.getParent(), pattern);
- }
- }, null);
+ run(monitor -> EclipseSynchronizer.getInstance().addIgnored(resource.getParent(), pattern), null);
}
/*
@@ -259,13 +255,11 @@ abstract class EclipseResource implements ICVSResource, Comparable {
try {
// Do not use a scheduling rule in the workspace run since one
// will be obtained by the EclipseSynchronizer
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- EclipseSynchronizer.getInstance().run(getIResource(), job, monitor);
- } catch(CVSException e) {
- error[0] = e;
- }
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor1 -> {
+ try {
+ EclipseSynchronizer.getInstance().run(getIResource(), job, monitor1);
+ } catch(CVSException e) {
+ error[0] = e;
}
}, null /* no rule */, 0, monitor);
} catch(CoreException e) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
index d07687d75..15a690fb8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
@@ -515,12 +515,10 @@ public class EclipseSynchronizer implements IFlushOperation {
public void flush(final ThreadInfo info, IProgressMonitor monitor) throws CVSException {
if (info != null && !info.isEmpty()) {
try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor pm) throws CoreException {
- IStatus status = commitCache(info, pm);
- if (!status.isOK()) {
- throw new CVSException(status);
- }
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) pm -> {
+ IStatus status = commitCache(info, pm);
+ if (!status.isOK()) {
+ throw new CVSException(status);
}
}, null, 0 /* no flags */, monitor);
} catch (CoreException e) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java
index 85c12957c..915200cf6 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/BuildCleanupListener.java
@@ -24,15 +24,9 @@ import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
-import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
@@ -141,13 +135,11 @@ public class BuildCleanupListener implements IResourceDeltaVisitor, IResourceCha
if(provider!=null) {
// Traverse the delta is a runnable so that files are only written at the end
- folder.run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- delta.accept(BuildCleanupListener.this);
- } catch (CoreException e) {
- Util.logError(CVSMessages.ResourceDeltaVisitor_visitError, e);
- }
+ folder.run(monitor -> {
+ try {
+ delta.accept(BuildCleanupListener.this);
+ } catch (CoreException e) {
+ Util.logError(CVSMessages.ResourceDeltaVisitor_visitError, e);
}
}, Policy.monitorFor(null));
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
index b34f74e76..b4d856bb5 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/MoveDeleteHook.java
@@ -57,15 +57,13 @@ public class MoveDeleteHook implements IMoveDeleteHook {
}
// Otherwise, we need to prepare properly for the delete
- EclipseSynchronizer.getInstance().performMoveDelete(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- monitor.beginTask(null, 100);
- EclipseSynchronizer.getInstance().prepareForDeletion(file, Policy.subMonitorFor(monitor, 40));
- tree.standardDeleteFile(file, updateFlags, Policy.subMonitorFor(monitor, 60));
- } finally {
- monitor.done();
- }
+ EclipseSynchronizer.getInstance().performMoveDelete(monitor1 -> {
+ try {
+ monitor1.beginTask(null, 100);
+ EclipseSynchronizer.getInstance().prepareForDeletion(file, Policy.subMonitorFor(monitor1, 40));
+ tree.standardDeleteFile(file, updateFlags, Policy.subMonitorFor(monitor1, 60));
+ } finally {
+ monitor1.done();
}
}, Policy.subMonitorFor(monitor, 70));
} catch (CVSException e) {
@@ -91,15 +89,13 @@ public class MoveDeleteHook implements IMoveDeleteHook {
try {
final ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
if (cvsFolder.isCVSFolder() && ensureCheckedOut(new IFolder[] {folder}, tree, Policy.subMonitorFor(monitor, 30))) {
- EclipseSynchronizer.getInstance().performMoveDelete(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- monitor.beginTask(null, 100);
- EclipseSynchronizer.getInstance().prepareForDeletion(folder, Policy.subMonitorFor(monitor, 20));
- tree.standardDeleteFolder(folder, updateFlags, Policy.subMonitorFor(monitor, 50));
- } finally {
- monitor.done();
- }
+ EclipseSynchronizer.getInstance().performMoveDelete(monitor1 -> {
+ try {
+ monitor1.beginTask(null, 100);
+ EclipseSynchronizer.getInstance().prepareForDeletion(folder, Policy.subMonitorFor(monitor1, 20));
+ tree.standardDeleteFolder(folder, updateFlags, Policy.subMonitorFor(monitor1, 50));
+ } finally {
+ monitor1.done();
}
}, Policy.subMonitorFor(monitor, 70));
return true;
@@ -162,19 +158,17 @@ public class MoveDeleteHook implements IMoveDeleteHook {
}
// Perform the move
- EclipseSynchronizer.getInstance().performMoveDelete(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- monitor.beginTask(null, 100);
- EclipseSynchronizer.getInstance().prepareForDeletion(source, Policy.subMonitorFor(monitor, 40));
- if (destination.exists()) {
- EclipseSynchronizer.getInstance().prepareForDeletion(destination, Policy.subMonitorFor(monitor, 20));
- }
- tree.standardMoveFile(source, destination, updateFlags, Policy.subMonitorFor(monitor, 40));
- EclipseSynchronizer.getInstance().postMove(destination);
- } finally {
- monitor.done();
+ EclipseSynchronizer.getInstance().performMoveDelete(monitor1 -> {
+ try {
+ monitor1.beginTask(null, 100);
+ EclipseSynchronizer.getInstance().prepareForDeletion(source, Policy.subMonitorFor(monitor1, 40));
+ if (destination.exists()) {
+ EclipseSynchronizer.getInstance().prepareForDeletion(destination, Policy.subMonitorFor(monitor1, 20));
}
+ tree.standardMoveFile(source, destination, updateFlags, Policy.subMonitorFor(monitor1, 40));
+ EclipseSynchronizer.getInstance().postMove(destination);
+ } finally {
+ monitor1.done();
}
}, Policy.subMonitorFor(monitor, 70));
} catch (CVSException e) {
@@ -213,14 +207,12 @@ public class MoveDeleteHook implements IMoveDeleteHook {
private void purgeCVSFolders(IFolder destination, final IProgressMonitor monitor) throws CVSException {
// Delete any CVS folders
try {
- destination.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FOLDER && resource.getName().equals(SyncFileWriter.CVS_DIRNAME)) {
- tree.standardDeleteFolder((IFolder)resource, updateFlags, monitor);
- return false;
- }
- return true;
+ destination.accept((IResourceVisitor) resource -> {
+ if (resource.getType() == IResource.FOLDER && resource.getName().equals(SyncFileWriter.CVS_DIRNAME)) {
+ tree.standardDeleteFolder((IFolder)resource, updateFlags, monitor);
+ return false;
}
+ return true;
}, IResource.DEPTH_INFINITE, IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS);
} catch (CoreException e) {
throw CVSException.wrapException(e);
@@ -293,16 +285,14 @@ public class MoveDeleteHook implements IMoveDeleteHook {
for (int i = 0; i < folders.length; i++) {
IFolder folder = folders[i];
if (folder.exists()) {
- folder.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) {
- IFile file = (IFile) resource;
- if (file.isReadOnly()) {
- readOnlyFiles.add(file);
- }
+ folder.accept(resource -> {
+ if (resource.getType() == IResource.FILE) {
+ IFile file = (IFile) resource;
+ if (file.isReadOnly()) {
+ readOnlyFiles.add(file);
}
- return true;
}
+ return true;
});
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
index 794c5ccf9..44dafbb02 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
@@ -172,18 +172,16 @@ public class PrepareForReplaceVisitor implements ICVSResourceVisitor {
public void visitResources(IProject project, final ICVSResource[] resources, final String oneArgMessage, int depth, IProgressMonitor pm) throws CVSException {
this.depth = depth;
deletedFiles = new HashSet();
- CVSWorkspaceRoot.getCVSFolderFor(project).run(new ICVSRunnable() {
- public void run(IProgressMonitor pm) throws CVSException {
- monitor = Policy.infiniteSubMonitorFor(pm, 100);
- monitor.beginTask(null, 512);
- for (int i = 0; i < resources.length; i++) {
- if (oneArgMessage != null) {
- monitor.subTask(NLS.bind(oneArgMessage, new String[] { resources[i].getIResource().getFullPath().toString() }));
- }
- resources[i].accept(PrepareForReplaceVisitor.this);
+ CVSWorkspaceRoot.getCVSFolderFor(project).run(pm1 -> {
+ monitor = Policy.infiniteSubMonitorFor(pm1, 100);
+ monitor.beginTask(null, 512);
+ for (int i = 0; i < resources.length; i++) {
+ if (oneArgMessage != null) {
+ monitor.subTask(NLS.bind(oneArgMessage, new String[] { resources[i].getIResource().getFullPath().toString() }));
}
- monitor.done();
+ resources[i].accept(PrepareForReplaceVisitor.this);
}
+ monitor.done();
}, pm);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResponsiveSocketFactory.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResponsiveSocketFactory.java
index 143f9b822..c5f4a169d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResponsiveSocketFactory.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResponsiveSocketFactory.java
@@ -60,8 +60,7 @@ public class ResponsiveSocketFactory {
// Start a thread to open a socket
final Socket[] socket = new Socket[] { null };
final Exception[] exception = new Exception[] {null };
- final Thread thread = new Thread(new Runnable() {
- public void run() {
+ final Thread thread = new Thread(() -> {
try {
Socket newSocket = internalCreateSocket(host, port);
synchronized (socket) {
@@ -72,13 +71,12 @@ public class ResponsiveSocketFactory {
socket[0] = newSocket;
}
}
- } catch (UnknownHostException e) {
- exception[0] = e;
- } catch (IOException e) {
- exception[0] = e;
+ } catch (UnknownHostException e1) {
+ exception[0] = e1;
+ } catch (IOException e2) {
+ exception[0] = e2;
}
- }
- });
+ });
thread.start();
// Wait the appropriate number of seconds
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
index 8dce51455..ac943f1fb 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
@@ -451,22 +451,20 @@ public class SyncFileWriter {
// important to have both the folder creation and setting of team-private in the
// same runnable so that the team-private flag is set before other delta listeners
// sees the CVS folder creation.
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // Re-check existence in case this method was called without a resource rule
- if (! cvsSubDir.exists()) {
- if (existsInFileSystem(cvsSubDir)) {
- cvsSubDir.refreshLocal(IResource.DEPTH_INFINITE, null);
- cvsSubDir.setTeamPrivateMember(true);
- } else {
- cvsSubDir.create(IResource.TEAM_PRIVATE, true /*make local*/, null);
- }
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor -> {
+ // Re-check existence in case this method was called without a resource rule
+ if (! cvsSubDir.exists()) {
+ if (existsInFileSystem(cvsSubDir)) {
+ cvsSubDir.refreshLocal(IResource.DEPTH_INFINITE, null);
+ cvsSubDir.setTeamPrivateMember(true);
} else {
- if (!cvsSubDir.isTeamPrivateMember()) {
- cvsSubDir.setTeamPrivateMember(true);
- }
+ cvsSubDir.create(IResource.TEAM_PRIVATE, true /*make local*/, null);
}
- }
+ } else {
+ if (!cvsSubDir.isTeamPrivateMember()) {
+ cvsSubDir.setTeamPrivateMember(true);
+ }
+ }
}, folder, 0, null);
}
return cvsSubDir;
@@ -595,20 +593,18 @@ public class SyncFileWriter {
// to include the MODSTAMP value. If not in a runnable then create/setContents
// will trigger a delta and the SyncFileWriter change listener won't know that the delta
// was a result of our own creation.
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- writeLinesToStreamAndClose(os, contents);
- if(!file.exists()) {
- file.create(new ByteArrayInputStream(os.toByteArray()), IResource.FORCE /*don't keep history but do force*/, null);
- } else {
- file.setContents(new ByteArrayInputStream(os.toByteArray()), IResource.FORCE /*don't keep history but do force*/, null);
- }
- file.setSessionProperty(MODSTAMP_KEY, Long.valueOf(file.getModificationStamp()));
- } catch(CVSException e) {
- throw new CoreException(e.getStatus());
- }
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor -> {
+ try {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ writeLinesToStreamAndClose(os, contents);
+ if(!file.exists()) {
+ file.create(new ByteArrayInputStream(os.toByteArray()), IResource.FORCE /*don't keep history but do force*/, null);
+ } else {
+ file.setContents(new ByteArrayInputStream(os.toByteArray()), IResource.FORCE /*don't keep history but do force*/, null);
+ }
+ file.setSessionProperty(MODSTAMP_KEY, Long.valueOf(file.getModificationStamp()));
+ } catch(CVSException e) {
+ throw new CoreException(e.getStatus());
}
}, ResourcesPlugin.getWorkspace().getRuleFactory().createRule(file), 0, null);
} catch (CoreException e) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
index 5dc1eb41d..a51dc805d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
@@ -180,21 +180,19 @@ public class Util {
// Start a thread to execute the command and get a handle to the process
final Process[] process = new Process[] { null };
final Exception[] exception = new Exception[] {null };
- final Thread thread = new Thread(new Runnable() {
- public void run() {
- try {
- Process newProcess = Runtime.getRuntime().exec(command);
- synchronized (process) {
- if (Thread.interrupted()) {
- // we we're either cancelled or timed out so just destroy the process
- newProcess.destroy();
- } else {
- process[0] = newProcess;
- }
+ final Thread thread = new Thread(() -> {
+ try {
+ Process newProcess = Runtime.getRuntime().exec(command);
+ synchronized (process) {
+ if (Thread.interrupted()) {
+ // we we're either cancelled or timed out so just destroy the process
+ newProcess.destroy();
+ } else {
+ process[0] = newProcess;
}
- } catch (IOException e) {
- exception[0] = e;
}
+ } catch (IOException e) {
+ exception[0] = e;
}
});
thread.start();
diff --git a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs
index d5241ad51..94a599ab6 100644
--- a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -3,7 +3,7 @@ editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;org;com;
org.eclipse.jdt.ui.ondemandthreshold=3
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n *\n * This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License 2.0\r\n * which accompanies this distribution, and is available at\r\n * https://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier: EPL-2.0\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} IBM Corporation and others.\r\n *\n * This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License 2.0\r\n * which accompanies this distribution, and is available at\r\n * https\://www.eclipse.org/legal/epl-2.0/\n *\n * SPDX-License-Identifier\: EPL-2.0\r\n *\r\n * Contributors\:\r\n * IBM Corporation - initial API and implementation\r\n *******************************************************************************/\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
@@ -20,8 +20,8 @@ sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=true
sp_cleanup.make_parameters_final=false
@@ -38,6 +38,8 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=false
+sp_cleanup.remove_redundant_semicolons=false
sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=false
sp_cleanup.remove_trailing_whitespaces_all=true
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java
index 6085da9c1..bd7b0d6f6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFolderPropertiesPage.java
@@ -17,10 +17,9 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -44,6 +43,7 @@ public class CVSFolderPropertiesPage extends CVSPropertiesPage {
/**
* @see PreferencePage#createContents(Composite)
*/
+ @Override
protected Control createContents(Composite parent) {
initialize();
noDefaultAndApplyButton();
@@ -97,14 +97,12 @@ public class CVSFolderPropertiesPage extends CVSPropertiesPage {
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
data.widthHint = Math.max(widthHint, disconnect.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
disconnect.setLayoutData(data);
- disconnect.addListener(SWT.Selection, new Listener() {
- public void handleEvent (Event event) {
- // perform a disconnect
- if (disconnectFolder()) {
- root.setText(CVSUIMessages.CVSFilePropertiesPage_none);
- repository.setText(CVSUIMessages.CVSFilePropertiesPage_none);
- disconnect.setEnabled(false);
- }
+ disconnect.addListener(SWT.Selection, event -> {
+ // perform a disconnect
+ if (disconnectFolder()) {
+ root.setText(CVSUIMessages.CVSFilePropertiesPage_none);
+ repository.setText(CVSUIMessages.CVSFilePropertiesPage_none);
+ disconnect.setEnabled(false);
}
});
}
@@ -138,13 +136,11 @@ public class CVSFolderPropertiesPage extends CVSPropertiesPage {
if (MessageDialog.openQuestion(getShell(), CVSUIMessages.CVSFolderPropertiesPage_disconnectTitle, CVSUIMessages.CVSFolderPropertiesPage_disconnectQuestion)) { //
final ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
try {
- PlatformUI.getWorkbench().getProgressService().run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- cvsFolder.unmanage(null);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, false, monitor -> {
+ try {
+ cvsFolder.unmanage(null);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
index 27ee4572f..326dd447e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
@@ -88,16 +88,14 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
* @param colors color ids to cache
*/
private void ensureFontAndColorsCreated(final String[] fonts, final String[] colors) {
- CVSUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
- for (int i = 0; i < colors.length; i++) {
- theme.getColorRegistry().get(colors[i]);
-
- }
- for (int i = 0; i < fonts.length; i++) {
- theme.getFontRegistry().get(fonts[i]);
- }
+ CVSUIPlugin.getStandardDisplay().syncExec(() -> {
+ ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
+ for (int i1 = 0; i1 < colors.length; i1++) {
+ theme.getColorRegistry().get(colors[i1]);
+
+ }
+ for (int i2 = 0; i2 < fonts.length; i2++) {
+ theme.getFontRegistry().get(fonts[i2]);
}
});
}
@@ -136,6 +134,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
*
* @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
*/
+ @Override
public void decorate(Object element, IDecoration decoration) {
// Don't decorate the workspace root
@@ -487,11 +486,9 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
public void refresh(IProject project) {
final List resources = new ArrayList();
try {
- project.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) {
- resources.add(resource);
- return true;
- }
+ project.accept(resource -> {
+ resources.add(resource);
+ return true;
});
postLabelEvent(new LabelProviderChangedEvent(this, resources.toArray()));
} catch (CoreException e) {
@@ -502,6 +499,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#resourceSyncInfoChanged(org.eclipse.core.resources.IResource[])
*/
+ @Override
public void resourceSyncInfoChanged(IResource[] changedResources) {
resourceStateChanged(changedResources);
}
@@ -509,6 +507,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#externalSyncInfoChange(org.eclipse.core.resources.IResource[])
*/
+ @Override
public void externalSyncInfoChange(IResource[] changedResources) {
resourceStateChanged(changedResources);
}
@@ -516,6 +515,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#resourceModificationStateChanged(org.eclipse.core.resources.IResource[])
*/
+ @Override
public void resourceModified(IResource[] changedResources) {
resourceStateChanged(changedResources);
}
@@ -547,12 +547,14 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
/**
* @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#projectConfigured(org.eclipse.core.resources.IProject)
*/
+ @Override
public void projectConfigured(IProject project) {
refresh(project);
}
/**
* @see org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener#projectDeconfigured(org.eclipse.core.resources.IProject)
*/
+ @Override
public void projectDeconfigured(IProject project) {
refresh(project);
}
@@ -563,16 +565,13 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
* @param events the events to post
*/
private void postLabelEvent(final LabelProviderChangedEvent event) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- fireLabelProviderChanged(event);
- }
- });
+ Display.getDefault().asyncExec(() -> fireLabelProviderChanged(event));
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
*/
+ @Override
public void dispose() {
super.dispose();
PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().removePropertyChangeListener(this);
@@ -615,6 +614,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
/* (non-Javadoc)
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
+ @Override
public void propertyChange(PropertyChangeEvent event) {
if (isEventOfInterest(event)) {
ensureFontAndColorsCreated(fonts, colors);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
index 32d6a91f0..90b5be933 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
@@ -14,9 +14,7 @@
package org.eclipse.team.internal.ccvs.ui;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
+import java.util.*;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -26,15 +24,8 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.IProjectSetSerializer;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.core.*;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
@@ -50,6 +41,7 @@ public class CVSProjectSetSerializer implements IProjectSetSerializer {
*
* "1.0,repoLocation,module,projectName[,tag]"
*/
+ @Override
public String[] asReference(IProject[] providerProjects, Object context, IProgressMonitor monitor) throws TeamException {
String[] result = new String[providerProjects.length];
for (int i = 0; i < providerProjects.length; i++) {
@@ -89,6 +81,7 @@ public class CVSProjectSetSerializer implements IProjectSetSerializer {
/**
* @see IProjectSetSerializer#addToWorkspace(String[])
*/
+ @Override
public IProject[] addToWorkspace(String[] referenceStrings, String filename, Object context, IProgressMonitor monitor) throws TeamException {
final int size = referenceStrings.length;
final IProject[] projects = new IProject[size];
@@ -152,6 +145,7 @@ public class CVSProjectSetSerializer implements IProjectSetSerializer {
}
}
WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ @Override
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
monitor.beginTask("", 1000 * num[0]); //$NON-NLS-1$
try {
@@ -213,11 +207,7 @@ public class CVSProjectSetSerializer implements IProjectSetSerializer {
IDialogConstants.CANCEL_LABEL},
0);
final int[] result = new int[1];
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }
- });
+ shell.getDisplay().syncExec(() -> result[0] = dialog.open());
return result[0];
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index 9d94bd3cc..b4ff98f41 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -206,21 +206,20 @@ public class CVSUIPlugin extends AbstractUIPlugin {
private static boolean promptToRefresh(final Shell shell, final IResource[] resources, final IStatus status) {
final boolean[] result = new boolean[] { false};
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- Shell shellToUse = shell;
- if (shell == null) {
- shellToUse = new Shell(Display.getCurrent());
- }
- String question;
- if (resources.length == 1) {
- question = NLS.bind(CVSUIMessages.CVSUIPlugin_refreshQuestion, new String[] { status.getMessage(), resources[0].getFullPath().toString() });
- } else {
- question = NLS.bind(CVSUIMessages.CVSUIPlugin_refreshMultipleQuestion, new String[] { status.getMessage() });
- }
- result[0] = MessageDialog.openQuestion(shellToUse, CVSUIMessages.CVSUIPlugin_refreshTitle, question);
+ Runnable runnable = () -> {
+ Shell shellToUse = shell;
+ if (shell == null) {
+ shellToUse = new Shell(Display.getCurrent());
}
+ String question;
+ if (resources.length == 1) {
+ question = NLS.bind(CVSUIMessages.CVSUIPlugin_refreshQuestion,
+ new String[] { status.getMessage(), resources[0].getFullPath().toString() });
+ } else {
+ question = NLS.bind(CVSUIMessages.CVSUIPlugin_refreshMultipleQuestion,
+ new String[] { status.getMessage() });
+ }
+ result[0] = MessageDialog.openQuestion(shellToUse, CVSUIMessages.CVSUIPlugin_refreshTitle, question);
};
Display.getDefault().syncExec(runnable);
return result[0];
@@ -487,16 +486,11 @@ public class CVSUIPlugin extends AbstractUIPlugin {
private static IStatus openDialog(Shell providedShell, final String title,
final String message, final IStatus status, int flags) {
// Create a runnable that will display the error status
- final IOpenableInShell openable = new IOpenableInShell() {
- @Override
- public void open(Shell shell) {
- if (status.getSeverity() == IStatus.INFO
- && !status.isMultiStatus()) {
- MessageDialog.openInformation(shell,
- CVSUIMessages.information, status.getMessage());
- } else {
- ErrorDialog.openError(shell, title, message, status);
- }
+ final IOpenableInShell openable = shell -> {
+ if (status.getSeverity() == IStatus.INFO && !status.isMultiStatus()) {
+ MessageDialog.openInformation(shell, CVSUIMessages.information, status.getMessage());
+ } else {
+ ErrorDialog.openError(shell, title, message, status);
}
};
openDialog(providedShell, openable, flags);
@@ -535,20 +529,17 @@ public class CVSUIPlugin extends AbstractUIPlugin {
// Create a runnable that will display the error status
final Shell shell = providedShell;
- Runnable outerRunnable = new Runnable() {
- @Override
- public void run() {
- Shell displayShell;
- if (shell == null) {
- Display display = Display.getCurrent();
- displayShell = new Shell(display);
- } else {
- displayShell = shell;
- }
- openable.open(displayShell);
- if (shell == null) {
- displayShell.dispose();
- }
+ Runnable outerRunnable = () -> {
+ Shell displayShell;
+ if (shell == null) {
+ Display display = Display.getCurrent();
+ displayShell = new Shell(display);
+ } else {
+ displayShell = shell;
+ }
+ openable.open(displayShell);
+ if (shell == null) {
+ displayShell.dispose();
}
};
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
index 9955e99e9..aa484435a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java
@@ -48,7 +48,8 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.CVSCoreFileModificationValidator#edit(org.eclipse.core.resources.IFile[], org.eclipse.core.resources.team.FileModificationValidationContext)
*/
- protected IStatus edit(IFile[] readOnlyFiles, FileModificationValidationContext context) {
+ @Override
+ protected IStatus edit(IFile[] readOnlyFiles, FileModificationValidationContext context) {
return edit(readOnlyFiles, getShell(context));
}
@@ -84,11 +85,7 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
// The user wants to update the file
// Run the update in a runnable in order to get a busy cursor.
// This runnable is syncExeced in order to get a busy cursor
- IRunnableWithProgress updateRunnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- performUpdate(files, monitor);
- }
- };
+ IRunnableWithProgress updateRunnable = monitor -> performUpdate(files, monitor);
if (isRunningInUIThread()) {
// Only show a busy cursor if validate edit is blocking the UI
CVSUIPlugin.runWithProgress(shell, false, updateRunnable);
@@ -103,15 +100,13 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
// Run the edit in a runnable in order to get a busy cursor.
// This runnable is syncExeced in order to get a busy cursor
- IRunnableWithProgress editRunnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- performEdit(files, monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
+ IRunnableWithProgress editRunnable = monitor -> {
+ try {
+ performEdit(files, monitor);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
+ }
+ };
if (isRunningInUIThread()) {
// Only show a busy cursor if validate edit is blocking the UI
CVSUIPlugin.runWithProgress(shell, false, editRunnable);
@@ -142,7 +137,8 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
}
- protected void scheduleEditJob(Job job) {
+ @Override
+ protected void scheduleEditJob(Job job) {
job.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
job.setProperty(IProgressConstants.ICON_PROPERTY, getOperationIcon());
super.scheduleEditJob(job);
@@ -196,11 +192,11 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
// were called from the UI thread
final boolean[] result = new boolean[] { false };
int flags = isRunningInUIThread() ? 0 : CVSUIPlugin.PERFORM_SYNC_EXEC;
- CVSUIPlugin.openDialog(shell, new CVSUIPlugin.IOpenableInShell() {
- public void open(Shell shell) {
- result[0] = MessageDialog.openQuestion(shell,CVSUIMessages.FileModificationValidator_3,CVSUIMessages.FileModificationValidator_4); //
- }
- }, flags);
+ CVSUIPlugin
+ .openDialog(shell,
+ shell1 -> result[0] = MessageDialog.openQuestion(shell1,
+ CVSUIMessages.FileModificationValidator_3, CVSUIMessages.FileModificationValidator_4),
+ flags);
return result[0];
}
@@ -209,11 +205,11 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
// were called from the UI thread
final boolean[] result = new boolean[] { false };
int flags = isRunningInUIThread() ? 0 : CVSUIPlugin.PERFORM_SYNC_EXEC;
- CVSUIPlugin.openDialog(shell, new CVSUIPlugin.IOpenableInShell() {
- public void open(Shell shell) {
- result[0] = MessageDialog.openQuestion(shell,CVSUIMessages.FileModificationValidator_5,CVSUIMessages.FileModificationValidator_6);
- }
- }, flags);
+ CVSUIPlugin
+ .openDialog(shell,
+ shell1 -> result[0] = MessageDialog.openQuestion(shell1,
+ CVSUIMessages.FileModificationValidator_5, CVSUIMessages.FileModificationValidator_6),
+ flags);
return result[0];
}
@@ -227,11 +223,7 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
private EditorsAction fetchEditors(IFile[] files, Shell shell) throws InvocationTargetException, InterruptedException {
final EditorsAction editors = new EditorsAction(getProvider(files), files);
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- editors.run(monitor);
- }
- };
+ IRunnableWithProgress runnable = monitor -> editors.run(monitor);
if (isRunningInUIThread()) {
// Show a busy cursor if we are running in the UI thread
CVSUIPlugin.runWithProgress(shell, false, runnable);
@@ -285,7 +277,8 @@ public class FileModificationValidator extends CVSCoreFileModificationValidator
return ICVSUIConstants.PREF_UPDATE_PROMPT_NEVER.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_PROMPT));
}
- public ISchedulingRule validateEditRule(CVSResourceRuleFactory factory, IResource[] resources) {
+ @Override
+ public ISchedulingRule validateEditRule(CVSResourceRuleFactory factory, IResource[] resources) {
if (!isNeverUpdate()) {
// We may need to perform an update so we need to obtain the lock on each project
Set projects = new HashSet();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
index 9cc95d4f7..2e743c1b9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java
@@ -19,9 +19,9 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.*;
import org.eclipse.compare.structuremergeviewer.IStructureComparator;
+import org.eclipse.core.internal.dtree.IComparator;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.graphics.Image;
import org.eclipse.team.core.TeamException;
@@ -54,6 +54,7 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
* The content is not considered.
* @see IComparator#equals
*/
+ @Override
public boolean equals(Object other) {
if (other instanceof ITypedElement) {
String otherName = ((ITypedElement)other).getName();
@@ -65,22 +66,21 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
/**
* Enumerate children of this node (if any).
*/
+ @Override
public Object[] getChildren() {
if (children == null) {
children = new ResourceEditionNode[0];
if (resource != null) {
try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSRemoteResource[] members = resource.members(monitor);
- children = new ResourceEditionNode[members.length];
- for (int i = 0; i < members.length; i++) {
- children[i] = new ResourceEditionNode(members[i]);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
+ CVSUIPlugin.runWithProgress(null, true /* cancelable */, monitor -> {
+ try {
+ ICVSRemoteResource[] members = resource.members(monitor);
+ children = new ResourceEditionNode[members.length];
+ for (int i = 0; i < members.length; i++) {
+ children[i] = new ResourceEditionNode(members[i]);
}
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InterruptedException e) {
@@ -99,6 +99,7 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
/**
* @see IStreamContentAccessor#getContents()
*/
+ @Override
public InputStream getContents() throws CoreException {
IStorage storage = getStorage();
if (storage != null) {
@@ -107,6 +108,7 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
return new ByteArrayInputStream(new byte[0]);
}
+ @Override
public Image getImage() {
return CompareUI.getImage(resource);
}
@@ -114,6 +116,7 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
/**
* Returns the name of this node.
*/
+ @Override
public String getName() {
return resource == null ? "" : resource.getName(); //$NON-NLS-1$
}
@@ -125,6 +128,7 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
/**
* Returns the comparison type for this node.
*/
+ @Override
public String getType() {
if (resource == null) {
return UNKNOWN_TYPE;
@@ -140,6 +144,7 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
/**
* @see IComparator#equals
*/
+ @Override
public int hashCode() {
return getName().hashCode();
}
@@ -147,6 +152,7 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
/* (non-Javadoc)
* @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset()
*/
+ @Override
public String getCharset() throws CoreException {
// Use the local file encoding if there is one
IResource local = resource.getIResource();
@@ -170,13 +176,11 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
}
final IStorage[] holder = new IStorage[1];
try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- holder[0] = ((IResourceVariant)resource).getStorage(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
+ CVSUIPlugin.runWithProgress(null, true /* cancelable */, monitor -> {
+ try {
+ holder[0] = ((IResourceVariant) resource).getStorage(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {
@@ -187,16 +191,19 @@ public class ResourceEditionNode implements IStructureComparator, ITypedElement,
return holder[0];
}
+ @Override
public <T> T getAdapter(Class<T> adapter) {
if (adapter == ISharedDocumentAdapter.class) {
synchronized (this) {
if (sharedDocumentAdapter == null)
sharedDocumentAdapter = new SharedDocumentAdapter() {
+ @Override
public IEditorInput getDocumentKey(Object element) {
return ResourceEditionNode.this
.getDocumentKey(element);
}
+ @Override
public void flushDocument(IDocumentProvider provider,
IEditorInput documentKey, IDocument document,
boolean overwrite) throws CoreException {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
index 78cec911a..7d5066821 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java
@@ -17,7 +17,8 @@ package org.eclipse.team.internal.ccvs.ui;
import java.util.Map;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
@@ -58,6 +59,7 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
/**
* @see IUserAuthenticator#authenticateUser
*/
+ @Override
public void promptForUserInfo(final ICVSRepositoryLocation location, final IUserInfo userinfo, final String message) throws CVSException {
if (!userinfo.isUsernameMutable() && USE_ALTERNATE_PROMPTER) {
alternatePromptForUserInfo(userinfo);
@@ -72,13 +74,12 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
} else {
// sync exec in default thread
final CVSException[] exception = new CVSException[] { null };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- try {
- allowCaching[0] = promptForPassword(location, userinfo.getUsername(), message, userinfo.isUsernameMutable(), result);
- } catch (CVSException e) {
- exception[0] = e;
- }
+ Display.getDefault().syncExec(() -> {
+ try {
+ allowCaching[0] = promptForPassword(location, userinfo.getUsername(), message,
+ userinfo.isUsernameMutable(), result);
+ } catch (CVSException e) {
+ exception[0] = e;
}
});
if (exception[0] != null) {
@@ -166,6 +167,7 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
* @param echo '*' should be used or not
* @param result the entered values, or null if user canceled.
*/
+ @Override
public String[] promptForKeyboradInteractive(final ICVSRepositoryLocation location,
final String destination,
final String name,
@@ -180,11 +182,8 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
}
else {
// sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- result[0]=_promptForUserInteractive(location, destination, name, instruction, prompt, echo, allowCaching);
- }
- });
+ Display.getDefault().syncExec(() -> result[0] = _promptForUserInteractive(location, destination, name,
+ instruction, prompt, echo, allowCaching));
}
if (result[0] != null && location != null &&
KeyboardInteractiveDialog.isPasswordAuth(prompt)) {
@@ -265,11 +264,7 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
result[0] = alternatePromptForPassword(userinfo.getUsername());
} else {
// sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- result[0] = alternatePromptForPassword(userinfo.getUsername());
- }
- });
+ Display.getDefault().syncExec(() -> result[0] = alternatePromptForPassword(userinfo.getUsername()));
}
if (result[0] == null) {
@@ -282,6 +277,7 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.IUserAuthenticator#prompt(org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation, int, java.lang.String, java.lang.String, int[], int)
*/
+ @Override
public int prompt(final ICVSRepositoryLocation location, final int promptType, final String title, final String message, final int[] promptResponses, final int defaultResponse) {
final Display display = CVSUIPlugin.getStandardDisplay();
final int[] retval = new int[1];
@@ -296,31 +292,22 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
}
}
- display.syncExec(new Runnable() {
- public void run() {
- final MessageDialog dialog = new MessageDialog(
- new Shell(display),
- title,
- null /* title image */,
- NLS.bind(CVSUIMessages.WorkbenchUserAuthenticator_0, message, location.getLocation(true)),
- promptType,
- buttons,
- 1
- );
- retval[0] = dialog.open();
- }
+ display.syncExec(() -> {
+ final MessageDialog dialog = new MessageDialog(new Shell(display), title, null /* title image */,
+ NLS.bind(CVSUIMessages.WorkbenchUserAuthenticator_0, message, location.getLocation(true)),
+ promptType, buttons, 1);
+ retval[0] = dialog.open();
});
return retval[0];
}
- public boolean promptForHostKeyChange(final ICVSRepositoryLocation location) {
+ @Override
+ public boolean promptForHostKeyChange(final ICVSRepositoryLocation location) {
final boolean[] openConfirm = new boolean[] { false };
final Display display = CVSUIPlugin.getStandardDisplay();
- display.syncExec(new Runnable() {
- public void run() {
- openConfirm[0] = MessageDialog.openConfirm(null, CVSUIMessages.WorkbenchUserAuthenticator_1, NLS.bind(CVSUIMessages.WorkbenchUserAuthenticator_2, new String[] { location.getHost() })); //
- }
- });
+ display.syncExec(
+ () -> openConfirm[0] = MessageDialog.openConfirm(null, CVSUIMessages.WorkbenchUserAuthenticator_1,
+ NLS.bind(CVSUIMessages.WorkbenchUserAuthenticator_2, new String[] { location.getHost() })));
if (!openConfirm[0]) {
throw new OperationCanceledException();
}
@@ -332,6 +319,7 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
*
* @see org.eclipse.team.internal.ccvs.core.IUserAuthenticator#promptToConfigureRepositoryLocations(java.util.Map)
*/
+ @Override
public Map promptToConfigureRepositoryLocations(final Map alternativeMap) {
final Map[] result = new Map[1];
Display display = Display.getCurrent();
@@ -339,11 +327,7 @@ public class WorkbenchUserAuthenticator implements IUserAuthenticator {
result[0] = openAlternativeRepositoryDialog(alternativeMap);
} else {
// sync exec in default thread
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- result[0] = openAlternativeRepositoryDialog(alternativeMap);
- }
- });
+ Display.getDefault().syncExec(() -> result[0] = openAlternativeRepositoryDialog(alternativeMap));
}
return result[0];
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index b223725e6..7b0ec93b5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -16,17 +16,16 @@ package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
-import org.eclipse.core.commands.*;
+import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.custom.BusyIndicator;
@@ -41,7 +40,7 @@ import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter;
-import org.eclipse.team.internal.ui.*;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
import org.eclipse.ui.*;
@@ -74,32 +73,30 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
// Don't need to specify a the title because it will use this actions
// title instead.
retargetAction = new RetargetAction(getId(), ""); //$NON-NLS-1$
- retargetAction.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IAction.ENABLED)) {
- Object val = event.getNewValue();
- if (val instanceof Boolean && action != null) {
- action.setEnabled(((Boolean) val).booleanValue());
- }
- } else if (event.getProperty().equals(IAction.CHECKED)) {
- Object val = event.getNewValue();
- if (val instanceof Boolean && action != null) {
- action.setChecked(((Boolean) val).booleanValue());
- }
- } else if (event.getProperty().equals(IAction.TEXT)) {
- Object val = event.getNewValue();
- if (val instanceof String && action != null) {
- action.setText((String) val);
- }
- } else if (event.getProperty().equals(IAction.TOOL_TIP_TEXT)) {
- Object val = event.getNewValue();
- if (val instanceof String && action != null) {
- action.setToolTipText((String) val);
- }
- } else if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS)) {
- if(action != null && retargetAction != null) {
- action.setEnabled(retargetAction.isEnabled());
- }
+ retargetAction.addPropertyChangeListener(event -> {
+ if (event.getProperty().equals(IAction.ENABLED)) {
+ Object val1 = event.getNewValue();
+ if (val1 instanceof Boolean && action != null) {
+ action.setEnabled(((Boolean) val1).booleanValue());
+ }
+ } else if (event.getProperty().equals(IAction.CHECKED)) {
+ Object val2 = event.getNewValue();
+ if (val2 instanceof Boolean && action != null) {
+ action.setChecked(((Boolean) val2).booleanValue());
+ }
+ } else if (event.getProperty().equals(IAction.TEXT)) {
+ Object val3 = event.getNewValue();
+ if (val3 instanceof String && action != null) {
+ action.setText((String) val3);
+ }
+ } else if (event.getProperty().equals(IAction.TOOL_TIP_TEXT)) {
+ Object val4 = event.getNewValue();
+ if (val4 instanceof String && action != null) {
+ action.setToolTipText((String) val4);
+ }
+ } else if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS)) {
+ if (action != null && retargetAction != null) {
+ action.setEnabled(retargetAction.isEnabled());
}
}
});
@@ -112,6 +109,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
/**
* Common run method for all CVS actions.
*/
+ @Override
final public void run(IAction action) {
try {
if (!beginExecution(action)) return;
@@ -150,11 +148,13 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
* Called when this action is added to a top-level menu or toolbar (e.g. IWorkbenchWindowDelegate)
* @since 3.1
*/
+ @Override
public void init(IWorkbenchWindow window) {
super.init(window);
initializeRetargetAction(window);
}
+ @Override
public boolean isEnabled() {
if(retargetAction != null && retargetAction.getActionHandler() != null) {
return retargetAction.isEnabled();
@@ -163,6 +163,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
return false;
}
+ @Override
public void dispose() {
super.dispose();
IWorkbenchWindow window = getWindow();
@@ -178,6 +179,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
}
}
+ @Override
public void selectionChanged(final IAction action, ISelection selection) {
if (selection instanceof TextSelection) {
// Since we have a text selection, we will assume that the target is the active editor.
@@ -202,6 +204,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
this.action = action;
}
+ @Override
protected void setActionEnablement(IAction action) {
if(retargetAction != null && retargetAction.getActionHandler() != null) {
action.setEnabled(retargetAction.isEnabled());
@@ -308,6 +311,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
* @param status any status accumulated by the action before the end of
* the action or the exception occurred.
*/
+ @Override
protected void handle(Exception exception) {
// Get the non-OK status
List problems = new ArrayList();
@@ -362,23 +366,17 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
final Exception[] exceptions = new Exception[] {null};
// Ensure that no repository view refresh happens until after the action
- final IRunnableWithProgress innerRunnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- getRepositoryManager().run(runnable, monitor);
- }
- };
+ final IRunnableWithProgress innerRunnable = monitor -> getRepositoryManager().run(runnable, monitor);
switch (progressKind) {
case PROGRESS_BUSYCURSOR :
- BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
- public void run() {
- try {
- innerRunnable.run(new NullProgressMonitor());
- } catch (InvocationTargetException e) {
- exceptions[0] = e;
- } catch (InterruptedException e) {
- exceptions[0] = e;
- }
+ BusyIndicator.showWhile(Display.getCurrent(), () -> {
+ try {
+ innerRunnable.run(new NullProgressMonitor());
+ } catch (InvocationTargetException e1) {
+ exceptions[0] = e1;
+ } catch (InterruptedException e2) {
+ exceptions[0] = e2;
}
});
break;
@@ -513,9 +511,11 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
public static IPromptCondition getOverwriteLocalChangesPrompt(final IResource[] dirtyResources) {
return new IPromptCondition() {
List resources = Arrays.asList(dirtyResources);
+ @Override
public boolean needsPrompt(IResource resource) {
return resources.contains(resource);
}
+ @Override
public String promptMessage(IResource resource) {
return NLS.bind(CVSUIMessages.ReplaceWithAction_localChanges, new String[] { resource.getName() });
}
@@ -543,15 +543,13 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
// prompt if the tags are not equal
// consider BASE to be equal the parent tag since we don't make BASE sticky on replace
if (!CVSTag.equalTags(tag, parentTag) && !CVSTag.equalTags(tag, CVSTag.BASE)) {
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(shell,
- CVSUIMessages.CVSAction_mixingTagsTitle,
- NLS.bind(CVSUIMessages.CVSAction_mixingTags, new String[] { tag.getName() }),
- CVSUIMessages.CVSAction_doNotShowThisAgain, false,
- store, ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS);
- result[0] = dialog.getReturnCode() == 0;
- }
+ shell.getDisplay().syncExec(() -> {
+ MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(shell,
+ CVSUIMessages.CVSAction_mixingTagsTitle,
+ NLS.bind(CVSUIMessages.CVSAction_mixingTags, new String[] { tag.getName() }),
+ CVSUIMessages.CVSAction_doNotShowThisAgain, false, store,
+ ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS);
+ result[0] = dialog.getReturnCode() == 0;
});
// only prompt once
break;
@@ -572,13 +570,11 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
final int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
final boolean[] okToContinue = new boolean[] {true};
if (option != ICVSUIConstants.OPTION_NEVER) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- boolean confirm = option == ICVSUIConstants.OPTION_PROMPT;
- IResource[] selectedResources = getSelectedResources();
- if (selectedResources != null) {
- okToContinue[0] = IDE.saveAllEditors(selectedResources, confirm);
- }
+ Display.getDefault().syncExec(() -> {
+ boolean confirm = option == ICVSUIConstants.OPTION_PROMPT;
+ IResource[] selectedResources = getSelectedResources();
+ if (selectedResources != null) {
+ okToContinue[0] = IDE.saveAllEditors(selectedResources, confirm);
}
});
}
@@ -587,6 +583,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
/**
* @see org.eclipse.team.internal.ui.actions.TeamAction#handle(java.lang.Exception, java.lang.String, java.lang.String)
*/
+ @Override
protected void handle(Exception exception, String title, String message) {
CVSUIPlugin.openError(getShell(), title, message, exception, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS);
}
@@ -610,6 +607,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.TeamAction#getSelectedResources()
*/
+ @Override
protected final IResource[] getSelectedResources() {
IStructuredSelection selection = getSelection();
CVSActionSelectionProperties props = CVSActionSelectionProperties.getProperties(getSelection());
@@ -622,6 +620,7 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
*/
+ @Override
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
}
@@ -631,14 +630,17 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
* @param handlerListener
* @since 3.1
*/
+ @Override
public void removeHandlerListener(IHandlerListener handlerListener) {
}
+ @Override
public void addHandlerListener(IHandlerListener handlerListener) {
}
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#isHandled()
*/
+ @Override
public boolean isHandled() {
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
index 8d063e5df..acdf26374 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
@@ -17,7 +17,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
@@ -45,6 +44,7 @@ public class CommitAction extends WorkspaceTraversalAction {
includeChangeSets = isIncludeChangeSets(getShell(), CVSUIMessages.CommitAction_2);
}
+ @Override
protected ResourceTraversal[] adjustInputTraversals(ResourceTraversal[] traversals) {
if (includeChangeSets)
return ((CVSActiveChangeSetCollector)CVSUIPlugin.getPlugin().getChangeSetManager()).adjustInputTraversals(traversals);
@@ -55,36 +55,32 @@ public class CommitAction extends WorkspaceTraversalAction {
/*
* @see CVSAction#execute(IAction)
*/
+ @Override
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
final ResourceTraversal[][] traversals = new ResourceTraversal[][] { null };
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(CVSUIMessages.CommitAction_0, 100);
- traversals[0] = getTraversals(Policy.subMonitorFor(monitor, 80));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- CommitWizard.run(getTargetPart(), getShell(), traversals[0]);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, false, PROGRESS_BUSYCURSOR);
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ monitor.beginTask(CVSUIMessages.CommitAction_0, 100);
+ traversals[0] = getTraversals(Policy.subMonitorFor(monitor, 80));
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ });
+ run((IRunnableWithProgress) monitor -> {
+ try {
+ CommitWizard.run(getTargetPart(), getShell(), traversals[0]);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ }, false, PROGRESS_BUSYCURSOR);
}
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.CommitAction_commitFailed;
}
@@ -92,6 +88,7 @@ public class CommitAction extends WorkspaceTraversalAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
*/
+ @Override
protected boolean isEnabledForUnmanagedResources() {
return true;
}
@@ -99,6 +96,7 @@ public class CommitAction extends WorkspaceTraversalAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
*/
+ @Override
protected boolean isEnabledForNonExistantResources() {
return true;
}
@@ -106,10 +104,12 @@ public class CommitAction extends WorkspaceTraversalAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
*/
+ @Override
public String getId() {
return ICVSUIConstants.CMD_COMMIT;
}
+ @Override
protected SynchronizationScopeManager getScopeManager() {
return new CommitScopeManager(getCVSResourceMappings(), getResourceMappingContext(), true);
}
@@ -127,19 +127,12 @@ public class CommitAction extends WorkspaceTraversalAction {
// Ask the user whether to switch
final int[] result = new int[] { 0 };
- Utils.syncExec(new Runnable() {
- public void run() {
- final MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(
- shell,
- CVSUIMessages.CommitAction_1,
- message,
- CVSUIMessages.ShowAnnotationOperation_4,
- false /* toggle state */,
- store,
- ICVSUIConstants.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT);
-
- result[0] = m.getReturnCode();
- }
+ Utils.syncExec((Runnable) () -> {
+ final MessageDialogWithToggle m = MessageDialogWithToggle.openYesNoQuestion(shell,
+ CVSUIMessages.CommitAction_1, message, CVSUIMessages.ShowAnnotationOperation_4,
+ false /* toggle state */, store, ICVSUIConstants.PREF_INCLUDE_CHANGE_SETS_IN_COMMIT);
+
+ result[0] = m.getReturnCode();
}, shell);
switch (result[0]) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java
index 294f0c421..0a160d5ef 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteWithTagAction.java
@@ -15,7 +15,6 @@ package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.internal.ccvs.core.*;
@@ -31,6 +30,7 @@ public class CompareRemoteWithTagAction extends CVSAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
*/
+ @Override
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
final ICVSRemoteResource[] resources = getSelectedRemoteResources();
@@ -39,15 +39,11 @@ public class CompareRemoteWithTagAction extends CVSAction {
// Obtain the tag to compare against
final ICVSRemoteResource resource = resources[0];
final CVSTag[] tag = new CVSTag[] { null};
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- tag[0] = TagSelectionDialog.getTagToCompareWith(getShell(), TagSource.create(resources),
- TagSelectionDialog.INCLUDE_BRANCHES |
- TagSelectionDialog.INCLUDE_VERSIONS |
- TagSelectionDialog.INCLUDE_DATES |
- TagSelectionDialog.INCLUDE_HEAD_TAG);
- }
- }, false /* cancelable */, PROGRESS_BUSYCURSOR);
+ run((IRunnableWithProgress) monitor -> tag[0] = TagSelectionDialog.getTagToCompareWith(getShell(),
+ TagSource.create(resources),
+ TagSelectionDialog.INCLUDE_BRANCHES | TagSelectionDialog.INCLUDE_VERSIONS
+ | TagSelectionDialog.INCLUDE_DATES | TagSelectionDialog.INCLUDE_HEAD_TAG),
+ false /* cancelable */, PROGRESS_BUSYCURSOR);
if (tag[0] == null) return;
// Run the compare operation in the background
@@ -62,6 +58,7 @@ public class CompareRemoteWithTagAction extends CVSAction {
/**
* @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
ICVSRemoteResource[] resources = getSelectedRemoteResources();
// Only support single select for now.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
index 0dcce6704..6b9dd3339 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
@@ -44,19 +44,17 @@ public class CompareWithRevisionAction extends WorkspaceAction {
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
// Show the compare viewer
- run(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- if (isShowInDialog()) {
- IFile file = (IFile) getSelectedResources()[0];
- showCompareInDialog(getShell(), file);
- } else {
- IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), getSelectedResources()[0], null);
- IHistoryPage page = view.getHistoryPage();
- if (page instanceof CVSHistoryPage){
- CVSHistoryPage cvsHistoryPage = (CVSHistoryPage) page;
- cvsHistoryPage.setClickAction(true);
- }
+ run((IRunnableWithProgress) monitor -> {
+ if (isShowInDialog()) {
+ IFile file = (IFile) getSelectedResources()[0];
+ showCompareInDialog(getShell(), file);
+ } else {
+ IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), getSelectedResources()[0],
+ null);
+ IHistoryPage page = view.getHistoryPage();
+ if (page instanceof CVSHistoryPage) {
+ CVSHistoryPage cvsHistoryPage = (CVSHistoryPage) page;
+ cvsHistoryPage.setClickAction(true);
}
}
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java
index 7d2a985cb..50ada4aad 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoViewOnFolder.java
@@ -17,7 +17,6 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Iterator;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -38,6 +37,7 @@ public class ConfigureTagsFromRepoViewOnFolder extends CVSAction {
/**
* Returns the selected remote folders
*/
+ @Override
protected ICVSRemoteFolder[] getSelectedRemoteFolders() {
ArrayList resources = null;
IStructuredSelection selection = getSelection();
@@ -63,34 +63,33 @@ public class ConfigureTagsFromRepoViewOnFolder extends CVSAction {
/*
* @see CVSAction@execute(IAction)
*/
+ @Override
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ICVSRemoteFolder[] roots = getSelectedRemoteFolders();
- final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- ICVSFolder[] cvsFolders = new ICVSFolder[roots.length];
- for (int i = 0; i < roots.length; i++) {
- cvsFolders[i] = roots[i];
- }
- TagConfigurationDialog d = new TagConfigurationDialog(shell, TagSource.create(cvsFolders));
- d.open();
- }
- });
- }
+ run((IRunnableWithProgress) monitor -> {
+ final ICVSRemoteFolder[] roots = getSelectedRemoteFolders();
+ final Shell shell = getShell();
+ shell.getDisplay().syncExec(() -> {
+ ICVSFolder[] cvsFolders = new ICVSFolder[roots.length];
+ for (int i = 0; i < roots.length; i++) {
+ cvsFolders[i] = roots[i];
+ }
+ TagConfigurationDialog d = new TagConfigurationDialog(shell, TagSource.create(cvsFolders));
+ d.open();
+ });
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
/*
* @see TeamAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
return true;
}
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.ConfigureTagsFromRepoViewConfigure_Tag_Error_1;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java
index d922f7c00..f697745d2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/EditAction.java
@@ -15,11 +15,7 @@ package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.core.Team;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -30,37 +26,38 @@ public class EditAction extends WorkspaceAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
*/
+ @Override
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
// Get the editors
final EditorsAction editors = new EditorsAction();
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- executeProviderAction(editors, Policy.subMonitorFor(monitor, 25));
-
- // If there are editors show them and prompt the user to execute the edit command
- if (!editors.promptToEdit(getShell())) {
- return;
- }
-
- executeProviderAction(new IProviderAction() {
- public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException {
- provider.edit(resources, false /* recurse */, true /* notify server */, false /* notifyForWritable*/, ICVSFile.NO_NOTIFICATION, monitor);
- return Team.OK_STATUS;
- }
- }, Policy.subMonitorFor(monitor, 75));
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ executeProviderAction(editors, Policy.subMonitorFor(monitor, 25));
+
+ // If there are editors show them and prompt the user to execute the edit
+ // command
+ if (!editors.promptToEdit(getShell())) {
+ return;
}
+
+ executeProviderAction((provider, resources, monitor1) -> {
+ provider.edit(resources, false /* recurse */, true /* notify server */, false /* notifyForWritable */,
+ ICVSFile.NO_NOTIFICATION, monitor1);
+ return Team.OK_STATUS;
+ }, Policy.subMonitorFor(monitor, 75));
});
}
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
*/
+ @Override
protected boolean isEnabledForAddedResources() {
return false;
}
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
*/
+ @Override
protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
if (cvsResource.isFolder()) return false;
if (super.isEnabledForCVSResource(cvsResource)) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
index 0748f2e5a..e2072517e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
@@ -14,16 +14,14 @@
package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.core.subscribers.SubscriberResourceMappingContext;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
@@ -42,17 +40,16 @@ public class GenerateDiffFileAction extends WorkspaceTraversalAction{
/** (Non-javadoc)
* Method declared on IActionDelegate.
*/
+ @Override
public void execute(IAction action) {
try {
final IResource [][] resources = new IResource[][] { null };
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- resources[0] = getDeepResourcesToPatch(monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ resources[0] = getDeepResourcesToPatch(monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
GenerateDiffFileWizard.run(getTargetPart(), resources[0]);
@@ -106,6 +103,7 @@ public class GenerateDiffFileAction extends WorkspaceTraversalAction{
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
*/
+ @Override
protected boolean isEnabledForMultipleResources() {
return true;
}
@@ -113,6 +111,7 @@ public class GenerateDiffFileAction extends WorkspaceTraversalAction{
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
*/
+ @Override
protected boolean isEnabledForUnmanagedResources() {
return true;
}
@@ -121,6 +120,7 @@ public class GenerateDiffFileAction extends WorkspaceTraversalAction{
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
*/
+ @Override
public String getId() {
return ICVSUIConstants.CMD_CREATEPATCH;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
index f37b05ad7..8beb68d8b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/IgnoreAction.java
@@ -48,14 +48,16 @@ public class IgnoreAction extends WorkspaceTraversalAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
*/
- protected String getTaskName(CVSTeamProvider provider) {
+ @Override
+ protected String getTaskName(CVSTeamProvider provider) {
return NLS.bind(CVSUIMessages.IgnoreAction_0, new String[] { provider.getProject().getName() });
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
*/
- protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
+ @Override
+ protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
try {
monitor.beginTask(null, resources.length);
for (int i = 0; i < resources.length; i++) {
@@ -77,34 +79,37 @@ public class IgnoreAction extends WorkspaceTraversalAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
*/
- protected String getTaskName() {
+ @Override
+ protected String getTaskName() {
return CVSUIMessages.IgnoreAction_1;
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#consultModelsForMappings()
*/
- public boolean consultModelsForMappings() {
+ @Override
+ public boolean consultModelsForMappings() {
return false;
}
}
+ @Override
protected void execute(final IAction action) throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- IResource[] resources = getSelectedResources();
- IgnoreResourcesDialog dialog = new IgnoreResourcesDialog(getShell(), resources);
- if (dialog.open() != Window.OK) return;
- new IgnoreOperation(getTargetPart(), resources, dialog).run();
-
- //if (action != null) action.setEnabled(isEnabled());
- }
+ run((IRunnableWithProgress) monitor -> {
+ IResource[] resources = getSelectedResources();
+ IgnoreResourcesDialog dialog = new IgnoreResourcesDialog(getShell(), resources);
+ if (dialog.open() != Window.OK)
+ return;
+ new IgnoreOperation(getTargetPart(), resources, dialog).run();
+
+ // if (action != null) action.setEnabled(isEnabled());
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.IgnoreAction_ignore;
}
@@ -112,6 +117,7 @@ public class IgnoreAction extends WorkspaceTraversalAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForManagedResources()
*/
+ @Override
protected boolean isEnabledForManagedResources() {
return false;
}
@@ -119,6 +125,7 @@ public class IgnoreAction extends WorkspaceTraversalAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForUnmanagedResources()
*/
+ @Override
protected boolean isEnabledForUnmanagedResources() {
return true;
}
@@ -126,6 +133,7 @@ public class IgnoreAction extends WorkspaceTraversalAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
*/
+ @Override
protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
if (super.isEnabledForCVSResource(cvsResource)) {
// Perform an extra check against the subscriber to ensure there is no conflict
@@ -146,6 +154,7 @@ public class IgnoreAction extends WorkspaceTraversalAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
*/
+ @Override
public String getId() {
return ICVSUIConstants.CMD_IGNORE;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
index c0d3974af..c0004f162 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
@@ -25,20 +25,21 @@ public class MergeAction extends WorkspaceTraversalAction {
/*
* @see CVSAction#execute()
*/
+ @Override
public void execute(IAction action) {
final Shell shell = getShell();
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MergeWizard wizard = new MergeWizard(getTargetPart(), getSelectedResources(), getSelectedResourceMappings(CVSProviderPlugin.getTypeId()));
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
+ shell.getDisplay().syncExec(() -> {
+ MergeWizard wizard = new MergeWizard(getTargetPart(), getSelectedResources(),
+ getSelectedResourceMappings(CVSProviderPlugin.getTypeId()));
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.open();
});
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
*/
+ @Override
public String getId() {
return ICVSUIConstants.CMD_MERGE;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java
index cce0831cb..0205a977b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenLogEntryAction.java
@@ -18,7 +18,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -64,17 +63,17 @@ public class OpenLogEntryAction extends CVSAction {
/*
* @see CVSAction#execute(IAction)
*/
+ @Override
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ILogEntry[] entries = getSelectedLogEntries();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].isDeletion()) {
- MessageDialog.openError(getShell(), CVSUIMessages.OpenLogEntryAction_deletedTitle, CVSUIMessages.OpenLogEntryAction_deleted); //
- } else {
- ICVSRemoteFile file = entries[i].getRemoteFile();
- CVSUIPlugin.getPlugin().openEditor(file, monitor);
- }
+ run((IRunnableWithProgress) monitor -> {
+ final ILogEntry[] entries = getSelectedLogEntries();
+ for (int i = 0; i < entries.length; i++) {
+ if (entries[i].isDeletion()) {
+ MessageDialog.openError(getShell(), CVSUIMessages.OpenLogEntryAction_deletedTitle,
+ CVSUIMessages.OpenLogEntryAction_deleted); //
+ } else {
+ ICVSRemoteFile file = entries[i].getRemoteFile();
+ CVSUIPlugin.getPlugin().openEditor(file, monitor);
}
}
}, false, PROGRESS_BUSYCURSOR);
@@ -82,6 +81,7 @@ public class OpenLogEntryAction extends CVSAction {
/*
* @see TeamAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
ILogEntry[] entries = getSelectedLogEntries();
if (entries.length == 0) return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java
index bf3b6fdf0..248ede37a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java
@@ -18,7 +18,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -66,20 +65,20 @@ public class OpenRemoteFileAction extends CVSAction {
/*
* @see CVSAction#execute(IAction)
*/
+ @Override
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- ICVSRemoteFile[] files = getSelectedRemoteFiles();
- for (int i = 0; i < files.length; i++) {
- ICVSRemoteFile file = files[i];
- CVSUIPlugin.getPlugin().openEditor(file, monitor);
- }
+ run((IRunnableWithProgress) monitor -> {
+ ICVSRemoteFile[] files = getSelectedRemoteFiles();
+ for (int i = 0; i < files.length; i++) {
+ ICVSRemoteFile file = files[i];
+ CVSUIPlugin.getPlugin().openEditor(file, monitor);
}
}, false, PROGRESS_BUSYCURSOR);
}
/*
* @see TeamAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
ICVSRemoteFile[] resources = getSelectedRemoteFiles();
if (resources.length == 0) return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
index 1028b38ef..b47d425d6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
@@ -24,21 +24,19 @@ import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
public class ReplaceWithRemoteAction extends WorkspaceTraversalAction {
+ @Override
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
final ReplaceOperation replaceOperation = new ReplaceOperation(getTargetPart(), getCVSResourceMappings(), resourceCommonTag);
if (hasOutgoingChanges(replaceOperation)) {
final boolean[] keepGoing = new boolean[] { true };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), replaceOperation.getScopeManager(),
- CVSUIMessages.ReplaceWithTagAction_2,
- CVSUIMessages.ReplaceWithTagAction_0,
- CVSUIMessages.ReplaceWithTagAction_1);
- dialog.setHelpContextId(IHelpContextIds.REPLACE_OUTGOING_CHANGES_DIALOG);
- int result = dialog.open();
- keepGoing[0] = result == Window.OK;
- }
+ Display.getDefault().syncExec(() -> {
+ OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), replaceOperation.getScopeManager(),
+ CVSUIMessages.ReplaceWithTagAction_2, CVSUIMessages.ReplaceWithTagAction_0,
+ CVSUIMessages.ReplaceWithTagAction_1);
+ dialog.setHelpContextId(IHelpContextIds.REPLACE_OUTGOING_CHANGES_DIALOG);
+ int result = dialog.open();
+ keepGoing[0] = result == Window.OK;
});
if (!keepGoing[0])
return;
@@ -49,6 +47,7 @@ public class ReplaceWithRemoteAction extends WorkspaceTraversalAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.ReplaceWithRemoteAction_problemMessage;
}
@@ -56,6 +55,7 @@ public class ReplaceWithRemoteAction extends WorkspaceTraversalAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
*/
+ @Override
protected boolean isEnabledForAddedResources() {
return false;
}
@@ -63,6 +63,7 @@ public class ReplaceWithRemoteAction extends WorkspaceTraversalAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
*/
+ @Override
protected boolean isEnabledForNonExistantResources() {
return true;
}
@@ -73,6 +74,7 @@ public class ReplaceWithRemoteAction extends WorkspaceTraversalAction {
*
* @see TeamAction#setActionEnablement(org.eclipse.jface.action.IAction)
*/
+ @Override
protected void setActionEnablement(IAction action) {
super.setActionEnablement(action);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
index 9efdc31d7..540cfc05b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
@@ -16,7 +16,6 @@ package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.window.Window;
@@ -33,20 +32,18 @@ public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction {
/*
* Method declared on IActionDelegate.
*/
+ @Override
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
final ReplaceOperation replaceOperation= createReplaceOperation();
if (hasOutgoingChanges(replaceOperation)) {
final boolean[] keepGoing = new boolean[] { true };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), replaceOperation.getScopeManager(),
- CVSUIMessages.ReplaceWithTagAction_2,
- CVSUIMessages.ReplaceWithTagAction_0,
- CVSUIMessages.ReplaceWithTagAction_1);
- dialog.setHelpContextId(IHelpContextIds.REPLACE_OUTGOING_CHANGES_DIALOG);
- int result = dialog.open();
- keepGoing[0] = result == Window.OK;
- }
+ Display.getDefault().syncExec(() -> {
+ OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), replaceOperation.getScopeManager(),
+ CVSUIMessages.ReplaceWithTagAction_2, CVSUIMessages.ReplaceWithTagAction_0,
+ CVSUIMessages.ReplaceWithTagAction_1);
+ dialog.setHelpContextId(IHelpContextIds.REPLACE_OUTGOING_CHANGES_DIALOG);
+ int result = dialog.open();
+ keepGoing[0] = result == Window.OK;
});
if (!keepGoing[0])
return;
@@ -56,25 +53,24 @@ public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction {
final CVSTag[] tag= new CVSTag[] { null };
// Show a busy cursor while display the tag selection dialog
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- monitor= Policy.monitorFor(monitor);
- tag[0] = getTag(replaceOperation);
-
- // finish, when tag can't be obtained
- if (tag[0] == null)
+ run((IRunnableWithProgress) monitor -> {
+ monitor = Policy.monitorFor(monitor);
+ tag[0] = getTag(replaceOperation);
+
+ // finish, when tag can't be obtained
+ if (tag[0] == null)
+ return;
+
+ // For non-projects determine if the tag being loaded is the same as the
+ // resource's parent
+ // If it's not, warn the user that they will have strange sync behavior
+ try {
+ if (!CVSAction.checkForMixingTags(getShell(), replaceOperation.getScope().getRoots(), tag[0])) {
+ tag[0] = null;
return;
-
- // For non-projects determine if the tag being loaded is the same as the resource's parent
- // If it's not, warn the user that they will have strange sync behavior
- try {
- if(!CVSAction.checkForMixingTags(getShell(), replaceOperation.getScope().getRoots(), tag[0])) {
- tag[0] = null;
- return;
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
}
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
@@ -97,6 +93,7 @@ public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.ReplaceWithTagAction_replace;
}
@@ -104,6 +101,7 @@ public abstract class ReplaceWithTagAction extends WorkspaceTraversalAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
*/
+ @Override
protected boolean isEnabledForNonExistantResources() {
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
index ad6960cfb..2b938715b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/RestoreFromRepositoryAction.java
@@ -35,8 +35,9 @@ import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.ResizableWizardDialog;
import org.eclipse.team.internal.ccvs.ui.wizards.RestoreFromRepositoryWizard;
/**
@@ -60,6 +61,7 @@ public class RestoreFromRepositoryAction extends WorkspaceTraversalAction {
ICVSFolder currentFolder;
List atticFiles = new ArrayList();
+ @Override
public IStatus messageLine(
String line,
ICVSRepositoryLocation location,
@@ -116,6 +118,7 @@ public class RestoreFromRepositoryAction extends WorkspaceTraversalAction {
return OK;
}
+ @Override
public IStatus errorLine(
String line,
ICVSRepositoryLocation location,
@@ -146,6 +149,7 @@ public class RestoreFromRepositoryAction extends WorkspaceTraversalAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
*/
+ @Override
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
IContainer resource = (IContainer)getSelectedResources()[0];
ICVSFile[] files = fetchDeletedFiles(resource);
@@ -163,6 +167,7 @@ public class RestoreFromRepositoryAction extends WorkspaceTraversalAction {
/**
* @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
IResource[] resources = getSelectedResources();
if (resources.length != 1) return false;
@@ -180,16 +185,14 @@ public class RestoreFromRepositoryAction extends WorkspaceTraversalAction {
final ICVSFile[][] files = new ICVSFile[1][0];
files[0] = null;
try {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(parent);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(info.getRoot());
- files[0] = fetchFilesInAttic(location, folder, monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
+ run((IRunnableWithProgress) monitor -> {
+ try {
+ ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(parent);
+ FolderSyncInfo info = folder.getFolderSyncInfo();
+ ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(info.getRoot());
+ files[0] = fetchFilesInAttic(location, folder, monitor);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
}
}, true, PROGRESS_DIALOG);
} catch (InvocationTargetException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java
index 5cc3d8aaa..7117646e1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java
@@ -15,7 +15,7 @@
package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
+
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.internal.ccvs.core.EditorsInfo;
@@ -30,14 +30,11 @@ import org.eclipse.team.internal.ccvs.ui.EditorsView;
*/
public class ShowEditorsAction extends WorkspaceAction {
+ @Override
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
final EditorsAction editorsAction = new EditorsAction();
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- executeProviderAction(editorsAction, monitor);
- }
- }, true /* cancelable */ , PROGRESS_DIALOG);
+ run((IRunnableWithProgress) monitor -> executeProviderAction(editorsAction, monitor), true /* cancelable */ ,
+ PROGRESS_DIALOG);
EditorsInfo[] infos = editorsAction.getEditorsInfo();
EditorsView view = (EditorsView)showView(EditorsView.VIEW_ID);
if (view != null) {
@@ -49,6 +46,7 @@ public class ShowEditorsAction extends WorkspaceAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
*/
+ @Override
protected boolean isEnabledForAddedResources() {
return false;
}
@@ -56,6 +54,7 @@ public class ShowEditorsAction extends WorkspaceAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
*/
+ @Override
protected boolean isEnabledForNonExistantResources() {
return true;
}
@@ -63,6 +62,7 @@ public class ShowEditorsAction extends WorkspaceAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
*/
+ @Override
protected boolean isEnabledForMultipleResources() {
// We support one selected Resource,
// because the editors command will
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
index 79f8a721d..b4f885037 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
@@ -18,7 +18,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -62,17 +61,17 @@ public class ShowHistoryAction extends CVSAction {
/*
* @see CVSAction#executeIAction)
*/
+ @Override
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- ICVSRemoteFile[] files = getSelectedRemoteFiles();
- TeamUI.showHistoryFor(getTargetPage(), files[0], null);
- }
+ run((IRunnableWithProgress) monitor -> {
+ ICVSRemoteFile[] files = getSelectedRemoteFiles();
+ TeamUI.showHistoryFor(getTargetPage(), files[0], null);
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
/*
* @see TeamAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
ICVSRemoteFile[] resources = getSelectedRemoteFiles();
return resources.length == 1;
@@ -80,6 +79,7 @@ public class ShowHistoryAction extends CVSAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.ShowHistoryAction_showHistory;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java
index d54f085b9..fd8f8bc1d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowResourceInHistoryAction.java
@@ -16,7 +16,6 @@ package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -30,19 +29,20 @@ public class ShowResourceInHistoryAction extends WorkspaceAction {
/*
* @see IActionDelegate#run(IAction)
*/
+ @Override
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IResource[] resources = getSelectedResources();
- if (resources.length != 1) return;
- TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resources[0], null);
- }
+ run((IRunnableWithProgress) monitor -> {
+ IResource[] resources = getSelectedResources();
+ if (resources.length != 1)
+ return;
+ TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resources[0], null);
}, false /* cancelable */, PROGRESS_BUSYCURSOR);
}
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.ShowHistoryAction_showHistory;
}
@@ -50,6 +50,7 @@ public class ShowResourceInHistoryAction extends WorkspaceAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
*/
+ @Override
protected boolean isEnabledForMultipleResources() {
return false;
}
@@ -57,6 +58,7 @@ public class ShowResourceInHistoryAction extends WorkspaceAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
*/
+ @Override
protected boolean isEnabledForAddedResources() {
return true;
}
@@ -64,6 +66,7 @@ public class ShowResourceInHistoryAction extends WorkspaceAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
*/
+ @Override
protected boolean isEnabledForNonExistantResources() {
return true;
}
@@ -71,6 +74,7 @@ public class ShowResourceInHistoryAction extends WorkspaceAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
*/
+ @Override
protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
return (!cvsResource.isFolder() && super.isEnabledForCVSResource(cvsResource));
}
@@ -78,14 +82,17 @@ public class ShowResourceInHistoryAction extends WorkspaceAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
*/
+ @Override
public String getId() {
return ICVSUIConstants.CMD_HISTORY;
}
+ @Override
protected boolean isEnabledForUnmanagedResources() {
return true;
}
+ @Override
protected boolean isEnabledForIgnoredResources() {
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
index f883d4959..b44e6082e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
@@ -18,10 +18,10 @@ import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.resources.mapping.*;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
@@ -187,27 +187,22 @@ public class SyncAction extends WorkspaceTraversalAction {
*/
public static void showSingleFileComparison(final Shell shell, final Subscriber subscriber, final IResource resource, final IWorkbenchPage page) {
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- subscriber.refresh(new IResource[]{resource}, IResource.DEPTH_ZERO, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ subscriber.refresh(new IResource[] { resource }, IResource.DEPTH_ZERO, monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
final SyncInfo info = subscriber.getSyncInfo(resource);
if (info == null) return;
- shell.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- if (info.getKind() == SyncInfo.IN_SYNC) {
- MessageDialog.openInformation(shell, CVSUIMessages.SyncAction_noChangesTitle, CVSUIMessages.SyncAction_noChangesMessage); //
- } else {
- SyncInfoCompareInput input = new SyncInfoCompareInput(subscriber.getName(), info);
- OpenInCompareAction.openCompareEditor(input, page);
- }
+ shell.getDisplay().syncExec(() -> {
+ if (info.getKind() == SyncInfo.IN_SYNC) {
+ MessageDialog.openInformation(shell, CVSUIMessages.SyncAction_noChangesTitle,
+ CVSUIMessages.SyncAction_noChangesMessage); //
+ } else {
+ SyncInfoCompareInput input = new SyncInfoCompareInput(subscriber.getName(), info);
+ OpenInCompareAction.openCompareEditor(input, page);
}
});
} catch (InvocationTargetException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
index 6c71e42e8..4ac4955c8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
@@ -24,13 +24,8 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.tags.TagAsVersionDialog;
@@ -46,18 +41,18 @@ public abstract class TagAction extends WorkspaceTraversalAction {
/**
* @see CVSAction#execute(IAction)
*/
+ @Override
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
setWasCancelled(false);
// Prompt for the tag name
final ITagOperation[] result = new ITagOperation[1];
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = configureOperation();
- if (result[0] == null) {
- return;
- }
- }});
+ getShell().getDisplay().syncExec(() -> {
+ result[0] = configureOperation();
+ if (result[0] == null) {
+ return;
+ }
+ });
if (result[0] == null) {
setWasCancelled(true);
@@ -113,10 +108,12 @@ public abstract class TagAction extends WorkspaceTraversalAction {
protected abstract ITagOperation createTagOperation();
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.TagAction_tagErrorTitle;
}
+ @Override
protected String getWarningTitle() {
return CVSUIMessages.TagAction_tagWarningTitle;
}
@@ -124,6 +121,7 @@ public abstract class TagAction extends WorkspaceTraversalAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
*/
+ @Override
protected boolean isEnabledForAddedResources() {
return false;
}
@@ -139,6 +137,7 @@ public abstract class TagAction extends WorkspaceTraversalAction {
public static void broadcastTagChange(final ICVSResource[] resources, final CVSTag tag) throws InvocationTargetException, InterruptedException {
final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
manager.run(new IRunnableWithProgress() {
+ @Override
public void run(IProgressMonitor monitor) {
try {
for (int i = 0; i < resources.length; i++) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
index eea9ed336..d1b223690 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagLocalAction.java
@@ -29,22 +29,20 @@ public class TagLocalAction extends TagAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.TagAction#performPrompting(org.eclipse.team.internal.ccvs.ui.operations.ITagOperation)
*/
+ @Override
protected boolean performPrompting(ITagOperation operation) {
if (operation instanceof TagOperation) {
final TagOperation tagOperation = (TagOperation) operation;
try {
if (hasOutgoingChanges(tagOperation)) {
final boolean[] keepGoing = new boolean[] { true };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), tagOperation.getScopeManager(),
- CVSUIMessages.TagLocalAction_2,
- CVSUIMessages.TagLocalAction_0,
- ""); //$NON-NLS-1$
- dialog.setHelpContextId(IHelpContextIds.TAG_OUTGOING_CHANGES_DIALOG);
- int result = dialog.open();
- keepGoing[0] = result == Window.OK;
- }
+ Display.getDefault().syncExec(() -> {
+ OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(),
+ tagOperation.getScopeManager(), CVSUIMessages.TagLocalAction_2,
+ CVSUIMessages.TagLocalAction_0, ""); //$NON-NLS-1$
+ dialog.setHelpContextId(IHelpContextIds.TAG_OUTGOING_CHANGES_DIALOG);
+ int result = dialog.open();
+ keepGoing[0] = result == Window.OK;
});
return keepGoing[0];
}
@@ -61,13 +59,15 @@ public class TagLocalAction extends TagAction {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.TagAction#createTagOperation()
*/
- protected ITagOperation createTagOperation() {
+ @Override
+ protected ITagOperation createTagOperation() {
return new TagOperation(getTargetPart(), getCVSResourceMappings());
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId()
*/
+ @Override
public String getId() {
return ICVSUIConstants.CMD_TAGASVERSION;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
index 48a1fe2ff..ee384f64e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UnmanageAction.java
@@ -73,6 +73,7 @@ public class UnmanageAction extends WorkspaceAction {
}
}
+ @Override
protected Control createCustomArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
@@ -96,6 +97,7 @@ public class UnmanageAction extends WorkspaceAction {
}
private SelectionListener selectionListener = new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
Button button = (Button) e.widget;
if (button.getSelection()) {
@@ -114,6 +116,7 @@ public class UnmanageAction extends WorkspaceAction {
/*
* @see IActionDelegate#run(IAction)
*/
+ @Override
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
if(confirmDeleteProjects()) {
new DisconnectOperation(getTargetPart(), getSelectedProjects(), deleteContent)
@@ -125,11 +128,7 @@ public class UnmanageAction extends WorkspaceAction {
final int[] result = new int[] { Window.OK };
IProject[] projects = getSelectedProjects();
final DeleteProjectDialog dialog = new DeleteProjectDialog(getShell(), projects);
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }
- });
+ getShell().getDisplay().syncExec(() -> result[0] = dialog.open());
deleteContent = dialog.getDeleteContent();
return result[0] == 0; // YES
}
@@ -137,6 +136,7 @@ public class UnmanageAction extends WorkspaceAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.Unmanage_unmanagingError;
}
@@ -144,6 +144,7 @@ public class UnmanageAction extends WorkspaceAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
*/
+ @Override
protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
IResource resource = cvsResource.getIResource();
return resource != null && resource.getType() == IResource.PROJECT;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
index 850436e1e..7ad0355dd 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
@@ -14,12 +14,7 @@
package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
@@ -57,6 +52,7 @@ public abstract class WorkspaceAction extends CVSAction {
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#beginExecution(IAction)
*/
+ @Override
protected boolean beginExecution(IAction action) throws TeamException {
if (super.beginExecution(action)) {
// Ensure that the required sync info is loaded
@@ -117,13 +113,11 @@ public abstract class WorkspaceAction extends CVSAction {
if (folder.getIResource().getType() == IResource.PROJECT) return;
if (CVSWorkspaceRoot.isOrphanedSubtree((IContainer)folder.getIResource())) {
try {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- folder.unmanage(null);
- } catch (CVSException e) {
- CVSProviderPlugin.log(e);
- }
+ run((IRunnableWithProgress) monitor -> {
+ try {
+ folder.unmanage(null);
+ } catch (CVSException e) {
+ CVSProviderPlugin.log(e);
}
}, true, PROGRESS_BUSYCURSOR);
} catch (InvocationTargetException e) {
@@ -209,6 +203,7 @@ public abstract class WorkspaceAction extends CVSAction {
*
* @see org.eclipse.team.internal.ui.actions.TeamAction#setActionEnablement(IAction)
*/
+ @Override
protected void setActionEnablement(IAction action) {
try {
boolean requires = requiresLocalSyncInfo();
@@ -246,20 +241,20 @@ public abstract class WorkspaceAction extends CVSAction {
protected boolean promptToRefresh(final Shell shell, final IResource[] resources, final IStatus status) {
final boolean[] result = new boolean[] { false};
- Runnable runnable = new Runnable() {
- public void run() {
- Shell shellToUse = shell;
- if (shell == null) {
- shellToUse = new Shell(Display.getCurrent());
- }
- String question;
- if (resources.length == 1) {
- question = NLS.bind(CVSUIMessages.CVSAction_refreshQuestion, new String[] { status.getMessage(), resources[0].getFullPath().toString() });
- } else {
- question = NLS.bind(CVSUIMessages.CVSAction_refreshMultipleQuestion, new String[] { status.getMessage() });
- }
- result[0] = MessageDialog.openQuestion(shellToUse, CVSUIMessages.CVSAction_refreshTitle, question);
+ Runnable runnable = () -> {
+ Shell shellToUse = shell;
+ if (shell == null) {
+ shellToUse = new Shell(Display.getCurrent());
+ }
+ String question;
+ if (resources.length == 1) {
+ question = NLS.bind(CVSUIMessages.CVSAction_refreshQuestion,
+ new String[] { status.getMessage(), resources[0].getFullPath().toString() });
+ } else {
+ question = NLS.bind(CVSUIMessages.CVSAction_refreshMultipleQuestion,
+ new String[] { status.getMessage() });
}
+ result[0] = MessageDialog.openQuestion(shellToUse, CVSUIMessages.CVSAction_refreshTitle, question);
};
Display.getDefault().syncExec(runnable);
return result[0];
@@ -270,6 +265,7 @@ public abstract class WorkspaceAction extends CVSAction {
* save dirty editors.
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#needsToSaveDirtyEditors()
*/
+ @Override
protected boolean needsToSaveDirtyEditors() {
return true;
}
@@ -290,6 +286,7 @@ public abstract class WorkspaceAction extends CVSAction {
* </ol>
* @see TeamAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
// allow the super to decide enablement. if the super doesn't know it will return false.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
index cac821285..b02879137 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceTraversalAction.java
@@ -21,7 +21,6 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
@@ -108,18 +107,13 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
// Use a resource mapping context to include any relevant remote resources
final IResource[][] resources = new IResource[][] { null };
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- resources[0] = getRootTraversalResources(
- manager,
- monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- });
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ resources[0] = getRootTraversalResources(manager, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ });
} catch (InterruptedException e) {
// Canceled
return null;
@@ -143,7 +137,8 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
*
* @deprecated need to find a better way to do this
*/
- public static boolean isLogicalModel(ResourceMapping[] mappings) {
+ @Deprecated
+ public static boolean isLogicalModel(ResourceMapping[] mappings) {
for (int i = 0; i < mappings.length; i++) {
ResourceMapping mapping = mappings[i];
if (! (mapping.getModelObject() instanceof IResource) ) {
@@ -165,20 +160,16 @@ public abstract class WorkspaceTraversalAction extends WorkspaceAction {
protected boolean hasOutgoingChanges(final RepositoryProviderOperation operation) throws InvocationTargetException, InterruptedException {
final boolean[] hasChange = new boolean[] { false };
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- monitor.beginTask(CVSUIMessages.WorkspaceTraversalAction_0, 100);
- operation.buildScope(Policy.subMonitorFor(monitor, 50));
- hasChange[0] = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().hasLocalChanges(
- operation.getScope().getTraversals(),
- Policy.subMonitorFor(monitor, 50));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ monitor.beginTask(CVSUIMessages.WorkspaceTraversalAction_0, 100);
+ operation.buildScope(Policy.subMonitorFor(monitor, 50));
+ hasChange[0] = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber()
+ .hasLocalChanges(operation.getScope().getTraversals(), Policy.subMonitorFor(monitor, 50));
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
}
});
return hasChange[0];
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
index 985f05f0d..03b2bbb6b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/console/CVSOutputConsole.java
@@ -13,8 +13,6 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.console;
-import com.ibm.icu.text.DateFormat;
-import com.ibm.icu.text.SimpleDateFormat;
import java.util.Date;
import org.eclipse.core.runtime.*;
@@ -35,6 +33,9 @@ import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.*;
+import com.ibm.icu.text.DateFormat;
+import com.ibm.icu.text.SimpleDateFormat;
+
/**
* Console that shows the output of CVS commands. It is shown as a page in the generic
* console view. It supports coloring for message, command, and error lines in addition
@@ -92,6 +93,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
* and <code>dispose()</code>.
*/
public class MyLifecycle implements org.eclipse.ui.console.IConsoleListener {
+ @Override
public void consolesAdded(IConsole[] consoles) {
for (int i = 0; i < consoles.length; i++) {
IConsole console = consoles[i];
@@ -101,6 +103,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
}
}
+ @Override
public void consolesRemoved(IConsole[] consoles) {
for (int i = 0; i < consoles.length; i++) {
IConsole console = consoles[i];
@@ -128,6 +131,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
/* (non-Javadoc)
* @see org.eclipse.ui.console.AbstractConsole#init()
*/
+ @Override
protected void init() {
// Called when console is added to the console view
super.init();
@@ -136,12 +140,10 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
initWrapSetting();
// Ensure that initialization occurs in the ui thread
- CVSUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- JFaceResources.getFontRegistry().addListener(CVSOutputConsole.this);
- initializeStreams();
- dump();
- }
+ CVSUIPlugin.getStandardDisplay().asyncExec(() -> {
+ JFaceResources.getFontRegistry().addListener(CVSOutputConsole.this);
+ initializeStreams();
+ dump();
});
}
@@ -228,6 +230,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
/* (non-Javadoc)
* @see org.eclipse.ui.console.MessageConsole#dispose()
*/
+ @Override
protected void dispose() {
// Here we can't call super.dispose() because we actually want the partitioner to remain
// connected, but we won't show lines until the console is added to the console manager
@@ -259,6 +262,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#commandInvoked(java.lang.String)
*/
+ @Override
public void commandInvoked(Session session, String line) {
if (!session.isOutputToConsole()) return;
commandStarted = System.currentTimeMillis();
@@ -269,6 +273,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#messageLineReceived(java.lang.String)
*/
+ @Override
public void messageLineReceived(Session session, String line, IStatus status) {
if (session.isOutputToConsole()) {
appendLine(ConsoleDocument.MESSAGE, " " + line); //$NON-NLS-1$
@@ -278,6 +283,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#errorLineReceived(java.lang.String)
*/
+ @Override
public void errorLineReceived(Session session, String line, IStatus status) {
if (session.isOutputToConsole()) {
appendLine(ConsoleDocument.ERROR, " " + line); //$NON-NLS-1$
@@ -287,6 +293,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener#commandCompleted(org.eclipse.core.runtime.IStatus, java.lang.Exception)
*/
+ @Override
public void commandCompleted(Session session, IStatus status, Exception exception) {
if (!session.isOutputToConsole()) return;
long commandRuntime = System.currentTimeMillis() - commandStarted;
@@ -356,6 +363,7 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
/* (non-Javadoc)
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
+ @Override
public void propertyChange(PropertyChangeEvent event) {
String property = event.getProperty();
// colors
@@ -433,7 +441,8 @@ public class CVSOutputConsole extends MessageConsole implements IConsoleListener
}
}
- public String getHelpContextId() {
+ @Override
+ public String getHelpContextId() {
return IHelpContextIds.CONSOLE_VIEW;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java
index 43ba0892e..52e83242e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java
@@ -21,7 +21,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.diff.IDiff;
@@ -44,18 +43,17 @@ public abstract class AbstractCommitAction extends CVSModelProviderAction {
/* (non-Javadoc)
* @see org.eclipse.jface.action.Action#run()
*/
+ @Override
public void execute() {
final List resources = new ArrayList();
try {
final IStructuredSelection selection = getActualSelection();
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ResourceTraversal[] traversals = getCommitTraversals(selection, monitor);
- resources.add(getOutgoingChanges(getSynchronizationContext().getDiffTree(), traversals, monitor));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ ResourceTraversal[] traversals = getCommitTraversals(selection, monitor);
+ resources.add(getOutgoingChanges(getSynchronizationContext().getDiffTree(), traversals, monitor));
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
index e6fdc2aea..bbc815a95 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CVSSubscriberMergeContext.java
@@ -26,7 +26,8 @@ import org.eclipse.team.core.mapping.provider.MergeStatus;
import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.subscribers.SubscriberMergeContext;
-import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -37,6 +38,7 @@ import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler
public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
private static final IStorageMerger MERGER = new DelegatingStorageMerger() {
+ @Override
protected IStorageMerger createDelegateMerger(IStorage target) throws CoreException {
IStorageMerger storageMerger = super.createDelegateMerger(target);
if (storageMerger == null) {
@@ -49,6 +51,7 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
return storageMerger;
}
+ @Override
protected int getType(IStorage target) {
if (target instanceof IFile) {
IFile file = (IFile) target;
@@ -79,26 +82,21 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
/* (non-Javadoc)
* @see org.eclipse.team.core.mapping.MergeContext#run(org.eclipse.core.resources.IWorkspaceRunnable, org.eclipse.core.runtime.jobs.ISchedulingRule, int, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void run(final IWorkspaceRunnable runnable, final ISchedulingRule rule, int flags, IProgressMonitor monitor) throws CoreException {
- super.run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- EclipseSynchronizer.getInstance().run(rule, new ICVSRunnable(){
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- runnable.run(monitor);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- }
- }, monitor);
+ super.run(monitor1 -> EclipseSynchronizer.getInstance().run(rule, monitor2 -> {
+ try {
+ runnable.run(monitor2);
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
}
-
- }, rule, flags, monitor);
+ }, monitor1), rule, flags, monitor);
}
/* (non-Javadoc)
* @see org.eclipse.team.core.mapping.MergeContext#getMergeRule(org.eclipse.core.resources.IResource)
*/
+ @Override
public ISchedulingRule getMergeRule(IDiff node) {
// Return the project since that is what the EclipseSynchronize needs
return getDiffTree().getResource(node).getProject();
@@ -107,6 +105,7 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
/* (non-Javadoc)
* @see org.eclipse.team.core.mapping.provider.MergeContext#makeInSync(org.eclipse.team.core.diff.IDiff, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected void makeInSync(IDiff diff, IProgressMonitor monitor) throws CoreException {
markAsMerged(diff, true, monitor);
}
@@ -114,18 +113,17 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
/* (non-Javadoc)
* @see org.eclipse.team.core.mapping.IMergeContext#reject(org.eclipse.team.core.diff.IDiff, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void reject(IDiff diff, IProgressMonitor monitor) throws CoreException {
markAsMerged(diff, false, monitor);
}
+ @Override
public IStatus merge(final IDiff[] diffs, final boolean ignoreLocalChanges, IProgressMonitor monitor) throws CoreException {
final IStatus[] result = new IStatus[] { Status.OK_STATUS };
if (diffs.length > 0)
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- result[0] = internalMerge(diffs, ignoreLocalChanges, monitor);
- }
- }, getMergeRule(diffs), IWorkspace.AVOID_UPDATE, monitor);
+ run(monitor1 -> result[0] = internalMerge(diffs, ignoreLocalChanges, monitor1), getMergeRule(diffs),
+ IWorkspace.AVOID_UPDATE, monitor);
return result[0];
}
@@ -190,6 +188,7 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
if (!folderDiffs.isEmpty()) {
// Order the diffs so empty added children will get deleted before their parents are visited
Collections.sort(folderDiffs, new Comparator() {
+ @Override
public int compare(Object o1, Object o2) {
return ((IDiff)o2).getPath().toString().compareTo(((IDiff)o1).getPath().toString());
}
@@ -243,6 +242,7 @@ public abstract class CVSSubscriberMergeContext extends SubscriberMergeContext {
return (IFile[]) failures.toArray(new IFile[failures.size()]);
}
+ @Override
public <T> T getAdapter(Class<T> adapter) {
if (adapter == IStorageMerger.class)
return adapter.cast(MERGER);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java
index b9e955b90..1d6212196 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetActionProvider.java
@@ -62,13 +62,10 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
super(TeamUIMessages.ChangeLogModelProvider_0, configuration);
}
+ @Override
public void run() {
final IDiff[] diffs = getLocalChanges(getStructuredSelection());
- syncExec(new Runnable() {
- public void run() {
- createChangeSet(diffs);
- }
- });
+ syncExec(() -> createChangeSet(diffs));
}
/* package */void createChangeSet(IDiff[] diffs) {
@@ -78,6 +75,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
}
}
+ @Override
protected boolean isEnabledForSelection(IStructuredSelection selection) {
return isContentProviderEnabled()
&& containsOnlyLocalChanges(selection);
@@ -118,6 +116,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
selectionChanged(selection);
}
+ @Override
public void run() {
IDiff[] diffArray = getLocalChanges(getStructuredSelection());
if (set != null) {
@@ -132,6 +131,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
}
}
+ @Override
protected boolean isEnabledForSelection(IStructuredSelection selection) {
return isContentProviderEnabled()
&& containsOnlyLocalChanges(selection);
@@ -147,6 +147,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
/* (non-Javadoc)
* @see org.eclipse.ui.actions.BaseSelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
*/
+ @Override
protected boolean updateSelection(IStructuredSelection selection) {
return getSelectedSet() != null;
}
@@ -171,6 +172,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
super(TeamUIMessages.ChangeLogModelProvider_6, configuration);
}
+ @Override
public void run() {
ActiveChangeSet set = getSelectedSet();
if (set == null) return;
@@ -184,6 +186,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
super(TeamUIMessages.ChangeLogModelProvider_7, configuration);
}
+ @Override
public void run() {
IDiff[] diffArray = getLocalChanges(getStructuredSelection());
ChangeSet[] sets = getActiveChangeSetManager().getSets();
@@ -194,6 +197,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
}
}
+ @Override
protected boolean isEnabledForSelection(IStructuredSelection selection) {
return isContentProviderEnabled()
&& containsOnlyLocalChanges(selection);
@@ -206,6 +210,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
super(TeamUIMessages.ChangeLogModelProvider_9, configuration);
}
+ @Override
protected boolean updateSelection(IStructuredSelection selection) {
if (getSelectedSet() != null) {
setText(TeamUIMessages.ChangeLogModelProvider_9);
@@ -218,6 +223,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
return true;
}
+ @Override
public void run() {
getActiveChangeSetManager().makeDefault(
isChecked() ? getSelectedSet() : null);
@@ -239,6 +245,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
update();
}
+ @Override
public void run() {
int sortCriteria = getSortCriteria(internalGetSynchronizePageConfiguration());
if (isChecked() && sortCriteria != criteria) {
@@ -295,6 +302,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
super();
}
+ @Override
protected void initialize() {
super.initialize();
if (getChangeSetCapability().supportsCheckedInChangeSets()) {
@@ -341,6 +349,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
return (IResource[]) result.toArray(new IResource[result.size()]);
}
+ @Override
public void fillContextMenu(IMenuManager menu) {
if (isContentProviderEnabled()) {
super.fillContextMenu(menu);
@@ -395,6 +404,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
manager.add(new Separator());
}
+ @Override
public void dispose() {
if (addToChangeSet != null) {
addToChangeSet.dispose();
@@ -539,6 +549,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
private FastDiffFilter getNonLocalChangesFilter() {
return new FastDiffFilter() {
+ @Override
public boolean select(IDiff diff) {
if (diff instanceof IThreeWayDiff && isVisible(diff)) {
IThreeWayDiff twd = (IThreeWayDiff) diff;
@@ -589,6 +600,7 @@ public class ChangeSetActionProvider extends ResourceModelActionProvider {
return TeamUIPlugin.getPlugin().getPreferenceStore().getString(IPreferenceIds.SYNCVIEW_DEFAULT_LAYOUT);
}
+ @Override
public void setContext(ActionContext context) {
super.setContext(context);
if (context != null) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java
index 4c6840d80..3b826025f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ChangeSetContentProvider.java
@@ -47,16 +47,15 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
/* (non-Javadoc)
* @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#setAdded(org.eclipse.team.internal.core.subscribers.ChangeSet)
*/
+ @Override
public void setAdded(final ChangeSet set) {
// We only react here for active change sets.
// Checked-in change set changes are batched
if (set instanceof ActiveChangeSet) {
if (isVisibleInMode(set)) {
- Utils.syncExec(new Runnable() {
- public void run() {
- Object input = getViewer().getInput();
- ((AbstractTreeViewer)getViewer()).add(input, set);
- }
+ Utils.syncExec((Runnable) () -> {
+ Object input = getViewer().getInput();
+ ((AbstractTreeViewer) getViewer()).add(input, set);
}, (StructuredViewer)getViewer());
}
handleSetAddition(set);
@@ -70,19 +69,18 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
/* (non-Javadoc)
* @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#defaultSetChanged(org.eclipse.team.internal.core.subscribers.ChangeSet, org.eclipse.team.internal.core.subscribers.ChangeSet)
*/
+ @Override
public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
if (isVisibleInMode(set) || isVisibleInMode(previousDefault)) {
- Utils.asyncExec(new Runnable() {
- public void run() {
- if (set == null) {
- // unset default changeset
- ((AbstractTreeViewer)getViewer()).update(previousDefault, null);
- } else if (previousDefault != null) {
- ((AbstractTreeViewer)getViewer()).update(new Object[] {previousDefault, set}, null);
- } else {
- // when called for the first time previous default change set is null
- ((AbstractTreeViewer)getViewer()).update(set, null);
- }
+ Utils.asyncExec((Runnable) () -> {
+ if (set == null) {
+ // unset default changeset
+ ((AbstractTreeViewer) getViewer()).update(previousDefault, null);
+ } else if (previousDefault != null) {
+ ((AbstractTreeViewer) getViewer()).update(new Object[] { previousDefault, set }, null);
+ } else {
+ // when called for the first time previous default change set is null
+ ((AbstractTreeViewer) getViewer()).update(set, null);
}
}, (StructuredViewer)getViewer());
}
@@ -91,16 +89,14 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
/* (non-Javadoc)
* @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#setRemoved(org.eclipse.team.internal.core.subscribers.ChangeSet)
*/
+ @Override
public void setRemoved(final ChangeSet set) {
// We only react here for active change sets.
// Checked-in change set changes are batched
if (set instanceof ActiveChangeSet) {
if (isVisibleInMode(set)) {
- Utils.syncExec(new Runnable() {
- public void run() {
- ((AbstractTreeViewer)getViewer()).remove(TreePath.EMPTY.createChildPath(set));
- }
- }, (StructuredViewer)getViewer());
+ Utils.syncExec((Runnable) () -> ((AbstractTreeViewer) getViewer())
+ .remove(TreePath.EMPTY.createChildPath(set)), (StructuredViewer) getViewer());
}
handleSetRemoval(set);
}
@@ -121,34 +117,31 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
/* (non-Javadoc)
* @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#nameChanged(org.eclipse.team.internal.core.subscribers.ChangeSet)
*/
+ @Override
public void nameChanged(final ChangeSet set) {
if (isVisibleInMode(set)) {
- Utils.asyncExec(new Runnable() {
- public void run() {
- ((AbstractTreeViewer)getViewer()).update(set, null);
- }
- }, (StructuredViewer)getViewer());
+ Utils.asyncExec((Runnable) () -> ((AbstractTreeViewer) getViewer()).update(set, null),
+ (StructuredViewer) getViewer());
}
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.core.subscribers.IChangeSetChangeListener#resourcesChanged(org.eclipse.team.internal.core.subscribers.ChangeSet, org.eclipse.core.runtime.IPath[])
*/
+ @Override
public void resourcesChanged(final ChangeSet set, final IPath[] paths) {
// We only react here for active change sets.
// Checked-in change set changes are batched
if (set instanceof ActiveChangeSet) {
if (isVisibleInMode(set)) {
- Utils.syncExec(new Runnable() {
- public void run() {
- if (hasChildrenInContext(set))
- if (getVisibleSetsInViewer().contains(set))
- ((AbstractTreeViewer)getViewer()).refresh(set, true);
- else
- ((AbstractTreeViewer)getViewer()).add(getViewer().getInput(), set);
- else
- ((AbstractTreeViewer)getViewer()).remove(set);
- }
+ Utils.syncExec((Runnable) () -> {
+ if (hasChildrenInContext(set))
+ if (getVisibleSetsInViewer().contains(set))
+ ((AbstractTreeViewer) getViewer()).refresh(set, true);
+ else
+ ((AbstractTreeViewer) getViewer()).add(getViewer().getInput(), set);
+ else
+ ((AbstractTreeViewer) getViewer()).remove(set);
}, (StructuredViewer)getViewer());
}
handleSetChange(set, paths);
@@ -178,6 +171,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
}
}
+ @Override
public void changeSetChanges(final CollectorChangeEvent event, IProgressMonitor monitor) {
ChangeSet[] addedSets = event.getAddedSets();
final ChangeSet[] visibleAddedSets = getVisibleSets(addedSets);
@@ -186,23 +180,21 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
ChangeSet[] changedSets = event.getChangedSets();
final ChangeSet[] visibleChangedSets = getVisibleSets(changedSets);
if (visibleAddedSets.length > 0 || visibleRemovedSets.length > 0 || visibleChangedSets.length > 0) {
- Utils.syncExec(new Runnable() {
- public void run() {
- try {
- getViewer().getControl().setRedraw(false);
- if (visibleAddedSets.length > 0) {
- Object input = getViewer().getInput();
- ((AbstractTreeViewer)getViewer()).add(input, visibleAddedSets);
- }
- if (visibleRemovedSets.length > 0)
- ((AbstractTreeViewer)getViewer()).remove(visibleRemovedSets);
- for (int i = 0; i < visibleChangedSets.length; i++) {
- ChangeSet set = visibleChangedSets[i];
- ((AbstractTreeViewer)getViewer()).refresh(set, true);
- }
- } finally {
- getViewer().getControl().setRedraw(true);
+ Utils.syncExec((Runnable) () -> {
+ try {
+ getViewer().getControl().setRedraw(false);
+ if (visibleAddedSets.length > 0) {
+ Object input = getViewer().getInput();
+ ((AbstractTreeViewer) getViewer()).add(input, visibleAddedSets);
}
+ if (visibleRemovedSets.length > 0)
+ ((AbstractTreeViewer) getViewer()).remove(visibleRemovedSets);
+ for (int i = 0; i < visibleChangedSets.length; i++) {
+ ChangeSet set = visibleChangedSets[i];
+ ((AbstractTreeViewer) getViewer()).refresh(set, true);
+ }
+ } finally {
+ getViewer().getControl().setRedraw(true);
}
}, (StructuredViewer)getViewer());
}
@@ -268,6 +260,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
/* (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
}
@@ -279,19 +272,18 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
/* (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) {
Object input = getViewer().getInput();
if (input instanceof ChangeSetModelProvider && unassignedDiffs != null && event.getTree() == unassignedDiffs.getDiffTree()) {
- Utils.asyncExec(new Runnable() {
- public void run() {
- if (unassignedDiffs.isEmpty() || !hasChildren(TreePath.EMPTY.createChildPath(getUnassignedSet()))) {
- ((AbstractTreeViewer)getViewer()).remove(unassignedDiffs);
- } else if (!isSetVisible(unassignedDiffs)) {
- Object input = getViewer().getInput();
- ((AbstractTreeViewer)getViewer()).add(input, unassignedDiffs);
- } else {
- ((AbstractTreeViewer)getViewer()).refresh(unassignedDiffs);
- }
+ Utils.asyncExec((Runnable) () -> {
+ if (unassignedDiffs.isEmpty() || !hasChildren(TreePath.EMPTY.createChildPath(getUnassignedSet()))) {
+ ((AbstractTreeViewer) getViewer()).remove(unassignedDiffs);
+ } else if (!isSetVisible(unassignedDiffs)) {
+ Object input1 = getViewer().getInput();
+ ((AbstractTreeViewer) getViewer()).add(input1, unassignedDiffs);
+ } else {
+ ((AbstractTreeViewer) getViewer()).refresh(unassignedDiffs);
}
}, (StructuredViewer)getViewer());
}
@@ -304,6 +296,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.mapping.ResourceModelContentProvider#getModelProviderId()
*/
+ @Override
protected String getModelProviderId() {
return ChangeSetModelProvider.ID;
}
@@ -329,6 +322,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.mapping.ResourceModelContentProvider#getElements(java.lang.Object)
*/
+ @Override
public Object[] getElements(Object parent) {
if (parent instanceof ISynchronizationContext) {
// Do not show change sets when all models are visible because
@@ -374,12 +368,10 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
private void addAllUnassignedToUnassignedSet() {
IResourceDiffTree allChanges = getContext().getDiffTree();
final List diffs = new ArrayList();
- allChanges.accept(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- if (!isContainedInSet(diff))
- diffs.add(diff);
- return true;
- }
+ allChanges.accept(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), diff -> {
+ if (!isContainedInSet(diff))
+ diffs.add(diff);
+ return true;
}, IResource.DEPTH_INFINITE);
unassignedDiffs.add((IDiff[]) diffs.toArray(new IDiff[diffs.size()]));
}
@@ -409,6 +401,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.mapping.ResourceModelContentProvider#getTraversals(org.eclipse.team.core.mapping.ISynchronizationContext, java.lang.Object)
*/
+ @Override
protected ResourceTraversal[] getTraversals(
ISynchronizationContext context, Object object) {
if (object instanceof ChangeSet) {
@@ -419,6 +412,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
return super.getTraversals(context, object);
}
+ @Override
public Object[] getChildren(TreePath parentPath) {
if (!isEnabled())
return new Object[0];
@@ -524,6 +518,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
return false;
}
+ @Override
public boolean hasChildren(TreePath path) {
if (path.getSegmentCount() == 1) {
Object first = path.getFirstSegment();
@@ -544,6 +539,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
return false;
}
+ @Override
public TreePath[] getParents(Object element) {
if (element instanceof ChangeSet) {
return new TreePath[] { TreePath.EMPTY };
@@ -655,6 +651,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
return result;
}
+ @Override
public void init(ICommonContentExtensionSite site) {
super.init(site);
ChangeSetCapability csc = getChangeSetCapability();
@@ -690,6 +687,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
}
}
+ @Override
public void dispose() {
ChangeSetCapability csc = getChangeSetCapability();
if (csc.supportsActiveChangeSets()) {
@@ -705,6 +703,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
super.dispose();
}
+ @Override
public boolean isVisible(IDiff diff) {
return super.isVisible(diff);
}
@@ -720,6 +719,7 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
return getTheRest();
}
+ @Override
public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
// Override inherited method to reconcile sub-trees
IPath[] removed = event.getRemovals();
@@ -754,14 +754,12 @@ public class ChangeSetContentProvider extends ResourceModelContentProvider imple
if (firstDiffChange) {
// One the first diff event, refresh the viewer to ensure outgoing change sets appear
firstDiffChange = false;
- Utils.asyncExec(new Runnable() {
- public void run() {
- ((AbstractTreeViewer)getViewer()).refresh();
- }
- }, (StructuredViewer)getViewer());
+ Utils.asyncExec((Runnable) () -> ((AbstractTreeViewer) getViewer()).refresh(),
+ (StructuredViewer) getViewer());
}
}
+ @Override
protected void updateLabels(ISynchronizationContext context, IPath[] paths) {
super.updateLabels(context, paths);
ChangeSet[] sets = getSetsShowingPropogatedStateFrom(paths);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java
index 646579e41..67c1e1d3a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/CreatePatchAction.java
@@ -21,7 +21,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.core.diff.*;
import org.eclipse.team.core.mapping.IResourceDiffTree;
@@ -41,6 +40,7 @@ public class CreatePatchAction extends CVSModelProviderAction implements IDiffCh
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.mapping.ModelProviderAction#isEnabledForSelection(org.eclipse.jface.viewers.IStructuredSelection)
*/
+ @Override
protected boolean isEnabledForSelection(IStructuredSelection selection) {
return internalIsEnabled(selection);
}
@@ -75,20 +75,20 @@ public class CreatePatchAction extends CVSModelProviderAction implements IDiffCh
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.mappings.CVSModelProviderAction#getBundleKeyPrefix()
*/
- protected String getBundleKeyPrefix() {
+ @Override
+ protected String getBundleKeyPrefix() {
return "GenerateDiffFileAction."; //$NON-NLS-1$
}
- public void execute() {
+ @Override
+ public void execute() {
final ResourceTraversal [][] traversals = new ResourceTraversal[][] { null };
try {
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- traversals[0] = getResourceTraversals(getStructuredSelection(), monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ traversals[0] = getResourceTraversals(getStructuredSelection(), monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {
@@ -106,10 +106,12 @@ public class CreatePatchAction extends CVSModelProviderAction implements IDiffCh
}
}
+ @Override
public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
updateEnablement();
}
+ @Override
public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
// Nothing to do
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java
index b390c93de..d7b903203 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/MergeSubscriberContext.java
@@ -51,26 +51,20 @@ public class MergeSubscriberContext extends CVSSubscriberMergeContext {
*/
@Override
public void markAsMerged(final IDiff diff, boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- ((CVSMergeSubscriber)getSubscriber()).merged(new IResource[] { getDiffTree().getResource(diff)});
- }
- }, getMergeRule(diff), IResource.NONE, monitor);
+ run(monitor1 -> ((CVSMergeSubscriber) getSubscriber())
+ .merged(new IResource[] { getDiffTree().getResource(diff) }), getMergeRule(diff), IResource.NONE,
+ monitor);
}
@Override
public void markAsMerged(final IDiff[] diffs, boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- List result = new ArrayList();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
- result.add(getDiffTree().getResource(diff));
- }
- ((CVSMergeSubscriber)getSubscriber()).merged((IResource[]) result.toArray(new IResource[result.size()]));
+ run(monitor1 -> {
+ List result = new ArrayList();
+ for (int i = 0; i < diffs.length; i++) {
+ IDiff diff = diffs[i];
+ result.add(getDiffTree().getResource(diff));
}
+ ((CVSMergeSubscriber) getSubscriber()).merged((IResource[]) result.toArray(new IResource[result.size()]));
}, getMergeRule(diffs), IResource.NONE, monitor);
}
@@ -88,31 +82,28 @@ public class MergeSubscriberContext extends CVSSubscriberMergeContext {
@Override
public IStatus merge(final IDiff diff, final boolean ignoreLocalChanges, IProgressMonitor monitor) throws CoreException {
final IStatus[] status = new IStatus[] { Status.OK_STATUS };
- run(new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- IThreeWayDiff currentDiff = (IThreeWayDiff)getSubscriber().getDiff(getDiffTree().getResource(diff));
- if (!MergeSubscriberContext.this.equals(currentDiff, (IThreeWayDiff)diff)) {
- throw new CVSException(NLS.bind(CVSUIMessages.CVSMergeContext_1, diff.getPath()));
- }
- status[0] = MergeSubscriberContext.super.merge(diff, ignoreLocalChanges, monitor);
- if (status[0].isOK()) {
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (resource.getType() == IResource.FILE && resource.exists() && diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- if (twd.getKind() == IDiff.ADD && twd.getDirection() == IThreeWayDiff.INCOMING) {
- IFileRevision remote = Utils.getRemote(diff);
- IResourceVariant variant = Adapters.adapt(remote, IResourceVariant.class);
- byte[] syncBytes = variant.asBytes();
- MutableResourceSyncInfo info = new MutableResourceSyncInfo(resource.getName(), ResourceSyncInfo.ADDED_REVISION);
- info.setKeywordMode(ResourceSyncInfo.getKeywordMode(syncBytes));
- info.setTag(getTag(resource.getParent()));
- CVSWorkspaceRoot.getCVSFileFor((IFile)resource).setSyncInfo(info, ICVSFile.DIRTY);
- }
+ run(monitor1 -> {
+ IThreeWayDiff currentDiff = (IThreeWayDiff) getSubscriber().getDiff(getDiffTree().getResource(diff));
+ if (!MergeSubscriberContext.this.equals(currentDiff, (IThreeWayDiff) diff)) {
+ throw new CVSException(NLS.bind(CVSUIMessages.CVSMergeContext_1, diff.getPath()));
+ }
+ status[0] = MergeSubscriberContext.super.merge(diff, ignoreLocalChanges, monitor1);
+ if (status[0].isOK()) {
+ IResource resource = ResourceDiffTree.getResourceFor(diff);
+ if (resource.getType() == IResource.FILE && resource.exists() && diff instanceof IThreeWayDiff) {
+ IThreeWayDiff twd = (IThreeWayDiff) diff;
+ if (twd.getKind() == IDiff.ADD && twd.getDirection() == IThreeWayDiff.INCOMING) {
+ IFileRevision remote = Utils.getRemote(diff);
+ IResourceVariant variant = Adapters.adapt(remote, IResourceVariant.class);
+ byte[] syncBytes = variant.asBytes();
+ MutableResourceSyncInfo info = new MutableResourceSyncInfo(resource.getName(),
+ ResourceSyncInfo.ADDED_REVISION);
+ info.setKeywordMode(ResourceSyncInfo.getKeywordMode(syncBytes));
+ info.setTag(getTag(resource.getParent()));
+ CVSWorkspaceRoot.getCVSFileFor((IFile) resource).setSyncInfo(info, ICVSFile.DIRTY);
}
}
}
-
}, getMergeRule(diff), IWorkspace.AVOID_UPDATE, monitor);
return status[0];
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelReplaceOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelReplaceOperation.java
index c1d7bc66a..3f2cf9ccc 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelReplaceOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/ModelReplaceOperation.java
@@ -37,6 +37,7 @@ public class ModelReplaceOperation extends ModelUpdateOperation {
/* (non-Javadoc)
* @see org.eclipse.team.ui.TeamOperation#getJobName()
*/
+ @Override
protected String getJobName() {
return CVSUIMessages.ReplaceOperation_taskName;
}
@@ -44,6 +45,7 @@ public class ModelReplaceOperation extends ModelUpdateOperation {
/* (non-Javadoc)
* @see org.eclipse.team.ui.operations.ResourceMappingMergeOperation#isAttemptHeadlessMerge()
*/
+ @Override
protected boolean isAttemptHeadlessMerge() {
return true;
}
@@ -51,6 +53,7 @@ public class ModelReplaceOperation extends ModelUpdateOperation {
/* (non-Javadoc)
* @see org.eclipse.team.ui.operations.ResourceMappingMergeOperation#hasChangesOfInterest()
*/
+ @Override
protected boolean hasChangesOfInterest() {
IMergeContext context = (IMergeContext)getContext();
return !context.getDiffTree().isEmpty();
@@ -59,6 +62,7 @@ public class ModelReplaceOperation extends ModelUpdateOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.mappings.ModelUpdateOperation#getMergeType()
*/
+ @Override
protected int getMergeType() {
return ISynchronizationContext.TWO_WAY;
}
@@ -66,6 +70,7 @@ public class ModelReplaceOperation extends ModelUpdateOperation {
/* (non-Javadoc)
* @see org.eclipse.team.ui.operations.ResourceMappingMergeOperation#performMerge(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected IStatus performMerge(IProgressMonitor monitor) throws CoreException {
if (!hasLocalChanges() || promptForOverwrite()) {
return super.performMerge(monitor);
@@ -80,20 +85,19 @@ public class ModelReplaceOperation extends ModelUpdateOperation {
if (hasPrompted)
return true;
final int[] result = new int[] { 1 };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.ModelReplaceOperation_0, null, // accept
- // the
- // default
- // window
- // icon
- CVSUIMessages.ModelReplaceOperation_1,
- MessageDialog.QUESTION, new String[] { CVSUIMessages.ModelReplaceOperation_2, CVSUIMessages.ModelReplaceOperation_3,
- IDialogConstants.CANCEL_LABEL }, result[0]); // preview is the default
-
- result[0] = dialog.open();
+ Display.getDefault().syncExec(() -> {
+ MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.ModelReplaceOperation_0, null, // accept
+ // the
+ // default
+ // window
+ // icon
+ CVSUIMessages.ModelReplaceOperation_1, MessageDialog.QUESTION,
+ new String[] { CVSUIMessages.ModelReplaceOperation_2, CVSUIMessages.ModelReplaceOperation_3,
+ IDialogConstants.CANCEL_LABEL },
+ result[0]); // preview is the default
+
+ result[0] = dialog.open();
- };
});
if (result[0] == 2)
throw new OperationCanceledException();
@@ -103,6 +107,7 @@ public class ModelReplaceOperation extends ModelUpdateOperation {
private boolean hasLocalChanges() {
return getContext().getDiffTree().hasMatchingDiffs(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), new FastDiffFilter() {
+ @Override
public boolean select(IDiff node) {
if (node instanceof IThreeWayDiff) {
IThreeWayDiff twd = (IThreeWayDiff) node;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java
index 365f33c47..7cd2e0035 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/OpenChangeSetAction.java
@@ -18,7 +18,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
@@ -212,13 +211,7 @@ class OpenChangeSetAction extends ResourceModelParticipantAction {
@Override
public void run() {
try {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- openEditor(monitor);
- }
- });
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> openEditor(monitor));
} catch (InvocationTargetException e) {
Utils.handle(e);
} catch (InterruptedException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceModelParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceModelParticipant.java
index f4e7599a7..943a45573 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceModelParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceModelParticipant.java
@@ -59,13 +59,16 @@ public class WorkspaceModelParticipant extends
public class WorkspaceMergeActionGroup extends ModelSynchronizeParticipantActionGroup {
private WorkspaceCommitAction commitToolbar;
+ @Override
public void initialize(ISynchronizePageConfiguration configuration) {
configuration.setProperty(MERGE_ALL_ACTION_ID, new MergeAllActionHandler(configuration) {
+ @Override
protected String getJobName() {
String name = getConfiguration().getParticipant().getName();
return NLS.bind(CVSUIMessages.WorkspaceModelParticipant_0, Utils.shortenText(SynchronizeView.MAX_NAME_LENGTH, name));
}
+ @Override
protected boolean promptToUpdate() {
final IResourceDiffTree tree = getMergeContext().getDiffTree();
if (tree.isEmpty()) {
@@ -75,23 +78,28 @@ public class WorkspaceModelParticipant extends
if (count == 0)
return false;
final boolean[] result = new boolean[] {true};
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- String sizeString = Long.toString(count);
- String message = tree.size() > 1 ? NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateSeveral, new String[] { sizeString }) : NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateOne, new String[] { sizeString }); //
- result[0] = MessageDialog.openQuestion(getConfiguration().getSite().getShell(), NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateTitle, new String[] { sizeString }), message);
-
- }
+ TeamUIPlugin.getStandardDisplay().syncExec(() -> {
+ String sizeString = Long.toString(count);
+ String message = tree.size() > 1
+ ? NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateSeveral,
+ new String[] { sizeString })
+ : NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateOne, new String[] { sizeString }); //
+ result[0] = MessageDialog.openQuestion(getConfiguration().getSite().getShell(),
+ NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateTitle, new String[] { sizeString }),
+ message);
+
});
return result[0];
}
private IMergeContext getMergeContext() {
return ((IMergeContext)getConfiguration().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_CONTEXT));
}
+ @Override
protected boolean needsToSaveDirtyEditors() {
int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
return option != ICVSUIConstants.OPTION_NEVER;
}
+ @Override
protected boolean confirmSaveOfDirtyEditor() {
int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
return option == ICVSUIConstants.OPTION_PROMPT;
@@ -154,6 +162,7 @@ public class WorkspaceModelParticipant extends
/* (non-Javadoc)
* @see org.eclipse.team.ui.operations.MergeActionGroup#configureMergeAction(java.lang.String, org.eclipse.jface.action.Action)
*/
+ @Override
protected void configureMergeAction(String mergeActionId, Action action) {
if (mergeActionId == SynchronizationActionProvider.MERGE_ACTION_ID) {
Utils.initAction(action, "WorkspaceUpdateAction.", Policy.getActionBundle()); //$NON-NLS-1$
@@ -172,6 +181,7 @@ public class WorkspaceModelParticipant extends
}
}
+ @Override
protected void addToContextMenu(String mergeActionId, Action action, IMenuManager manager) {
IContributionItem group = null;;
if (mergeActionId == SynchronizationActionProvider.MERGE_ACTION_ID) {
@@ -213,6 +223,7 @@ public class WorkspaceModelParticipant extends
/* (non-Javadoc)
* @see org.eclipse.team.ui.operations.ModelSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
*/
+ @Override
protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
configuration.setProperty(ISynchronizePageConfiguration.P_VIEWER_ID, VIEWER_ID);
super.initializeConfiguration(configuration);
@@ -221,6 +232,7 @@ public class WorkspaceModelParticipant extends
/* (non-Javadoc)
* @see org.eclipse.team.ui.operations.ResourceMappingSynchronizeParticipant#createMergeActionGroup()
*/
+ @Override
protected ModelSynchronizeParticipantActionGroup createMergeActionGroup() {
return new WorkspaceMergeActionGroup();
}
@@ -228,6 +240,7 @@ public class WorkspaceModelParticipant extends
/* (non-Javadoc)
* @see org.eclipse.team.ui.operations.ModelSynchronizeParticipant#restoreContext(org.eclipse.team.core.mapping.IResourceMappingScope, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected MergeContext restoreContext(ISynchronizationScopeManager manager) {
return WorkspaceSubscriberContext.createContext(manager, ISynchronizationContext.THREE_WAY);
}
@@ -235,23 +248,27 @@ public class WorkspaceModelParticipant extends
/* (non-Javadoc)
* @see org.eclipse.team.ui.operations.ModelSynchronizeParticipant#createScopeManager(org.eclipse.core.resources.mapping.ResourceMapping[])
*/
+ @Override
protected ISynchronizationScopeManager createScopeManager(ResourceMapping[] mappings) {
return WorkspaceSubscriberContext.createWorkspaceScopeManager(mappings, true, isConsultChangeSets);
}
- public ChangeSetCapability getChangeSetCapability() {
+ @Override
+ public ChangeSetCapability getChangeSetCapability() {
if (capability == null) {
capability = new WorkspaceChangeSetCapability();
}
return capability;
}
- public void saveState(IMemento memento) {
+ @Override
+ public void saveState(IMemento memento) {
super.saveState(memento);
memento.putString(CTX_CONSULT_CHANGE_SETS, Boolean.toString(isConsultChangeSets));
}
- public void init(String secondaryId, IMemento memento) throws PartInitException {
+ @Override
+ public void init(String secondaryId, IMemento memento) throws PartInitException {
try {
String consult = memento.getString(CTX_CONSULT_CHANGE_SETS);
if (consult != null)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
index 1fe0d9932..5fbbc116e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/WorkspaceSubscriberContext.java
@@ -20,7 +20,7 @@ import java.util.List;
import org.eclipse.core.resources.*;
import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.preferences.*;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.osgi.util.NLS;
@@ -32,7 +32,8 @@ import org.eclipse.team.core.mapping.*;
import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.core.synchronize.SyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfoFilter.ContentComparisonSyncInfoFilter;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.ccvs.core.*;
@@ -59,6 +60,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
this.consultSets = consultSets;
}
+ @Override
protected ResourceTraversal[] adjustInputTraversals(ResourceTraversal[] traversals) {
if (isConsultSets())
return ((CVSActiveChangeSetCollector)CVSUIPlugin.getPlugin().getChangeSetManager()).adjustInputTraversals(traversals);
@@ -90,11 +92,13 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.SubscriberMergeContext#getDiffFilter()
*/
+ @Override
protected DiffFilter getDiffFilter() {
final DiffFilter contentFilter = createContentFilter();
final DiffFilter regexFilter = createRegexFilter();
if (contentFilter != null && regexFilter != null) {
return new DiffFilter() {
+ @Override
public boolean select(IDiff diff, IProgressMonitor monitor) {
return !contentFilter.select(diff, monitor)
&& !regexFilter.select(diff, monitor);
@@ -102,12 +106,14 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
};
} else if (contentFilter != null) {
return new DiffFilter() {
+ @Override
public boolean select(IDiff diff, IProgressMonitor monitor) {
return !contentFilter.select(diff, monitor);
}
};
} else if (regexFilter != null) {
return new DiffFilter() {
+ @Override
public boolean select(IDiff diff, IProgressMonitor monitor) {
return !regexFilter.select(diff, monitor);
}
@@ -125,6 +131,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.SubscriberMergeContext#dispose()
*/
+ @Override
public void dispose() {
super.dispose();
((IEclipsePreferences) CVSUIPlugin.getPlugin().getInstancePreferences().node("")).removePreferenceChangeListener(this); //$NON-NLS-1$
@@ -156,6 +163,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
/* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
*/
+ @Override
public void preferenceChange(PreferenceChangeEvent event) {
if (event.getKey().equals(ICVSUIConstants.PREF_CONSIDER_CONTENTS) || event.getKey().equals(ICVSUIConstants.PREF_SYNCVIEW_REGEX_FILTER_PATTERN)) {
SubscriberDiffTreeEventHandler handler = getHandler();
@@ -166,6 +174,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
}
}
+ @Override
public void markAsMerged(IDiff[] nodes, boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
if (getType() == TWO_WAY) {
// For, TWO_WAY merges (i.e. replace) should not adjust sync info
@@ -186,88 +195,86 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
}
}
+ @Override
public void markAsMerged(final IDiff diff, final boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // Get the latest sync info for the file (i.e. not what is in the set).
- // We do this because the client may have modified the file since the
- // set was populated.
- IResource resource = getDiffTree().getResource(diff);
- if (resource.getType() != IResource.FILE) {
- if (diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- if (resource.getType() == IResource.FOLDER
- && twd.getKind() == IDiff.ADD
- && twd.getDirection() == IThreeWayDiff.INCOMING
- && resource.exists()) {
- // The folder was created by merge
- SyncInfo info = getSyncInfo(resource);
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo) info;
- cvsInfo.makeInSync();
- }
+ run(monitor1 -> {
+ // Get the latest sync info for the file (i.e. not what is in the set).
+ // We do this because the client may have modified the file since the
+ // set was populated.
+ IResource resource = getDiffTree().getResource(diff);
+ if (resource.getType() != IResource.FILE) {
+ if (diff instanceof IThreeWayDiff) {
+ IThreeWayDiff twd = (IThreeWayDiff) diff;
+ if (resource.getType() == IResource.FOLDER
+ && twd.getKind() == IDiff.ADD
+ && twd.getDirection() == IThreeWayDiff.INCOMING
+ && resource.exists()) {
+ // The folder was created by merge
+ SyncInfo info1 = getSyncInfo(resource);
+ if (info1 instanceof CVSSyncInfo) {
+ CVSSyncInfo cvsInfo1 = (CVSSyncInfo) info1;
+ cvsInfo1.makeInSync();
}
}
- return;
}
- if (getType() == TWO_WAY) {
- // For, TWO_WAY merges (i.e. replace) should not adjust sync info
- // but should remove the node from the tree so that other models do
- // not modify the file
- ((DiffTree)getDiffTree()).remove(diff.getPath());
- } else {
- SyncInfo info = getSyncInfo(resource);
- ensureRemotesMatch(resource, diff, info);
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo) info;
- monitor.beginTask(null, 50 + (inSyncHint ? 100 : 0));
- cvsInfo.makeOutgoing(Policy.subMonitorFor(monitor, 50));
- if (inSyncHint) {
- // Compare the contents of the file with the remote
- // and make the file in-sync if they match
- ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
- if (resource.getType() == IResource.FILE && info.getRemote() != null) {
- if (comparator.compareContents((IFile)resource, info.getRemote(), Policy.subMonitorFor(monitor, 100))) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- cvsFile.checkedIn(null, false /* not a commit */);
- }
+ return;
+ }
+ if (getType() == TWO_WAY) {
+ // For, TWO_WAY merges (i.e. replace) should not adjust sync info
+ // but should remove the node from the tree so that other models do
+ // not modify the file
+ ((DiffTree)getDiffTree()).remove(diff.getPath());
+ } else {
+ SyncInfo info2 = getSyncInfo(resource);
+ ensureRemotesMatch(resource, diff, info2);
+ if (info2 instanceof CVSSyncInfo) {
+ CVSSyncInfo cvsInfo2 = (CVSSyncInfo) info2;
+ monitor1.beginTask(null, 50 + (inSyncHint ? 100 : 0));
+ cvsInfo2.makeOutgoing(Policy.subMonitorFor(monitor1, 50));
+ if (inSyncHint) {
+ // Compare the contents of the file with the remote
+ // and make the file in-sync if they match
+ ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
+ if (resource.getType() == IResource.FILE && info2.getRemote() != null) {
+ if (comparator.compareContents((IFile)resource, info2.getRemote(), Policy.subMonitorFor(monitor1, 100))) {
+ ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
+ cvsFile.checkedIn(null, false /* not a commit */);
}
}
- monitor.done();
}
+ monitor1.done();
}
}
}, getMergeRule(diff), IResource.NONE, monitor);
}
+ @Override
protected void makeInSync(final IDiff diff, IProgressMonitor monitor) throws CoreException {
- run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // Get the latest sync info for the file (i.e. not what is in the set).
- // We do this because the client may have modified the file since the
- // set was populated.
- IResource resource = getDiffTree().getResource(diff);
- if (resource.getType() != IResource.FILE)
- return;
- SyncInfo info = getSyncInfo(resource);
- ensureRemotesMatch(resource, diff, info);
- IResourceVariant remote = info.getRemote();
- RemoteFile file = (RemoteFile)remote;
- if (file != null)
- remote = file.getCachedHandle();
-
- if (info instanceof CVSSyncInfo) {
- CVSSyncInfo cvsInfo = (CVSSyncInfo) info;
- cvsInfo.makeOutgoing(monitor);
- if (resource.getType() == IResource.FILE && info.getRemote() != null) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- if (remote != null && remote instanceof RemoteFile){
- cvsFile.setExecutable(((RemoteFile)remote).isExecutable());
- cvsFile.setTimeStamp(((RemoteFile) remote).getTimeStamp());
- cvsFile.setReadOnly(getReadOnly(cvsFile));
- }
- cvsFile.checkedIn(null , false /* not a commit */);
+ run(monitor1 -> {
+ // Get the latest sync info for the file (i.e. not what is in the set).
+ // We do this because the client may have modified the file since the
+ // set was populated.
+ IResource resource = getDiffTree().getResource(diff);
+ if (resource.getType() != IResource.FILE)
+ return;
+ SyncInfo info = getSyncInfo(resource);
+ ensureRemotesMatch(resource, diff, info);
+ IResourceVariant remote = info.getRemote();
+ RemoteFile file = (RemoteFile)remote;
+ if (file != null)
+ remote = file.getCachedHandle();
+
+ if (info instanceof CVSSyncInfo) {
+ CVSSyncInfo cvsInfo = (CVSSyncInfo) info;
+ cvsInfo.makeOutgoing(monitor1);
+ if (resource.getType() == IResource.FILE && info.getRemote() != null) {
+ ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
+ if (remote != null && remote instanceof RemoteFile){
+ cvsFile.setExecutable(((RemoteFile)remote).isExecutable());
+ cvsFile.setTimeStamp(((RemoteFile) remote).getTimeStamp());
+ cvsFile.setReadOnly(getReadOnly(cvsFile));
}
+ cvsFile.checkedIn(null , false /* not a commit */);
}
}
}, getMergeRule(diff), IResource.NONE, monitor);
@@ -315,6 +322,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
/* (non-Javadoc)
* @see org.eclipse.team.core.mapping.MergeContext#merge(org.eclipse.team.core.diff.IDiffNode, boolean, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public IStatus merge(IDiff delta, boolean force, IProgressMonitor monitor) throws CoreException {
if (getMergeType() == ISynchronizationContext.TWO_WAY) {
force = true;
@@ -369,6 +377,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
/* (non-Javadoc)
* @see org.eclipse.team.core.mapping.provider.MergeContext#getMergeType()
*/
+ @Override
public int getMergeType() {
return type;
}
@@ -376,6 +385,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.SubscriberMergeContext#refresh(org.eclipse.core.resources.mapping.ResourceTraversal[], int, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void refresh(final ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException {
SubscriberDiffTreeEventHandler handler = getHandler();
if (handler != null) {
@@ -384,18 +394,10 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
handler.setProgressGroupHint(group.getGroup(), group.getTicks());
handler.initializeIfNeeded();
((CVSWorkspaceSubscriber)getSubscriber()).refreshWithContentFetch(traversals, monitor);
- runInBackground(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- cacheContents(traversals, getDiffTree(), true, monitor);
- }
- });
+ runInBackground(monitor1 -> cacheContents(traversals, getDiffTree(), true, monitor1));
} else {
super.refresh(traversals, flags, monitor);
- runInBackground(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- cacheContents(traversals, getDiffTree(), false, monitor);
- }
- });
+ runInBackground(monitor1 -> cacheContents(traversals, getDiffTree(), false, monitor1));
}
}
@@ -416,18 +418,23 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
// OPTIMIZE: remote state and contents could be obtained in 1
// OPTIMIZE: Based could be avoided if we always cached base locally
ResourceMapping[] mappings = new ResourceMapping[] { new ResourceMapping() {
+ @Override
public Object getModelObject() {
return WorkspaceSubscriberContext.this;
}
+ @Override
public IProject[] getProjects() {
return ResourcesPlugin.getWorkspace().getRoot().getProjects();
}
+ @Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
return traversals;
}
- public boolean contains(ResourceMapping mapping) {
+ @Override
+ public boolean contains(ResourceMapping mapping) {
return false;
}
+ @Override
public String getModelProviderId() {
return ModelProvider.RESOURCE_MODEL_PROVIDER_ID;
}
@@ -447,6 +454,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
}
}
+ @Override
public IStatus merge(IDiff[] deltas, boolean force, IProgressMonitor monitor) throws CoreException {
try {
if (deltas.length == 0)
@@ -497,6 +505,7 @@ public class WorkspaceSubscriberContext extends CVSSubscriberMergeContext implem
return tree;
}
+ @Override
protected void performReplace(IDiff diff, IProgressMonitor monitor) throws CoreException {
IResource resource = ResourceDiffTree.getResourceFor(diff);
if (resource.getType() == IResource.FILE){
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
index ca730811d..a63d91f58 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSRemoteFilePropertySource.java
@@ -16,17 +16,11 @@ package org.eclipse.team.internal.ccvs.ui.model;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.ui.*;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.eclipse.ui.views.properties.*;
public class CVSRemoteFilePropertySource implements IPropertySource {
ICVSRemoteFile file;
@@ -76,6 +70,7 @@ public class CVSRemoteFilePropertySource implements IPropertySource {
/**
* Do nothing because properties are read only.
*/
+ @Override
public Object getEditableValue() {
return this;
}
@@ -83,6 +78,7 @@ public class CVSRemoteFilePropertySource implements IPropertySource {
/**
* Return the Property Descriptors for the receiver.
*/
+ @Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return propertyDescriptors;
}
@@ -90,6 +86,7 @@ public class CVSRemoteFilePropertySource implements IPropertySource {
/*
* @see IPropertySource#getPropertyValue(Object)
*/
+ @Override
public Object getPropertyValue(Object id) {
if (!initialized) {
initialize();
@@ -119,6 +116,7 @@ public class CVSRemoteFilePropertySource implements IPropertySource {
* Answer true if the value of the specified property
* for this object has been changed from the default.
*/
+ @Override
public boolean isPropertySet(Object property) {
return false;
}
@@ -128,30 +126,30 @@ public class CVSRemoteFilePropertySource implements IPropertySource {
*
* @param property The property to reset.
*/
+ @Override
public void resetPropertyValue(Object property) {
}
/**
* Do nothing because properties are read only.
*/
+ @Override
public void setPropertyValue(Object name, Object value) {
}
private void initialize() {
try {
- CVSUIPlugin.runWithProgress(null, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ILogEntry[] entries = file.getLogEntries(monitor);
- String revision = file.getRevision();
- for (int i = 0; i < entries.length; i++) {
- if (entries[i].getRevision().equals(revision)) {
- entry = entries[i];
- return;
- }
+ CVSUIPlugin.runWithProgress(null, true /* cancelable */, monitor -> {
+ try {
+ ILogEntry[] entries = file.getLogEntries(monitor);
+ String revision = file.getRevision();
+ for (int i = 0; i < entries.length; i++) {
+ if (entries[i].getRevision().equals(revision)) {
+ entry = entries[i];
+ return;
}
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
}
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InterruptedException e) { // ignore cancellation
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
index 4442e49c5..c01cc73b8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
@@ -18,18 +18,18 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.*;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
+import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.*;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
@@ -59,16 +59,14 @@ public class BranchOperation extends RepositoryProviderOperation {
/* (non-Javadoc)
* @see org.eclipse.team.ui.TeamOperation#shouldRun()
*/
+ @Override
protected boolean shouldRun() {
try {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- buildScope(monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ buildScope(monitor);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e1) {
@@ -116,6 +114,7 @@ public class BranchOperation extends RepositoryProviderOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected void execute(CVSTeamProvider provider, IResource[] providerResources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
try {
monitor.beginTask(null, 100);
@@ -215,41 +214,47 @@ public class BranchOperation extends RepositoryProviderOperation {
* It expects to be passed an InfiniteSubProgressMonitor
*/
private void setTag(final CVSTeamProvider provider, final IResource[] resources, final CVSTag tag, final boolean recurse, IProgressMonitor monitor) throws TeamException {
- getLocalRoot(provider).run(new ICVSRunnable() {
- public void run(IProgressMonitor progress) throws CVSException {
- try {
- // 512 ticks gives us a maximum of 2048 which seems reasonable for folders and files in a project
- progress.beginTask(null, 100);
- final IProgressMonitor monitor = Policy.infiniteSubMonitorFor(progress, 100);
- monitor.beginTask(NLS.bind(CVSUIMessages.CVSTeamProvider_folderInfo, new String[] { provider.getProject().getName() }), 512);
-
- // Visit all the children folders in order to set the root in the folder sync info
- for (int i = 0; i < resources.length; i++) {
- CVSWorkspaceRoot.getCVSResourceFor(resources[i]).accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {
- monitor.worked(1);
- //ResourceSyncInfo info = file.getSyncInfo();
- byte[] syncBytes = file.getSyncBytes();
- if (syncBytes != null) {
- monitor.subTask(NLS.bind(CVSUIMessages.CVSTeamProvider_updatingFile, new String[] { file.getName() }));
- file.setSyncBytes(ResourceSyncInfo.setTag(syncBytes, tag), ICVSFile.UNKNOWN);
- }
+ getLocalRoot(provider).run(progress -> {
+ try {
+ // 512 ticks gives us a maximum of 2048 which seems reasonable for folders and
+ // files in a project
+ progress.beginTask(null, 100);
+ final IProgressMonitor monitor1 = Policy.infiniteSubMonitorFor(progress, 100);
+ monitor1.beginTask(NLS.bind(CVSUIMessages.CVSTeamProvider_folderInfo,
+ new String[] { provider.getProject().getName() }), 512);
+
+ // Visit all the children folders in order to set the root in the folder sync
+ // info
+ for (int i = 0; i < resources.length; i++) {
+ CVSWorkspaceRoot.getCVSResourceFor(resources[i]).accept(new ICVSResourceVisitor() {
+ @Override
+ public void visitFile(ICVSFile file) throws CVSException {
+ monitor1.worked(1);
+ // ResourceSyncInfo info = file.getSyncInfo();
+ byte[] syncBytes = file.getSyncBytes();
+ if (syncBytes != null) {
+ monitor1.subTask(NLS.bind(CVSUIMessages.CVSTeamProvider_updatingFile,
+ new String[] { file.getName() }));
+ file.setSyncBytes(ResourceSyncInfo.setTag(syncBytes, tag), ICVSFile.UNKNOWN);
}
- public void visitFolder(ICVSFolder folder) throws CVSException {
- monitor.worked(1);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- if (info != null) {
- monitor.subTask(NLS.bind(CVSUIMessages.CVSTeamProvider_updatingFolder, new String[] { info.getRepository() }));
- MutableFolderSyncInfo newInfo = info.cloneMutable();
- newInfo.setTag(tag);
- folder.setFolderSyncInfo(newInfo);
- }
+ }
+
+ @Override
+ public void visitFolder(ICVSFolder folder) throws CVSException {
+ monitor1.worked(1);
+ FolderSyncInfo info = folder.getFolderSyncInfo();
+ if (info != null) {
+ monitor1.subTask(NLS.bind(CVSUIMessages.CVSTeamProvider_updatingFolder,
+ new String[] { info.getRepository() }));
+ MutableFolderSyncInfo newInfo = info.cloneMutable();
+ newInfo.setTag(tag);
+ folder.setFolderSyncInfo(newInfo);
}
- }, recurse);
- }
- } finally {
- progress.done();
+ }
+ }, recurse);
}
+ } finally {
+ progress.done();
}
}, monitor);
}
@@ -273,6 +278,7 @@ public class BranchOperation extends RepositoryProviderOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
*/
+ @Override
protected String getTaskName() {
return CVSUIMessages.BranchOperation_0;
}
@@ -280,6 +286,7 @@ public class BranchOperation extends RepositoryProviderOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
*/
+ @Override
protected String getTaskName(CVSTeamProvider provider) {
return NLS.bind(CVSUIMessages.BranchOperation_1, new String[] { provider.getProject().getName() });
}
@@ -341,6 +348,7 @@ public class BranchOperation extends RepositoryProviderOperation {
return versionName;
}
+ @Override
protected boolean isReportableError(IStatus status) {
return super.isReportableError(status)
|| status.getCode() == CVSStatus.TAG_ALREADY_EXISTS;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
index 7be70be84..2e3988729 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CacheBaseContentsOperation.java
@@ -47,6 +47,7 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#getRemoteFileState(org.eclipse.team.core.diff.IThreeWayDiff)
*/
+ @Override
protected IFileRevision getRemoteFileState(IThreeWayDiff twd) {
IResourceDiff diff = (IResourceDiff)twd.getRemoteChange();
if (diff == null)
@@ -58,6 +59,7 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#isEnabledForDirection(int)
*/
+ @Override
protected boolean isEnabledForDirection(int direction) {
return true;
}
@@ -65,10 +67,12 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#buildTree(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
*/
+ @Override
protected ICVSRemoteResource buildTree(CVSTeamProvider provider) throws TeamException {
return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().buildBaseTree(provider.getProject(), true, new NullProgressMonitor());
}
+ @Override
protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException {
IResource[] localChanges = getFilesWithLocalChanges(resources, recurse);
super.execute(provider, resources, recurse, monitor);
@@ -105,21 +109,21 @@ public class CacheBaseContentsOperation extends CacheTreeContentsOperation {
private void performCleanTimestamps(IProject project, final IResource[] resources, IProgressMonitor monitor) throws CVSException {
ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
final ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
- folder.run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, resources.length * 100);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (resource.exists() && resource.getType() == IResource.FILE) {
- IResourceVariant remoteResource = (IResourceVariant)CVSWorkspaceRoot.getRemoteResourceFor(resource);
- if (remoteResource != null && comparator.compareContents((IFile)resource, remoteResource, Policy.subMonitorFor(monitor, 100))) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- cvsFile.checkedIn(null, false /* not a commit */);
- }
+ folder.run(monitor1 -> {
+ monitor1.beginTask(null, resources.length * 100);
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if (resource.exists() && resource.getType() == IResource.FILE) {
+ IResourceVariant remoteResource = (IResourceVariant) CVSWorkspaceRoot
+ .getRemoteResourceFor(resource);
+ if (remoteResource != null && comparator.compareContents((IFile) resource, remoteResource,
+ Policy.subMonitorFor(monitor1, 100))) {
+ ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
+ cvsFile.checkedIn(null, false /* not a commit */);
}
}
- monitor.done();
}
+ monitor1.done();
}, Policy.subMonitorFor(monitor, 100));
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
index cadf5b8fb..23770afdc 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
@@ -13,10 +13,7 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.operations;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
@@ -30,7 +27,7 @@ import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.ui.IWorkbenchPart;
@@ -67,6 +64,7 @@ public class CheckoutIntoOperation extends CheckoutOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#getTaskName()
*/
+ @Override
protected String getTaskName() {
ICVSRemoteFolder[] remoteFolders = getRemoteFolders();
String localFolderName = ""; //$NON-NLS-1$
@@ -91,6 +89,7 @@ public class CheckoutIntoOperation extends CheckoutOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected IStatus checkout(final ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException {
final IStatus[] result = new IStatus[] { null };
try {
@@ -100,11 +99,8 @@ public class CheckoutIntoOperation extends CheckoutOperation {
// orphaned (i.e. unmanaged) subtrees and we will
// purposely create some which we subsequently manage
// from their parent (see manageFolders())
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- result[0] = checkout(folder, getLocalFolder(), isRecursive(), monitor);
- }
- }, getSchedulingRule(), 0, monitor);
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor1 -> result[0] = checkout(folder,
+ getLocalFolder(), isRecursive(), monitor1), getSchedulingRule(), 0, monitor);
} catch (CoreException e) {
result[0] = CVSException.wrapException(e).getStatus();
}
@@ -114,18 +110,17 @@ public class CheckoutIntoOperation extends CheckoutOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CheckoutOperation#checkout(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder[], org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected void checkout(final ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException {
// Batch sync info changes with the CVS synchronizer to optimize cache writing
- EclipseSynchronizer.getInstance().run(getSchedulingRule(), new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, 100);
- try {
- // Obtain a scheduling rule on the projects were about to overwrite
- CheckoutIntoOperation.super.checkout(folders, Policy.subMonitorFor(monitor, 90));
- refreshRoot(getLocalRoot(getLocalFolder()), Policy.subMonitorFor(monitor, 10));
- } finally {
- monitor.done();
- }
+ EclipseSynchronizer.getInstance().run(getSchedulingRule(), monitor1 -> {
+ monitor1.beginTask(null, 100);
+ try {
+ // Obtain a scheduling rule on the projects were about to overwrite
+ CheckoutIntoOperation.super.checkout(folders, Policy.subMonitorFor(monitor1, 90));
+ refreshRoot(getLocalRoot(getLocalFolder()), Policy.subMonitorFor(monitor1, 10));
+ } finally {
+ monitor1.done();
}
}, Policy.monitorFor(monitor));
}
@@ -252,9 +247,11 @@ public class CheckoutIntoOperation extends CheckoutOperation {
ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(root);
try {
cvsFolder.accept(new ICVSResourceVisitor() {
+ @Override
public void visitFile(ICVSFile file) throws CVSException {
// do nothing
}
+ @Override
public void visitFolder(ICVSFolder folder) throws CVSException {
if (!folder.isCVSFolder()) return;
IResource resource = folder.getIResource();
@@ -428,6 +425,7 @@ public class CheckoutIntoOperation extends CheckoutOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getSchedulingRule()
*/
+ @Override
protected ISchedulingRule getSchedulingRule() {
//use the modfiy rule for the time being
//TODO: Just lock the project not the entire workspace (so can't use modifyRule)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
index f22a54b38..cdfc3aff5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
@@ -30,7 +30,8 @@ import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ui.wizards.WorkingSetsDialog;
import org.eclipse.ui.*;
@@ -160,20 +161,17 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
try {
Job.getJobManager().beginRule(schedulingRule, pm);
// Still use the projects as the inner rule so we get the proper batching of sync info write
- EclipseSynchronizer.getInstance().run(MultiRule.combine(targetProjects), new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- result[0] = performCheckout(session, resource, targetProjects, sendModuleName, monitor);
- }
- }, Policy.subMonitorFor(pm, 90));
+ EclipseSynchronizer
+ .getInstance().run(
+ MultiRule.combine(targetProjects), monitor -> result[0] = performCheckout(session,
+ resource, targetProjects, sendModuleName, monitor),
+ Policy.subMonitorFor(pm, 90));
} finally {
Job.getJobManager().endRule(schedulingRule);
}
} else {
- EclipseSynchronizer.getInstance().run(schedulingRule, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- result[0] = performCheckout(session, resource, targetProjects, sendModuleName, monitor);
- }
- }, Policy.subMonitorFor(pm, 90));
+ EclipseSynchronizer.getInstance().run(schedulingRule, monitor -> result[0] = performCheckout(session,
+ resource, targetProjects, sendModuleName, monitor), Policy.subMonitorFor(pm, 90));
}
IWorkingSet[] ws = getWorkingSets();
if (ws != null) {
@@ -504,6 +502,7 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
}
}
+ @Override
protected String getTaskName() {
ICVSRemoteFolder[] remoteFolders = getRemoteFolders();
if (remoteFolders.length == 1) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ClipboardDiffOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ClipboardDiffOperation.java
index 5b2800ce1..1fc4c9e50 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ClipboardDiffOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ClipboardDiffOperation.java
@@ -17,7 +17,8 @@ import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.dnd.*;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
@@ -34,6 +35,7 @@ public class ClipboardDiffOperation extends DiffOperation {
super(part, mappings, options, isMultiPatch, includeFullPathInformation, patchRoot, DESTINATION_CLIPBOARD);
}
+ @Override
public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
super.execute(monitor);
@@ -46,21 +48,18 @@ public class ClipboardDiffOperation extends DiffOperation {
}
private void copyToClipboard(final ByteArrayOutputStream baos) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- TextTransfer plainTextTransfer = TextTransfer.getInstance();
- Clipboard clipboard = new Clipboard(getShell().getDisplay());
- clipboard.setContents(
- new String[]{baos.toString()},
- new Transfer[]{plainTextTransfer});
- clipboard.dispose();
- }
- });
+ getShell().getDisplay().syncExec(() -> {
+ TextTransfer plainTextTransfer = TextTransfer.getInstance();
+ Clipboard clipboard = new Clipboard(getShell().getDisplay());
+ clipboard.setContents(new String[] { baos.toString() }, new Transfer[] { plainTextTransfer });
+ clipboard.dispose();
+ });
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.DiffOperation#openStream()
*/
+ @Override
protected PrintStream openStream() {
return new PrintStream(os);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java
index 022e4204a..cb531e0dd 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/FetchAllMembersOperation.java
@@ -114,6 +114,7 @@ public class FetchAllMembersOperation extends RemoteOperation {
this.repoLocation = repoLocation;
}
+ @Override
protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
//expand each folder selected in the tree
ICVSRemoteResource[] restest = getRemoteResources();
@@ -163,11 +164,8 @@ public class FetchAllMembersOperation extends RemoteOperation {
prov.addCachedTree(project, remoteTree);
final TreeViewer tree = repView.getViewer();
- Utils.asyncExec( new Runnable() {
- public void run() {
- tree.expandToLevel(project, AbstractTreeViewer.ALL_LEVELS);
- }
- }, repView.getViewer());
+ Utils.asyncExec((Runnable) () -> tree.expandToLevel(project, AbstractTreeViewer.ALL_LEVELS),
+ repView.getViewer());
}
} catch (InvocationTargetException e) {
@@ -195,6 +193,7 @@ public class FetchAllMembersOperation extends RemoteOperation {
}
}
+ @Override
protected String getTaskName() {
return CVSUIMessages.FetchAllMembersOperation_0;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
index fa78fba12..b4ea0683e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReconcileProjectOperation.java
@@ -27,7 +27,7 @@ import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -47,6 +47,7 @@ public class ReconcileProjectOperation extends ShareProjectOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
*/
+ @Override
protected String getTaskName() {
return NLS.bind(CVSUIMessages.ReconcileProjectOperation_0, new String[] { getProject().getName(), folder.getRepositoryRelativePath() });
}
@@ -54,6 +55,7 @@ public class ReconcileProjectOperation extends ShareProjectOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.ShareProjectOperation#createRemoteFolder(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected ICVSRemoteFolder createRemoteFolder(IProgressMonitor monitor) throws CVSException {
// The folder already exists so just return the handle
return folder;
@@ -62,6 +64,7 @@ public class ReconcileProjectOperation extends ShareProjectOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.ShareProjectOperation#mapProjectToRemoteFolder(org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected void mapProjectToRemoteFolder(ICVSRemoteFolder remote, IProgressMonitor monitor) throws TeamException {
// Map the project
monitor.beginTask(null, 100);
@@ -95,11 +98,8 @@ public class ReconcileProjectOperation extends ShareProjectOperation {
}
private void populateWorkspace(final ICVSRemoteFolder remote, IProgressMonitor monitor) throws CVSException {
- CVSWorkspaceRoot.getCVSFolderFor(getProject()).run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- populateWorkspace(getProject(), remote, monitor);
- }
- }, monitor);
+ CVSWorkspaceRoot.getCVSFolderFor(getProject())
+ .run(monitor1 -> populateWorkspace(getProject(), remote, monitor1), monitor);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java
index c68d8ca0f..b5eab3267 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/RemoteCompareOperation.java
@@ -13,11 +13,7 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.operations;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import org.eclipse.compare.CompareUI;
import org.eclipse.core.runtime.*;
@@ -95,12 +91,8 @@ public class RemoteCompareOperation extends RemoteOperation {
*/
public void openCompareEditor(final IWorkbenchPage page, final String title, final String toolTip) {
if (leftTree == null || rightTree == null) return;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- CompareUI.openCompareEditorOnPage(
- new CVSCompareEditorInput(title, toolTip, new ResourceEditionNode(leftTree), new ResourceEditionNode(rightTree)), page);
- }
- });
+ Display.getDefault().asyncExec(() -> CompareUI.openCompareEditorOnPage(new CVSCompareEditorInput(title,
+ toolTip, new ResourceEditionNode(leftTree), new ResourceEditionNode(rightTree)), page));
}
/**
@@ -177,6 +169,7 @@ public class RemoteCompareOperation extends RemoteOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#fileDiff(java.lang.String, java.lang.String, java.lang.String)
*/
+ @Override
public void fileDiff(String remoteFilePath, String leftRevision, String rightRevision) {
try {
addFile(rightTree, right, new Path(null, remoteFilePath), rightRevision);
@@ -193,6 +186,7 @@ public class RemoteCompareOperation extends RemoteOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#newFile(java.lang.String, java.lang.String)
*/
+ @Override
public void newFile(String remoteFilePath, String rightRevision) {
try {
addFile(rightTree, right, new Path(null, remoteFilePath), rightRevision);
@@ -204,6 +198,7 @@ public class RemoteCompareOperation extends RemoteOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#deletedFile(java.lang.String)
*/
+ @Override
public void deletedFile(String remoteFilePath, String leftRevision) {
// The leftRevision may be null in which case the tag is used
try {
@@ -216,6 +211,7 @@ public class RemoteCompareOperation extends RemoteOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.core.client.listeners.RDiffSummaryListener.IFileDiffListener#directory(java.lang.String)
*/
+ @Override
public void directory(String remoteFolderPath) {
try {
getFolder(leftTree, left, new Path(null, remoteFolderPath), Path.EMPTY);
@@ -331,6 +327,7 @@ public class RemoteCompareOperation extends RemoteOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected void execute(IProgressMonitor monitor) throws CVSException {
boolean fetchContents = CVSUIPlugin.getPlugin().getPluginPreferences().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS);
monitor.beginTask(getTaskName(), 50 + (fetchContents ? 100 : 0));
@@ -390,6 +387,7 @@ public class RemoteCompareOperation extends RemoteOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
*/
+ @Override
protected String getTaskName() {
return NLS.bind(CVSUIMessages.RemoteCompareOperation_0, (new Object[] {left.getName(), right.getName(), getRemoteResource().getRepositoryRelativePath()}));
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java
index 737cf1f20..2c6ee8083 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ReplaceOperation.java
@@ -23,11 +23,12 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.client.*;
+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.PrepareForReplaceVisitor;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter;
@@ -49,6 +50,7 @@ public class ReplaceOperation extends UpdateOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
*/
+ @Override
protected String getTaskName() {
return CVSUIMessages.ReplaceOperation_taskName;
}
@@ -56,6 +58,7 @@ public class ReplaceOperation extends UpdateOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected IStatus executeCommand(
final Session session,
final CVSTeamProvider provider,
@@ -65,16 +68,13 @@ public class ReplaceOperation extends UpdateOperation {
final IStatus[] status = new IStatus[] { Status.OK_STATUS };
try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- status[0] = internalExecuteCommand(session, provider, resources, recurse, monitor);
- } catch (InterruptedException e) {
- throw new OperationCanceledException();
- }
- }
-
- }, null, IWorkspace.AVOID_UPDATE, monitor);
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor1 -> {
+ try {
+ status[0] = internalExecuteCommand(session, provider, resources, recurse, monitor1);
+ } catch (InterruptedException e) {
+ throw new OperationCanceledException();
+ }
+ }, null, IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
throw CVSException.wrapException(e);
}
@@ -189,6 +189,7 @@ public class ReplaceOperation extends UpdateOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation#getUpdateCommand()
*/
+ @Override
protected Update getUpdateCommand() {
// Use a special replace command that doesn't set back the timestamps
// of files in the passed set if it recreates them.
@@ -198,6 +199,7 @@ public class ReplaceOperation extends UpdateOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
*/
+ @Override
protected String getTaskName(CVSTeamProvider provider) {
return NLS.bind(CVSUIMessages.ReplaceOperation_0, new String[] { provider.getProject().getName() });
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
index c23d0bea4..ef21ca0be 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShareProjectOperation.java
@@ -25,7 +25,8 @@ import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
/**
@@ -49,6 +50,7 @@ public class ShareProjectOperation extends CVSOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
try {
monitor.beginTask(getTaskName(), 100);
@@ -56,13 +58,11 @@ public class ShareProjectOperation extends CVSOperation {
final ICVSRemoteFolder remote = createRemoteFolder(Policy.subMonitorFor(monitor, 50));
// Map the project to the module in a workspace runnable
final TeamException[] exception = new TeamException[] {null};
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- mapProjectToRemoteFolder(remote, monitor);
- } catch (TeamException e) {
- exception[0] = e;
- }
+ ResourcesPlugin.getWorkspace().run((IWorkspaceRunnable) monitor1 -> {
+ try {
+ mapProjectToRemoteFolder(remote, monitor1);
+ } catch (TeamException e) {
+ exception[0] = e;
}
}, ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(project), 0, Policy.subMonitorFor(monitor, 100));
if (exception[0] != null)
@@ -169,6 +169,7 @@ public class ShareProjectOperation extends CVSOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
*/
+ @Override
protected String getTaskName() {
return NLS.bind(CVSUIMessages.ShareProjectOperation_0, new String[] { project.getName(), moduleName });
}
@@ -183,6 +184,7 @@ public class ShareProjectOperation extends CVSOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getShell()
*/
+ @Override
public Shell getShell() {
return shell;
}
@@ -197,9 +199,11 @@ public class ShareProjectOperation extends CVSOperation {
monitor.beginTask(null, IProgressMonitor.UNKNOWN);
ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
folder.accept(new ICVSResourceVisitor() {
+ @Override
public void visitFile(ICVSFile file) throws CVSException {
// nothing to do for files
}
+ @Override
public void visitFolder(ICVSFolder folder) throws CVSException {
monitor.subTask(NLS.bind(CVSUIMessages.ShareProjectOperation_2, new String[] { folder.getIResource().getFullPath().toString() } ));
if (folder.isCVSFolder()) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
index 9d7808fc5..3a9518101 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/ShowAnnotationOperation.java
@@ -72,7 +72,8 @@ public class ShowAnnotationOperation extends CVSOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
- protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
+ @Override
+ protected void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
monitor.beginTask(null, 100);
@@ -85,20 +86,18 @@ public class ShowAnnotationOperation extends CVSOperation {
// Open the view and display it from the UI thread.
final Display display= getPart().getSite().getShell().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- try {
- //is there an open editor for the given input? If yes, use live annotate
- final AbstractDecoratedTextEditor editor= getEditor(listener);
- if (editor != null) {
- editor.showRevisionInformation(information, "org.eclipse.quickdiff.providers.CVSReferenceProvider"); //$NON-NLS-1$
- final IWorkbenchPage page= getPart().getSite().getPage();
- showHistoryView(page, editor);
- page.activate(editor);
- }
- } catch (PartInitException e) {
- CVSException.wrapException(e);
+ display.asyncExec(() -> {
+ try {
+ // is there an open editor for the given input? If yes, use live annotate
+ final AbstractDecoratedTextEditor editor = getEditor(listener);
+ if (editor != null) {
+ editor.showRevisionInformation(information, "org.eclipse.quickdiff.providers.CVSReferenceProvider"); //$NON-NLS-1$
+ final IWorkbenchPage page = getPart().getSite().getPage();
+ showHistoryView(page, editor);
+ page.activate(editor);
}
+ } catch (PartInitException e) {
+ CVSException.wrapException(e);
}
});
@@ -132,7 +131,8 @@ public class ShowAnnotationOperation extends CVSOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
*/
- protected String getTaskName() {
+ @Override
+ protected String getTaskName() {
return CVSUIMessages.ShowAnnotationOperation_taskName;
}
@@ -218,19 +218,18 @@ public class ShowAnnotationOperation extends CVSOperation {
this.isResizable= isResizable;
}
+ @Override
public IInformationControl createInformationControl(Shell parent) {
- IInformationPresenter presenter= new IInformationPresenter() {
- public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight) {
-
- // decorate header
- StyleRange styleRange = new StyleRange();
- styleRange.start = 0;
- styleRange.length = hoverInfo.indexOf('\n');
- styleRange.fontStyle = SWT.BOLD;
- presentation.addStyleRange(styleRange);
-
- return hoverInfo;
- }
+ IInformationPresenter presenter = (display, hoverInfo, presentation, maxWidth, maxHeight) -> {
+
+ // decorate header
+ StyleRange styleRange = new StyleRange();
+ styleRange.start = 0;
+ styleRange.length = hoverInfo.indexOf('\n');
+ styleRange.fontStyle = SWT.BOLD;
+ presentation.addStyleRange(styleRange);
+
+ return hoverInfo;
};
if (isResizable)
return new DefaultInformationControl(parent, (ToolBarManager) null, presenter);
@@ -256,6 +255,7 @@ public class ShowAnnotationOperation extends CVSOperation {
revision= new Revision() {
private String fCommitter= null;
+ @Override
public Object getHoverInfo() {
return entry.getAuthor()
+ " " + entry.getRevision() + " " + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(entry.getDate()) //$NON-NLS-1$ //$NON-NLS-2$
@@ -268,18 +268,22 @@ public class ShowAnnotationOperation extends CVSOperation {
return fCommitter;
}
+ @Override
public String getId() {
return revisionString;
}
+ @Override
public Date getDate() {
return entry.getDate();
}
+ @Override
public RGB getColor() {
return colors.getCommitterRGB(getCommitterId());
}
+ @Override
public String getAuthor() {
return getCommitterId();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java
index aefa2f5a6..9fac87af9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/AddToBranchAction.java
@@ -15,7 +15,8 @@ package org.eclipse.team.internal.ccvs.ui.repo;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
@@ -32,46 +33,45 @@ import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
*/
public class AddToBranchAction extends CVSAction {
- IInputValidator validator = new IInputValidator() {
- public String isValid(String newText) {
- IStatus status = CVSTag.validateTagName(newText);
- if (status.isOK()) return null;
- return status.getMessage();
- }
+ IInputValidator validator = newText -> {
+ IStatus status = CVSTag.validateTagName(newText);
+ if (status.isOK())
+ return null;
+ return status.getMessage();
};
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
*/
+ @Override
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- final ICVSRemoteFolder folder = getSelectedRootFolder();
- if (folder == null) return;
- Shell shell = getShell();
- final CVSException[] exception = new CVSException[] { null };
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- InputDialog dialog = new InputDialog(getShell(), CVSUIMessages.AddToBranchAction_enterTag, CVSUIMessages.AddToBranchAction_enterTagLong, null, validator); //
- if (dialog.open() == Window.OK) {
- CVSTag tag = new CVSTag(dialog.getValue(), CVSTag.BRANCH);
- try {
- CVSUIPlugin.getPlugin().getRepositoryManager().addTags(folder, new CVSTag[] {tag});
- } catch (CVSException e) {
- exception[0] = e;
- }
- }
+ run((IRunnableWithProgress) monitor -> {
+ final ICVSRemoteFolder folder = getSelectedRootFolder();
+ if (folder == null)
+ return;
+ Shell shell = getShell();
+ final CVSException[] exception = new CVSException[] { null };
+ shell.getDisplay().syncExec(() -> {
+ InputDialog dialog = new InputDialog(getShell(), CVSUIMessages.AddToBranchAction_enterTag,
+ CVSUIMessages.AddToBranchAction_enterTagLong, null, validator); //
+ if (dialog.open() == Window.OK) {
+ CVSTag tag = new CVSTag(dialog.getValue(), CVSTag.BRANCH);
+ try {
+ CVSUIPlugin.getPlugin().getRepositoryManager().addTags(folder, new CVSTag[] { tag });
+ } catch (CVSException e) {
+ exception[0] = e;
}
- });
- if (exception[0] != null)
- throw new InvocationTargetException(exception[0]);
- }
+ }
+ });
+ if (exception[0] != null)
+ throw new InvocationTargetException(exception[0]);
}, false, PROGRESS_BUSYCURSOR);
}
/**
* @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
return getSelectedRootFolder() != null;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java
index 24896e0fb..50c3d52c8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RefreshRemoteProjectWizard.java
@@ -20,7 +20,6 @@ import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.Wizard;
@@ -50,13 +49,12 @@ public class RefreshRemoteProjectWizard extends Wizard {
final ICVSRemoteResource[][] rootFolders = new ICVSRemoteResource[1][0];
rootFolders[0] = null;
try {
- new ProgressMonitorDialog(shell).run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- rootFolders[0] = CVSUIPlugin.getPlugin().getRepositoryManager().getFoldersForTag(root, CVSTag.DEFAULT, monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
+ new ProgressMonitorDialog(shell).run(true, true, monitor -> {
+ try {
+ rootFolders[0] = CVSUIPlugin.getPlugin().getRepositoryManager().getFoldersForTag(root,
+ CVSTag.DEFAULT, monitor);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {
@@ -89,6 +87,7 @@ public class RefreshRemoteProjectWizard extends Wizard {
/**
* @see org.eclipse.jface.wizard.IWizard#addPages()
*/
+ @Override
public void addPages() {
setNeedsProgressMonitor(true);
ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION);
@@ -104,26 +103,25 @@ public class RefreshRemoteProjectWizard extends Wizard {
/**
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
+ @Override
public boolean performFinish() {
final ICVSRemoteResource[] selectedFolders = projectSelectionPage.getSelectedRemoteProject();
try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- // Run in the manager to avoid multiple repo view updates
- manager.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,InterruptedException {
- monitor.beginTask(null, 100);
- ICVSRemoteResource[] failedFolders = internalRefresh(manager, selectedFolders, false /* recurse */, Policy.subMonitorFor(monitor, 80));
- if (failedFolders.length > 0) {
- // Go deep any any failed folders.
- if (promptForDeepRefresh(failedFolders))
- internalRefresh(manager, failedFolders, true /* recurse */, Policy.subMonitorFor(monitor, 20));
- }
- monitor.done();
- }
- }, monitor);
- }
+ getContainer().run(true, true, monitor -> {
+ final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
+ // Run in the manager to avoid multiple repo view updates
+ manager.run(monitor1 -> {
+ monitor1.beginTask(null, 100);
+ ICVSRemoteResource[] failedFolders = internalRefresh(manager, selectedFolders, false /* recurse */,
+ Policy.subMonitorFor(monitor1, 80));
+ if (failedFolders.length > 0) {
+ // Go deep any any failed folders.
+ if (promptForDeepRefresh(failedFolders))
+ internalRefresh(manager, failedFolders, true /* recurse */,
+ Policy.subMonitorFor(monitor1, 20));
+ }
+ monitor1.done();
+ }, monitor);
});
return true;
} catch (InvocationTargetException e) {
@@ -157,22 +155,17 @@ public class RefreshRemoteProjectWizard extends Wizard {
private boolean promptForDeepRefresh(final ICVSRemoteResource[] folders) {
final boolean[] prompt = new boolean[] { false };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.RefreshRemoteProjectWizard_0, null,
- getNoTagsMessage(folders),
- MessageDialog.INFORMATION,
- new String[] {
- CVSUIMessages.RefreshRemoteProjectWizard_1,
- CVSUIMessages.RefreshRemoteProjectWizard_2
- }, 1);
- int code = dialog.open();
- if (code == 0) {
- prompt[0] = true;
- }
+ getShell().getDisplay().syncExec(() -> {
+ MessageDialog dialog = new MessageDialog(getShell(), CVSUIMessages.RefreshRemoteProjectWizard_0, null,
+ getNoTagsMessage(folders), MessageDialog.INFORMATION, new String[] {
+ CVSUIMessages.RefreshRemoteProjectWizard_1, CVSUIMessages.RefreshRemoteProjectWizard_2 },
+ 1);
+ int code = dialog.open();
+ if (code == 0) {
+ prompt[0] = true;
+ }
- }
- });
+ });
return prompt[0];
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java
index e74e26683..e0cdec34b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RemoveRootAction.java
@@ -19,12 +19,10 @@ import java.util.Iterator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
@@ -78,22 +76,22 @@ public class RemoveRootAction extends SelectionListenerAction {
return new ICVSRepositoryLocation[0];
}
+ @Override
public void run() {
final ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
if (roots.length == 0) return;
final boolean[] proceed = new boolean[1];
- shell.getDisplay().syncExec(new Runnable(){
- public void run() {
- String message;
- if(roots.length == 1){
- message = NLS.bind(CVSUIMessages.RemoveRootAction_RepositoryRemovalDialogMessageSingle, roots[0].getLocation(true));
- } else {
- message = NLS.bind(CVSUIMessages.RemoveRootAction_RepositoryRemovalDialogMessageMultiple, Integer.valueOf(roots.length));
- }
- proceed[0] = MessageDialog.openQuestion(shell,
- CVSUIMessages.RemoveRootAction_RepositoryRemovalDialogTitle,
- message);
+ shell.getDisplay().syncExec(() -> {
+ String message;
+ if (roots.length == 1) {
+ message = NLS.bind(CVSUIMessages.RemoveRootAction_RepositoryRemovalDialogMessageSingle,
+ roots[0].getLocation(true));
+ } else {
+ message = NLS.bind(CVSUIMessages.RemoveRootAction_RepositoryRemovalDialogMessageMultiple,
+ Integer.valueOf(roots.length));
}
+ proceed[0] = MessageDialog.openQuestion(shell, CVSUIMessages.RemoveRootAction_RepositoryRemovalDialogTitle,
+ message);
});
if(!proceed[0]){
return;
@@ -117,34 +115,29 @@ public class RemoveRootAction extends SelectionListenerAction {
// This will notify the RepositoryManager of the removal
if (!shared.isEmpty()) {
final String location = roots[i].getLocation(true);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- DetailsDialogWithProjects dialog = new DetailsDialogWithProjects(
- shell,
- CVSUIMessages.RemoteRootAction_Unable_to_Discard_Location_1,
- NLS.bind(CVSUIMessages.RemoteRootAction_Projects_in_the_local_workspace_are_shared_with__2, new String[] { location }),
- CVSUIMessages.RemoteRootAction_The_projects_that_are_shared_with_the_above_repository_are__4,
- (IProject[]) shared.toArray(new IProject[shared.size()]),
- false,
- Dialog.DLG_IMG_ERROR);
- dialog.open();
- }
+ shell.getDisplay().syncExec(() -> {
+ DetailsDialogWithProjects dialog = new DetailsDialogWithProjects(shell,
+ CVSUIMessages.RemoteRootAction_Unable_to_Discard_Location_1,
+ NLS.bind(
+ CVSUIMessages.RemoteRootAction_Projects_in_the_local_workspace_are_shared_with__2,
+ new String[] { location }),
+ CVSUIMessages.RemoteRootAction_The_projects_that_are_shared_with_the_above_repository_are__4,
+ (IProject[]) shared.toArray(new IProject[shared.size()]), false, Dialog.DLG_IMG_ERROR);
+ dialog.open();
});
} else {
IProgressService manager = PlatformUI.getWorkbench().getProgressService();
try {
- manager.busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final ISchedulingRule rule = new RepositoryLocationSchedulingRule(root);
- try {
- Job.getJobManager().beginRule(rule, monitor);
- view.getContentProvider().cancelJobs(root);
- KnownRepositories.getInstance().disposeRepository(root);
- } finally {
- Job.getJobManager().endRule(rule);
- }
-
+ manager.busyCursorWhile(monitor -> {
+ final ISchedulingRule rule = new RepositoryLocationSchedulingRule(root);
+ try {
+ Job.getJobManager().beginRule(rule, monitor);
+ view.getContentProvider().cancelJobs(root);
+ KnownRepositories.getInstance().disposeRepository(root);
+ } finally {
+ Job.getJobManager().endRule(rule);
}
+
});
} catch (InvocationTargetException e) {
throw CVSException.wrapException(e);
@@ -159,6 +152,7 @@ public class RemoveRootAction extends SelectionListenerAction {
}
}
+ @Override
protected boolean updateSelection(IStructuredSelection selection) {
this.selection = selection;
ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
index 86c8a498e..3d16bf0c0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
@@ -29,8 +29,6 @@ import org.eclipse.core.runtime.*;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
@@ -379,30 +377,28 @@ public class RepositoryManager {
loadCommentHistory();
loadCommentTemplates();
CVSProviderPlugin.getPlugin().addRepositoryListener(new ICVSListener() {
+ @Override
public void repositoryAdded(ICVSRepositoryLocation root) {
rootAdded(root);
}
+ @Override
public void repositoryRemoved(ICVSRepositoryLocation root) {
rootRemoved(root);
}
});
IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- store.addPropertyChangeListener(new IPropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ICVSUIConstants.PREF_COMMIT_COMMENTS_MAX_HISTORY)) {
- Object newValue = event.getNewValue();
- if (newValue instanceof String) {
- try {
- setMaxComments(Integer.parseInt((String) newValue));
- } catch (NumberFormatException e) {
- // fail silently
- }
+ store.addPropertyChangeListener(event -> {
+ if (event.getProperty().equals(ICVSUIConstants.PREF_COMMIT_COMMENTS_MAX_HISTORY)) {
+ Object newValue = event.getNewValue();
+ if (newValue instanceof String) {
+ try {
+ setMaxComments(Integer.parseInt((String) newValue));
+ } catch (NumberFormatException e) {
+ // fail silently
}
}
}
-
});
setMaxComments(store.getInt(ICVSUIConstants.PREF_COMMIT_COMMENTS_MAX_HISTORY));
}
@@ -651,11 +647,10 @@ public class RepositoryManager {
public String promptForComment(final Shell shell, IResource[] resourcesToCommit, String proposedComment) {
final int[] result = new int[1];
final ReleaseCommentDialog dialog = new ReleaseCommentDialog(shell, resourcesToCommit, proposedComment, IResource.DEPTH_INFINITE);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- if (result[0] != Window.OK) return;
- }
+ shell.getDisplay().syncExec(() -> {
+ result[0] = dialog.open();
+ if (result[0] != Window.OK)
+ return;
});
if (result[0] != Window.OK) return null;
return dialog.getComment();
@@ -675,15 +670,13 @@ public class RepositoryManager {
final IResource[][] result = new IResource[1][0];
result[0] = null;
final AddToVersionControlDialog dialog = new AddToVersionControlDialog(shell, unadded);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- int code = dialog.open();
- if (code == IDialogConstants.YES_ID) {
- result[0] = dialog.getResourcesToAdd();
- } else if(code == IDialogConstants.NO_ID) {
- // allow the commit to continue.
- result[0] = new IResource[0];
- }
+ shell.getDisplay().syncExec(() -> {
+ int code = dialog.open();
+ if (code == IDialogConstants.YES_ID) {
+ result[0] = dialog.getResourcesToAdd();
+ } else if (code == IDialogConstants.NO_ID) {
+ // allow the commit to continue.
+ result[0] = new IResource[0];
}
});
return result[0];
@@ -856,20 +849,18 @@ public class RepositoryManager {
final CVSRepositoryLocation newLocation) {
try {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- RepositoryRoot root = getRepositoryRootFor(oldLocation);
- // Disposing of the old location will result in the deletion of the
- // cached root through a listener callback
- KnownRepositories.getInstance().disposeRepository(oldLocation);
-
- // Get the new location from the CVS plugin to ensure we use the
- // instance that will be returned by future calls to getRepository()
- boolean isNew = !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation());
- root.setRepositoryLocation(
- KnownRepositories.getInstance().addRepository(newLocation, isNew /* broadcast */));
- add(root);
- }
+ run(monitor -> {
+ RepositoryRoot root = getRepositoryRootFor(oldLocation);
+ // Disposing of the old location will result in the deletion of the
+ // cached root through a listener callback
+ KnownRepositories.getInstance().disposeRepository(oldLocation);
+
+ // Get the new location from the CVS plugin to ensure we use the
+ // instance that will be returned by future calls to getRepository()
+ boolean isNew = !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation());
+ root.setRepositoryLocation(
+ KnownRepositories.getInstance().addRepository(newLocation, isNew /* broadcast */));
+ add(root);
}, Policy.monitorFor(null));
} catch (InvocationTargetException e) {
CVSException.wrapException(e);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
index f12dd50ef..c24bed962 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
@@ -13,11 +13,9 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
-import com.ibm.icu.text.DateFormat;
import java.util.Date;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
@@ -31,14 +29,18 @@ import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.Util;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
-import org.eclipse.team.internal.core.subscribers.*;
+import org.eclipse.team.internal.core.subscribers.ChangeSet;
+import org.eclipse.team.internal.core.subscribers.CheckedInChangeSet;
import org.eclipse.team.internal.ui.synchronize.SyncInfoSetChangeSetCollector;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
+import com.ibm.icu.text.DateFormat;
+
/**
* Collector that fetches the log for incoming CVS change sets
*/
@@ -72,6 +74,7 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
this.kind = kind;
}
+ @Override
protected int calculateKind() throws TeamException {
return kind;
}
@@ -87,21 +90,24 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getAuthor()
*/
- public String getAuthor() {
+ @Override
+ public String getAuthor() {
return ""; //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getDate()
*/
- public Date getDate() {
+ @Override
+ public Date getDate() {
return date;
}
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.ChangeSet#getComment()
*/
- public String getComment() {
+ @Override
+ public String getComment() {
return ""; //$NON-NLS-1$
}
@@ -126,21 +132,24 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getAuthor()
*/
- public String getAuthor() {
+ @Override
+ public String getAuthor() {
return entry.getAuthor();
}
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.CheckedInChangeSet#getDate()
*/
- public Date getDate() {
+ @Override
+ public Date getDate() {
return entry.getDate();
}
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.ChangeSet#getComment()
*/
- public String getComment() {
+ @Override
+ public String getComment() {
return entry.getComment();
}
}
@@ -167,7 +176,8 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
configuration.setProperty(LOG_ENTRY_HANDLER, logEntryHandler);
// Use an action group to get notified when the configuration is disposed
configuration.addActionContribution(new SynchronizePageActionGroup() {
- public void dispose() {
+ @Override
+ public void dispose() {
super.dispose();
LogEntryCacheUpdateHandler handler = (LogEntryCacheUpdateHandler)configuration.getProperty(LOG_ENTRY_HANDLER);
if (handler != null) {
@@ -184,7 +194,8 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
/* (non-Javadoc)
* @see org.eclipse.team.core.subscribers.SyncInfoSetChangeSetCollector#add(org.eclipse.team.core.synchronize.SyncInfo[])
*/
- protected void add(SyncInfo[] infos) {
+ @Override
+ protected void add(SyncInfo[] infos) {
LogEntryCacheUpdateHandler handler = getLogEntryHandler();
if (handler != null)
try {
@@ -197,7 +208,8 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SyncInfoSetChangeSetCollector#reset(org.eclipse.team.core.synchronize.SyncInfoSet)
*/
- public void reset(SyncInfoSet seedSet) {
+ @Override
+ public void reset(SyncInfoSet seedSet) {
// Notify that handler to stop any fetches in progress
LogEntryCacheUpdateHandler handler = getLogEntryHandler();
if (handler != null) {
@@ -209,6 +221,7 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.views.HierarchicalModelProvider#dispose()
*/
+ @Override
public void dispose() {
// No longer listen for log entry changes
// (The handler is disposed with the page)
@@ -225,11 +238,7 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
* to add each resource to an appropriate commit set.
*/
private void handleRemoteChanges(final SyncInfo[] infos, final LogEntryCache logEntries, final IProgressMonitor monitor) {
- performUpdate(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- addLogEntries(infos, logEntries, monitor);
- }
- }, true /* preserver expansion */, monitor);
+ performUpdate(monitor1 -> addLogEntries(infos, logEntries, monitor1), true /* preserver expansion */, monitor);
}
/*
@@ -419,7 +428,8 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SyncInfoSetChangeSetCollector#waitUntilDone(org.eclipse.core.runtime.IProgressMonitor)
*/
- public void waitUntilDone(IProgressMonitor monitor) {
+ @Override
+ public void waitUntilDone(IProgressMonitor monitor) {
super.waitUntilDone(monitor);
monitor.worked(1);
// wait for the event handler to process changes.
@@ -440,7 +450,8 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.LogEntryCacheUpdateHandler.ILogsFetchedListener#logEntriesFetched(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
*/
- public void logEntriesFetched(SyncInfoSet set, LogEntryCache logEntryCache, IProgressMonitor monitor) {
+ @Override
+ public void logEntriesFetched(SyncInfoSet set, LogEntryCache logEntryCache, IProgressMonitor monitor) {
if (disposed) return;
// Hold on to the cache so we can use it while commit sets are visible
this.logEntryCache = logEntryCache;
@@ -453,6 +464,7 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector impleme
return null;
}
+ @Override
protected void initializeSets() {
// Nothing to do
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
index ed466037e..d3c0aa738 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSubscriberOperation.java
@@ -14,24 +14,13 @@
package org.eclipse.team.internal.ccvs.ui.subscriber;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
@@ -40,7 +29,8 @@ import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.PruneFolderVisitor;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
@@ -55,6 +45,7 @@ public abstract class CVSSubscriberOperation extends SynchronizeModelOperation {
/* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// Divide the sync info by project
final Map projectSyncInfos = getProjectSyncInfoSetMap();
@@ -80,13 +71,12 @@ public abstract class CVSSubscriberOperation extends SynchronizeModelOperation {
// and cache commits to disk are batched
EclipseSynchronizer.getInstance().run(
project,
- new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
+ monitor1 -> {
try {
- CVSSubscriberOperation.this.runWithProjectRule(project, (SyncInfoSet)projectSyncInfos.get(project), monitor);
+ CVSSubscriberOperation.this.runWithProjectRule(project,
+ (SyncInfoSet) projectSyncInfos.get(project), monitor1);
} catch (TeamException e) {
throw CVSException.wrapException(e);
- }
}
}, Policy.subMonitorFor(monitor, 100));
} catch (TeamException e) {
@@ -210,6 +200,7 @@ public abstract class CVSSubscriberOperation extends SynchronizeModelOperation {
return null;
}
+ @Override
protected boolean canRunAsJob() {
return true;
}
@@ -254,11 +245,9 @@ public abstract class CVSSubscriberOperation extends SynchronizeModelOperation {
*/
protected boolean promptForOverwrite(final SyncInfoSet syncSet) {
final int[] result = new int[] {Window.CANCEL};
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- UpdateDialog dialog = new UpdateDialog(getShell(), syncSet);
- result[0] = dialog.open();
- }
+ TeamUIPlugin.getStandardDisplay().syncExec(() -> {
+ UpdateDialog dialog = new UpdateDialog(getShell(), syncSet);
+ result[0] = dialog.open();
});
return (result[0] == UpdateDialog.YES);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java
index 1f115f650..3d8af0505 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/RefreshDirtyStateOperation.java
@@ -62,22 +62,20 @@ public class RefreshDirtyStateOperation extends CVSSubscriberOperation {
private void performCleanTimestamps(IProject project, final SyncInfo[] infos, IProgressMonitor monitor) throws CVSException {
ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project);
final ContentComparisonSyncInfoFilter comparator = new SyncInfoFilter.ContentComparisonSyncInfoFilter(false);
- folder.run(new ICVSRunnable() {
- @Override
- public void run(IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, infos.length * 100);
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
- IResource resource = info.getLocal();
- if (resource.getType() == IResource.FILE) {
- if (comparator.compareContents((IFile)resource, info.getBase(), Policy.subMonitorFor(monitor, 100))) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- cvsFile.checkedIn(null, false /* not a commit */);
- }
+ folder.run(monitor1 -> {
+ monitor1.beginTask(null, infos.length * 100);
+ for (int i = 0; i < infos.length; i++) {
+ SyncInfo info = infos[i];
+ IResource resource = info.getLocal();
+ if (resource.getType() == IResource.FILE) {
+ if (comparator.compareContents((IFile) resource, info.getBase(),
+ Policy.subMonitorFor(monitor1, 100))) {
+ ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
+ cvsFile.checkedIn(null, false /* not a commit */);
}
}
- monitor.done();
}
+ monitor1.done();
}, Policy.subMonitorFor(monitor, 100));
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java
index bd7a06312..cbd3a35d7 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateOperation.java
@@ -36,7 +36,8 @@ import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.*;
import org.eclipse.team.internal.ui.TeamUIPlugin;
@@ -64,6 +65,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
/* (non-Javadoc)
* @see org.eclipse.team.ui.TeamOperation#shouldRun()
*/
+ @Override
public boolean shouldRun() {
return promptIfNeeded();
}
@@ -76,6 +78,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
* @param monitor a progress monitor
* @throws InvocationTargetException
*/
+ @Override
protected void run(final Map projectSyncInfos, final IProject project,
IProgressMonitor monitor) throws InvocationTargetException {
try {
@@ -93,16 +96,11 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
// Pass the scheduling rule to the synchronizer so that sync change
// events and cache commits to disk are batched
EclipseSynchronizer.getInstance().run(getUpdateRule(manager),
- new ICVSRunnable() {
- public void run(IProgressMonitor monitor)
- throws CVSException {
- try {
- runWithProjectRule(project,
- (SyncInfoSet) projectSyncInfos
- .get(project), monitor);
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
+ monitor1 -> {
+ try {
+ runWithProjectRule(project, (SyncInfoSet) projectSyncInfos.get(project), monitor1);
+ } catch (TeamException e) {
+ throw CVSException.wrapException(e);
}
}, Policy.subMonitorFor(monitor, 100));
} catch (TeamException e) {
@@ -132,6 +130,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
skipped.clear();
super.run(monitor);
@@ -145,6 +144,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#run(org.eclipse.team.ui.sync.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void runWithProjectRule(IProject project, SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
try {
monitor.beginTask(null, 100);
@@ -158,6 +158,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
// Remove all failed conflicts from the original sync set
syncSet.rejectNodes(new FastSyncInfoFilter() {
+ @Override
public boolean select(SyncInfo info) {
return skipped.getSyncInfo(info.getLocal()) != null;
}
@@ -321,6 +322,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
new AndSyncInfoFilter(new FastSyncInfoFilter[] {
FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.ADDITION),
new FastSyncInfoFilter() {
+ @Override
public boolean select(SyncInfo info) {
return info.getLocal().getType() == IResource.FILE;
}
@@ -331,6 +333,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
new AndSyncInfoFilter(new FastSyncInfoFilter[] {
FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
new FastSyncInfoFilter() {
+ @Override
public boolean select(SyncInfo info) {
if (info.getLocal().getType() == IResource.FILE) {
try {
@@ -350,6 +353,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
new AndSyncInfoFilter(new FastSyncInfoFilter[] {
FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
new FastSyncInfoFilter() {
+ @Override
public boolean select(SyncInfo info) {
IResourceVariant remote = info.getRemote();
IResourceVariant base = info.getBase();
@@ -368,6 +372,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
new AndSyncInfoFilter(new FastSyncInfoFilter[] {
FastSyncInfoFilter.getDirectionAndChangeFilter(SyncInfo.CONFLICTING, SyncInfo.CHANGE),
new FastSyncInfoFilter() {
+ @Override
public boolean select(SyncInfo info) {
IResource local = info.getLocal();
if (local.getType() == IResource.FILE) {
@@ -398,13 +403,10 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
* Note: This method is designed to be overridden by test cases.
*/
protected void warnAboutFailedResources(final SyncInfoSet syncSet) {
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog.openInformation(getShell(),
- CVSUIMessages.SafeUpdateAction_warnFilesWithConflictsTitle,
- CVSUIMessages.SafeUpdateAction_warnFilesWithConflictsDescription);
- }
- });
+ TeamUIPlugin.getStandardDisplay()
+ .syncExec(() -> MessageDialog.openInformation(getShell(),
+ CVSUIMessages.SafeUpdateAction_warnFilesWithConflictsTitle,
+ CVSUIMessages.SafeUpdateAction_warnFilesWithConflictsDescription));
}
/**
@@ -453,6 +455,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
}
}
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.UpdateAction_update;
}
@@ -460,6 +463,7 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction#getJobName(org.eclipse.team.ui.sync.SyncInfoSet)
*/
+ @Override
protected String getJobName() {
SyncInfoSet syncSet = getSyncInfoSet();
return NLS.bind(CVSUIMessages.UpdateAction_jobName, new String[] { Integer.valueOf(syncSet.size()).toString() });
@@ -477,12 +481,14 @@ public abstract class SafeUpdateOperation extends CVSSubscriberOperation {
final SyncInfoSet set = getSyncInfoSet();
final boolean[] result = new boolean[] {true};
if(getPromptBeforeUpdate()) {
- TeamUIPlugin.getStandardDisplay().syncExec(new Runnable() {
- public void run() {
- String sizeString = Integer.toString(set.size());
- String message = set.size() > 1 ? NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateSeveral, new String[] { sizeString }) : NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateOne, new String[] { sizeString }); //
- result[0] = MessageDialog.openQuestion(getShell(), NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateTitle, new String[] { sizeString }), message);
- }
+ TeamUIPlugin.getStandardDisplay().syncExec(() -> {
+ String sizeString = Integer.toString(set.size());
+ String message = set.size() > 1
+ ? NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateSeveral, new String[] { sizeString })
+ : NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateOne, new String[] { sizeString }); //
+ result[0] = MessageDialog.openQuestion(getShell(),
+ NLS.bind(CVSUIMessages.UpdateAction_promptForUpdateTitle, new String[] { sizeString }),
+ message);
});
}
return result[0];
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
index 570d6ce51..b178d6ae1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/WorkspaceCommitOperation.java
@@ -33,7 +33,8 @@ import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetComparator;
import org.eclipse.team.internal.ccvs.ui.operations.*;
@@ -56,6 +57,7 @@ public class WorkspaceCommitOperation extends CVSSubscriberOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#getErrorTitle()
*/
+ @Override
protected String getErrorTitle() {
return CVSUIMessages.CommitAction_commitFailed;
}
@@ -63,6 +65,7 @@ public class WorkspaceCommitOperation extends CVSSubscriberOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.TeamOperation#getJobName()
*/
+ @Override
protected String getJobName() {
SyncInfoSet syncSet = getSyncInfoSet();
return NLS.bind(CVSUIMessages.CommitAction_jobName, new String[] { Integer.valueOf(syncSet.size()).toString() });
@@ -71,6 +74,7 @@ public class WorkspaceCommitOperation extends CVSSubscriberOperation {
/* (non-Javadoc)
* @see org.eclipse.team.ui.TeamOperation#shouldRun()
*/
+ @Override
public boolean shouldRun() {
SyncInfoSet set = getSyncInfoSet();
return !set.isEmpty();
@@ -79,6 +83,7 @@ public class WorkspaceCommitOperation extends CVSSubscriberOperation {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.actions.SubscriberOperation#getSyncInfoSet()
*/
+ @Override
protected SyncInfoSet getSyncInfoSet() {
if (syncSet == null) {
syncSet = super.getSyncInfoSet();
@@ -128,6 +133,7 @@ public class WorkspaceCommitOperation extends CVSSubscriberOperation {
* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberOperation#run(org.eclipse.team.core.synchronize.SyncInfoSet, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @Override
public void runWithProjectRule(IProject project, SyncInfoSet syncSet, IProgressMonitor monitor) throws TeamException {
final SyncInfo[] changed = syncSet.getSyncInfos();
@@ -217,9 +223,11 @@ public class WorkspaceCommitOperation extends CVSSubscriberOperation {
try {
CommitOperation commitOperation = new CommitOperation(getPart(), RepositoryProviderOperation.asResourceMappers(commits),
new Command.LocalOption[0], comment) {
+ @Override
protected ResourceMappingContext getResourceMappingContext() {
return new SingleProjectSubscriberContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), false, project);
}
+ @Override
protected SynchronizationScopeManager createScopeManager(boolean consultModels) {
return new SingleProjectScopeManager(getJobName(), getSelectedMappings(), getResourceMappingContext(), consultModels, project);
}
@@ -236,9 +244,11 @@ public class WorkspaceCommitOperation extends CVSSubscriberOperation {
private void add(final IProject project, IResource[] additions, IProgressMonitor monitor) throws TeamException {
try {
new AddOperation(getPart(), RepositoryProviderOperation.asResourceMappers(additions)) {
+ @Override
protected ResourceMappingContext getResourceMappingContext() {
return new SingleProjectSubscriberContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), false, project);
}
+ @Override
protected SynchronizationScopeManager createScopeManager(boolean consultModels) {
return new SingleProjectScopeManager(getJobName(), getSelectedMappings(), getResourceMappingContext(), consultModels, project);
}
@@ -266,11 +276,7 @@ public class WorkspaceCommitOperation extends CVSSubscriberOperation {
};
Shell shell = getShell();
final ToolTipMessageDialog dialog = new ToolTipMessageDialog(shell, title, null, question, MessageDialog.QUESTION, buttons, tips, 0);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
+ shell.getDisplay().syncExec(() -> dialog.open());
return dialog.getReturnCode();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java
index 0b016e3ec..e2960f94a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/MultiFolderTagSource.java
@@ -17,7 +17,6 @@ import java.lang.reflect.InvocationTargetException;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
@@ -43,14 +42,16 @@ public class MultiFolderTagSource extends SingleFolderTagSource {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.merge.SingleFolderTagSource#getShortDescription()
*/
- public String getShortDescription() {
+ @Override
+ public String getShortDescription() {
return NLS.bind(CVSUIMessages.MultiFolderTagSource_0, new String[] { Integer.toString(folders.length) });
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getTags(int)
*/
- public CVSTag[] getTags(int type) {
+ @Override
+ public CVSTag[] getTags(int type) {
if (type == CVSTag.HEAD || type == BASE) {
return super.getTags(type);
}
@@ -64,7 +65,8 @@ public class MultiFolderTagSource extends SingleFolderTagSource {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.tags.SingleFolderTagSource#refresh(boolean, org.eclipse.core.runtime.IProgressMonitor)
*/
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
+ @Override
+ public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
monitor.beginTask("", folders.length); //$NON-NLS-1$
Set result= new HashSet();
for (int i= 0; i < folders.length; i++) {
@@ -80,7 +82,8 @@ public class MultiFolderTagSource extends SingleFolderTagSource {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.tags.SingleFolderTagSource#getCVSResources()
*/
- public ICVSResource[] getCVSResources() {
+ @Override
+ public ICVSResource[] getCVSResources() {
return folders;
}
@@ -91,26 +94,24 @@ public class MultiFolderTagSource extends SingleFolderTagSource {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
*/
- public void commit(final CVSTag[] tags, final boolean replace, IProgressMonitor monitor) throws CVSException {
+ @Override
+ public void commit(final CVSTag[] tags, final boolean replace, IProgressMonitor monitor) throws CVSException {
try {
final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- manager.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder[] folders = getFolders();
- for (int i = 0; i < folders.length; i++) {
- if (replace) {
- CVSTag[] oldTags = manager
- .getKnownTags(folders[i]);
- manager.removeTags(folders[i], oldTags);
- }
- manager.addTags(folders[i], tags);
+ manager.run(monitor1 -> {
+ try {
+ ICVSFolder[] folders = getFolders();
+ for (int i = 0; i < folders.length; i++) {
+ if (replace) {
+ CVSTag[] oldTags = manager.getKnownTags(folders[i]);
+ manager.removeTags(folders[i], oldTags);
}
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
+ manager.addTags(folders[i], tags);
}
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
}
- }, monitor);
+ }, monitor);
} catch (InvocationTargetException e) {
throw CVSException.wrapException(e);
} catch (InterruptedException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java
index a653bc38f..ea8c2af4e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/SingleFolderTagSource.java
@@ -17,7 +17,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
@@ -44,7 +43,8 @@ public class SingleFolderTagSource extends TagSource {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getTags(int)
*/
- public CVSTag[] getTags(int type) {
+ @Override
+ public CVSTag[] getTags(int type) {
if (type == CVSTag.HEAD || type == BASE) {
return super.getTags(type);
}
@@ -62,7 +62,8 @@ public class SingleFolderTagSource extends TagSource {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#refresh(org.eclipse.core.runtime.IProgressMonitor)
*/
- public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
+ @Override
+ public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
CVSTag[] tags = CVSUIPlugin.getPlugin().getRepositoryManager().refreshDefinedTags(getFolder(), bestEffort /* recurse */, true /* notify */, monitor);
fireChange();
return tags;
@@ -71,7 +72,8 @@ public class SingleFolderTagSource extends TagSource {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getLocation()
*/
- public ICVSRepositoryLocation getLocation() {
+ @Override
+ public ICVSRepositoryLocation getLocation() {
RepositoryManager mgr = CVSUIPlugin.getPlugin().getRepositoryManager();
ICVSRepositoryLocation location = mgr.getRepositoryLocationFor(getFolder());
return location;
@@ -80,30 +82,30 @@ public class SingleFolderTagSource extends TagSource {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getShortDescription()
*/
- public String getShortDescription() {
+ @Override
+ public String getShortDescription() {
return getFolder().getName();
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
*/
- public void commit(final CVSTag[] tags, final boolean replace, IProgressMonitor monitor) throws CVSException {
+ @Override
+ public void commit(final CVSTag[] tags, final boolean replace, IProgressMonitor monitor) throws CVSException {
try {
final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- manager.run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder folder = getFolder();
- if (replace) {
- CVSTag[] oldTags = manager.getKnownTags(folder);
- manager.removeTags(folder, oldTags);
- }
- manager.addTags(folder, tags);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, monitor);
+ manager.run(monitor1 -> {
+ try {
+ ICVSFolder folder = getFolder();
+ if (replace) {
+ CVSTag[] oldTags = manager.getKnownTags(folder);
+ manager.removeTags(folder, oldTags);
+ }
+ manager.addTags(folder, tags);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
+ }
+ }, monitor);
} catch (InvocationTargetException e) {
throw CVSException.wrapException(e);
} catch (InterruptedException e) {
@@ -115,20 +117,19 @@ public class SingleFolderTagSource extends TagSource {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
*/
- public ICVSResource[] getCVSResources() {
+ @Override
+ public ICVSResource[] getCVSResources() {
final ICVSResource[][] resources = new ICVSResource[][] { null };
try {
- getRunnableContext().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- resources[0] = folder.fetchChildren(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
+ getRunnableContext().run(true, true, monitor -> {
+ try {
+ resources[0] = folder.fetchChildren(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
+ }
+ });
return resources[0];
} catch (InvocationTargetException e) {
CVSUIPlugin.log(CVSException.wrapException(e));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
index c1707bde6..43033cc64 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagRefreshButtonArea.java
@@ -16,11 +16,9 @@ package org.eclipse.team.internal.ccvs.ui.tags;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
@@ -55,7 +53,8 @@ public class TagRefreshButtonArea extends DialogArea {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.dialogs.DialogArea#createArea(org.eclipse.swt.widgets.Composite)
*/
- public void createArea(Composite parent) {
+ @Override
+ public void createArea(Composite parent) {
final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
@@ -87,18 +86,12 @@ public class TagRefreshButtonArea extends DialogArea {
refreshButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.END, SWT.CENTER, false, false));
configureTagsButton.setLayoutData(SWTUtils.createGridData(buttonWidth, SWT.DEFAULT, SWT.END, SWT.CENTER, false, false));
- refreshButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- refresh(false);
- }
- });
+ refreshButton.addListener(SWT.Selection, event -> refresh(false));
- configureTagsButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- TagConfigurationDialog d = new TagConfigurationDialog(shell, tagSource);
- d.open();
- }
- });
+ configureTagsButton.addListener(SWT.Selection, event -> {
+ TagConfigurationDialog d = new TagConfigurationDialog(shell, tagSource);
+ d.open();
+ });
PlatformUI.getWorkbench().getHelpSystem().setHelp(refreshButton, IHelpContextIds.TAG_CONFIGURATION_REFRESHACTION);
PlatformUI.getWorkbench().getHelpSystem().setHelp(configureTagsButton, IHelpContextIds.TAG_CONFIGURATION_OVERVIEW);
@@ -108,33 +101,28 @@ public class TagRefreshButtonArea extends DialogArea {
public void refresh(final boolean background) {
try {
- getRunnableContext().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- setBusy(true);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (!fMessageLabel.isDisposed())
- fMessageLabel.setText(CVSUIMessages.TagRefreshButtonArea_6);
- }
- });
- monitor.beginTask(CVSUIMessages.TagRefreshButtonArea_5, 100);
- final CVSTag[] tags = tagSource.refresh(false, Policy.subMonitorFor(monitor, 70));
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (!fMessageLabel.isDisposed())
- fMessageLabel.setText(background && tags.length == 0 ? CVSUIMessages.TagRefreshButtonArea_7 : ""); //$NON-NLS-1$
- }
- });
- if (!background && tags.length == 0 && promptForBestEffort()) {
- tagSource.refresh(true, Policy.subMonitorFor(monitor, 30));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- setBusy(false);
- monitor.done();
+ getRunnableContext().run(true, true, monitor -> {
+ try {
+ setBusy(true);
+ Display.getDefault().asyncExec(() -> {
+ if (!fMessageLabel.isDisposed())
+ fMessageLabel.setText(CVSUIMessages.TagRefreshButtonArea_6);
+ });
+ monitor.beginTask(CVSUIMessages.TagRefreshButtonArea_5, 100);
+ final CVSTag[] tags = tagSource.refresh(false, Policy.subMonitorFor(monitor, 70));
+ Display.getDefault().asyncExec(() -> {
+ if (!fMessageLabel.isDisposed())
+ fMessageLabel.setText(
+ background && tags.length == 0 ? CVSUIMessages.TagRefreshButtonArea_7 : ""); //$NON-NLS-1$
+ });
+ if (!background && tags.length == 0 && promptForBestEffort()) {
+ tagSource.refresh(true, Policy.subMonitorFor(monitor, 30));
}
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ setBusy(false);
+ monitor.done();
}
});
} catch (InterruptedException e) {
@@ -146,36 +134,29 @@ public class TagRefreshButtonArea extends DialogArea {
private void setBusy(final boolean busy) {
if (shell != null && !shell.isDisposed())
- shell.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (!refreshButton.isDisposed())
- refreshButton.setEnabled(!busy);
- }
+ shell.getDisplay().asyncExec(() -> {
+ if (!refreshButton.isDisposed())
+ refreshButton.setEnabled(!busy);
});
}
private boolean promptForBestEffort() {
final boolean[] prompt = new boolean[] { false };
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(shell, CVSUIMessages.TagRefreshButtonArea_0, null,
- getNoTagsFoundMessage(),
- MessageDialog.INFORMATION,
- new String[] {
- CVSUIMessages.TagRefreshButtonArea_1,
- CVSUIMessages.TagRefreshButtonArea_2,
- CVSUIMessages.TagRefreshButtonArea_3
- }, 1);
- int code = dialog.open();
- if (code == 0) {
- prompt[0] = true;
- } else if (code == 1) {
- TagConfigurationDialog d = new TagConfigurationDialog(shell, tagSource);
- d.open();
- }
+ shell.getDisplay().syncExec(() -> {
+ MessageDialog dialog = new MessageDialog(shell, CVSUIMessages.TagRefreshButtonArea_0, null,
+ getNoTagsFoundMessage(), MessageDialog.INFORMATION,
+ new String[] { CVSUIMessages.TagRefreshButtonArea_1, CVSUIMessages.TagRefreshButtonArea_2,
+ CVSUIMessages.TagRefreshButtonArea_3 },
+ 1);
+ int code = dialog.open();
+ if (code == 0) {
+ prompt[0] = true;
+ } else if (code == 1) {
+ TagConfigurationDialog d = new TagConfigurationDialog(shell, tagSource);
+ d.open();
+ }
- }
- });
+ });
return prompt[0];
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java
index 5228a7dd4..c3eb200b4 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AddWizard.java
@@ -14,17 +14,11 @@
package org.eclipse.team.internal.ccvs.ui.wizards;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.IFileContentManager;
import org.eclipse.team.core.Team;
@@ -43,14 +37,11 @@ public class AddWizard extends ResizableWizard {
public static void run(Shell shell, final AddOperation op) throws InvocationTargetException, InterruptedException {
// Prompt if there are files of unknown type being added
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- try {
- op.buildScope(monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ op.buildScope(monitor);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
}
});
@@ -65,46 +56,40 @@ public class AddWizard extends ResizableWizard {
private static IFile[] getUnaddedWithUnknownFileType(final ResourceTraversal[] traversals) throws InvocationTargetException, InterruptedException {
final List unadded = new ArrayList();
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- final IFileContentManager manager= Team.getFileContentManager();
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- IResource[] resources = traversal.getResources();
- for (int j = 0; j < resources.length; j++) {
- final IResource resource = resources[j];
- try {
- resource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) {
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- if (!file.isManaged()) {
- if (!file.isIgnored() || file.equals(resource)) {
- final String extension= ((IFile)resource).getFileExtension();
- if (manager.getType((IFile)resource) == Team.UNKNOWN) {
- if (extension != null && !manager.isKnownExtension(extension)) {
- unadded.add(resource);
- } else {
- final String name= file.getName();
- if (extension == null && name != null && !manager.isKnownFilename(name))
- unadded.add(resource);
- }
- }
- }
- }
- }
- return true;
- }
- }, traversal.getDepth(), false);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- }
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ final IFileContentManager manager = Team.getFileContentManager();
+ for (int i = 0; i < traversals.length; i++) {
+ ResourceTraversal traversal = traversals[i];
+ IResource[] resources = traversal.getResources();
+ for (int j = 0; j < resources.length; j++) {
+ final IResource resource = resources[j];
+ try {
+ resource.accept((IResourceVisitor) resource1 -> {
+ if (resource1.getType() == IResource.FILE) {
+ ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile) resource1);
+ if (!file.isManaged()) {
+ if (!file.isIgnored() || file.equals(resource1)) {
+ final String extension = ((IFile) resource1).getFileExtension();
+ if (manager.getType((IFile) resource1) == Team.UNKNOWN) {
+ if (extension != null && !manager.isKnownExtension(extension)) {
+ unadded.add(resource1);
+ } else {
+ final String name = file.getName();
+ if (extension == null && name != null && !manager.isKnownFilename(name))
+ unadded.add(resource1);
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }, traversal.getDepth(), false);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
}
-
- });
+ });
return (IFile[]) unadded.toArray(new IFile[unadded.size()]);
}
@@ -116,7 +101,8 @@ public class AddWizard extends ResizableWizard {
setDefaultPageImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION));
}
- public void addPages() {
+ @Override
+ public void addPages() {
final Collection names= new HashSet();
final Collection extensions= new HashSet();
@@ -148,7 +134,8 @@ public class AddWizard extends ResizableWizard {
}
}
- public boolean performFinish() {
+ @Override
+ public boolean performFinish() {
final Map extensionsToSave= new HashMap();
final Map extensionsNotToSave= new HashMap();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AlternativeLocationWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AlternativeLocationWizard.java
index 7440a7fcb..14bb3b1a0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AlternativeLocationWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/AlternativeLocationWizard.java
@@ -16,10 +16,8 @@ package org.eclipse.team.internal.ccvs.ui.wizards;
import java.lang.reflect.InvocationTargetException;
import java.util.Properties;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
@@ -32,6 +30,7 @@ public class AlternativeLocationWizard extends NewLocationWizard {
private ICVSRepositoryLocation location;
+ @Override
public boolean performFinish() {
final ICVSRepositoryLocation[] location = new ICVSRepositoryLocation[] { null };
boolean useLocation = true;
@@ -43,13 +42,11 @@ public class AlternativeLocationWizard extends NewLocationWizard {
if (mainPage.getValidate()) {
try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- location[0].validateConnection(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
+ getContainer().run(true, true, monitor -> {
+ try {
+ location[0].validateConnection(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InterruptedException e) {
@@ -104,10 +101,12 @@ public class AlternativeLocationWizard extends NewLocationWizard {
/**
* Creates the wizard pages
*/
+ @Override
public void addPages() {
super.addPages();
}
+ @Override
protected ConfigurationWizardMainPage createMainPage() {
return new AlternativeConfigurationWizardMainPage("repositoryPage1", CVSUIMessages.AlternativeLocationWizard_heading, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION)); //$NON-NLS-1$
}
@@ -142,6 +141,7 @@ public class AlternativeLocationWizard extends NewLocationWizard {
*
* @see org.eclipse.team.internal.ccvs.ui.wizards.ConfigurationWizardMainPage#validateFields()
*/
+ @Override
protected void validateFields() {
super.validateFields();
if (!isPageComplete()
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java
index c9ede92a8..cc3be767d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutWizard.java
@@ -16,8 +16,6 @@ package org.eclipse.team.internal.ccvs.ui.wizards;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
@@ -51,6 +49,7 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPages()
*/
+ @Override
public void addPages() {
setNeedsProgressMonitor(true);
@@ -77,6 +76,7 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
// Dummy page to allow lazy creation of CheckoutAsWizard
dummyPage = new CVSWizardPage("dummyPage") { //$NON-NLS-1$
+ @Override
public void createControl(Composite parent) {
Composite composite = createComposite(parent, 1, false);
setControl(composite);
@@ -92,6 +92,7 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#canFinish()
*/
+ @Override
public boolean canFinish() {
return (wizard == null && getSelectedModules().length > 0) ||
(wizard != null && wizard.canFinish());
@@ -100,6 +101,7 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#performFinish()
*/
+ @Override
public boolean performFinish() {
if (wizard != null) {
// The finish of the child wizard will get called directly.
@@ -133,6 +135,7 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#performCancel()
*/
+ @Override
public boolean performCancel() {
if (location != null && isNewLocation) {
KnownRepositories.getInstance().disposeRepository(location);
@@ -144,6 +147,7 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
*/
+ @Override
public IWizardPage getNextPage(IWizardPage page) {
// Assume the page is about to be shown when this method is
// invoked
@@ -153,6 +157,7 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.wizards.ICVSWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage, boolean)
*/
+ @Override
public IWizardPage getNextPage(IWizardPage page, boolean aboutToShow) {
if (page == locationPage) {
if (locationPage.getLocation() == null) {
@@ -204,13 +209,12 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
final ICVSRemoteFolder[] folderResult = new ICVSRemoteFolder [1];
final boolean[] booleanResult = new boolean[] { true };
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- ProjectMetaFileOperation op = new ProjectMetaFileOperation(getPart(), new ICVSRemoteFolder[] {folders[0]}, withName);
- op.run(monitor);
- folderResult[0] = op.getUpdatedFolders()[0];
- booleanResult[0] = op.metaFileExists();
- }
+ getContainer().run(true, true, monitor -> {
+ ProjectMetaFileOperation op = new ProjectMetaFileOperation(getPart(),
+ new ICVSRemoteFolder[] { folders[0] }, withName);
+ op.run(monitor);
+ folderResult[0] = op.getUpdatedFolders()[0];
+ booleanResult[0] = op.metaFileExists();
});
hasMetafile = booleanResult[0];
if (withName && hasMetafile)
@@ -261,13 +265,11 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
// Otherwise, get the location from the create location page
final ICVSRepositoryLocation[] locations = new ICVSRepositoryLocation[] { null };
final CVSException[] exception = new CVSException[] { null };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- try {
- locations[0] = createLocationPage.getLocation();
- } catch (CVSException e) {
- exception[0] = e;
- }
+ getShell().getDisplay().syncExec(() -> {
+ try {
+ locations[0] = createLocationPage.getLocation();
+ } catch (CVSException e) {
+ exception[0] = e;
}
});
if (exception[0] != null) {
@@ -296,6 +298,7 @@ public class CheckoutWizard extends Wizard implements ICVSWizard, INewWizard {
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
index 72f9a9dd9..d0747130f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java
@@ -26,7 +26,6 @@ import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardDialog;
@@ -386,16 +385,13 @@ public class CommitWizard extends ResizableWizard {
public static void run(IWorkbenchPart part, Shell shell, final ResourceTraversal[] traversals) throws CVSException {
try {
final IResource [][] resources = new IResource[][] { null };
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- resources[0] = getDeepResourcesToCommit(traversals, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ try {
+ resources[0] = getDeepResourcesToCommit(traversals, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ });
run(part, shell, resources[0]);
} catch (OperationCanceledException e) {
// Ignore
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
index b99de0bc7..334a6c4c7 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java
@@ -92,15 +92,13 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
if (resources.length > 0)
fCommentArea.setProject(resources[0].getProject());
fWizard.getDiffTree().addDiffChangeListener(new IDiffChangeListener() {
+ @Override
public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
// ignore property changes
}
+ @Override
public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
- Utils.syncExec(new Runnable() {
- public void run() {
- updateEnablements();
- }
- }, CommitWizardCommitPage.this.getControl());
+ Utils.syncExec((Runnable) () -> updateEnablements(), CommitWizardCommitPage.this.getControl());
}
});
}
@@ -108,7 +106,8 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
- public void createControl(Composite parent) {
+ @Override
+ public void createControl(Composite parent) {
initializeDialogUnits(parent);
Dialog.applyDialogFont(parent);
final PixelConverter converter= new PixelConverter(parent);
@@ -197,7 +196,8 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
Button showChanges = new Button(changeDesc, SWT.PUSH);
showChanges.setText(CVSUIMessages.CommitWizardCommitPage_5);
showChanges.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
showChangesPane();
}
});
@@ -247,15 +247,18 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
super(cc, configuration, participant);
}
+ @Override
protected boolean isOfferToRememberParticipant() {
return false;
}
+ @Override
protected CompareViewerSwitchingPane createContentViewerSwitchingPane(
Splitter parent, int style, CompareEditorInput cei) {
return super.createContentViewerSwitchingPane(placeholder, style, cei);
}
+ @Override
protected void setPageDescription(String title) {
super.setPageDescription(TeamUIMessages.ParticipantPageSaveablePart_0);
}
@@ -268,6 +271,7 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.DialogPage#dispose()
*/
+ @Override
public void dispose() {
super.dispose();
// Disposing of the page pane will dispose of the page and the configuration
@@ -287,7 +291,8 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
*/
- public boolean isPageComplete() {
+ @Override
+ public boolean isPageComplete() {
/* if empty comment is not allowed (see bug 114678) */
final IPreferenceStore store = CVSUIPlugin.getPlugin()
.getPreferenceStore();
@@ -308,7 +313,8 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
*
* @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
*/
- public void setVisible(boolean visible) {
+ @Override
+ public void setVisible(boolean visible) {
super.setVisible(visible);
expand();
if (visible && fConfiguration != null) {
@@ -393,7 +399,8 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
validatePage(true);
}
- protected IWizardContainer getContainer() {
+ @Override
+ protected IWizardContainer getContainer() {
return super.getContainer();
}
@@ -404,7 +411,8 @@ public class CommitWizardCommitPage extends WizardPage implements IPropertyChang
/* (non-Javadoc)
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
- public void propertyChange(PropertyChangeEvent event) {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(CommitCommentArea.OK_REQUESTED)) {
final IWizardContainer container= getContainer();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java
index 795ac6957..b99762df0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java
@@ -14,15 +14,11 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.wizards;
-import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.*;
import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.mapping.provider.SynchronizationContext;
@@ -46,27 +42,29 @@ public class CommitWizardParticipant extends WorkspaceModelParticipant {
* The actions to be displayed in the context menu.
*/
private class ActionContribution extends SynchronizePageActionGroup {
- public void modelChanged(final ISynchronizeModelElement root) {
+ @Override
+ public void modelChanged(final ISynchronizeModelElement root) {
super.modelChanged(root);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- final CommitWizardCommitPage page= fWizard.getCommitPage();
- if (page != null)
- page.updateForModelChange();
- }
- });
+ Display.getDefault().asyncExec(() -> {
+ final CommitWizardCommitPage page = fWizard.getCommitPage();
+ if (page != null)
+ page.updateForModelChange();
+ });
}
}
private WorkspaceChangeSetCapability capability;
- public ChangeSetCapability getChangeSetCapability() {
+ @Override
+ public ChangeSetCapability getChangeSetCapability() {
if (capability == null) {
capability = new WorkspaceChangeSetCapability() {
- public boolean supportsCheckedInChangeSets() {
+ @Override
+ public boolean supportsCheckedInChangeSets() {
return false;
}
- public boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
+ @Override
+ public boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
return false;
};
};
@@ -87,7 +85,8 @@ public class CommitWizardParticipant extends WorkspaceModelParticipant {
fWizard= wizard;
}
- protected CVSDecoration getDecoration(IResource resource) throws CoreException {
+ @Override
+ protected CVSDecoration getDecoration(IResource resource) throws CoreException {
final CVSDecoration decoration= super.getDecoration(resource);
final CommitWizardFileTypePage page= fWizard.getFileTypePage();
@@ -107,14 +106,16 @@ public class CommitWizardParticipant extends WorkspaceModelParticipant {
fWizard= wizard;
}
- protected ILabelDecorator getLabelDecorator(ISynchronizePageConfiguration configuration) {
+ @Override
+ protected ILabelDecorator getLabelDecorator(ISynchronizePageConfiguration configuration) {
return new Decorator(configuration, fWizard);
}
/* (non-Javadoc)
* @see org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
*/
- protected void initializeConfiguration(final ISynchronizePageConfiguration configuration) {
+ @Override
+ protected void initializeConfiguration(final ISynchronizePageConfiguration configuration) {
super.initializeConfiguration(configuration);
configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ACTION_GROUP, ISynchronizePageConfiguration.NAVIGATE_GROUP});
configuration.setProperty(ISynchronizePageConfiguration.P_CONTEXT_MENU, ISynchronizePageConfiguration.DEFAULT_CONTEXT_MENU);
@@ -126,23 +127,21 @@ public class CommitWizardParticipant extends WorkspaceModelParticipant {
// Wrap the container so that we can update the enablements after the runnable
// (i.e. the container resets the state to what it was at the beginning of the
// run even if the state of the page changed. Remove from View changes the state)
- configuration.setRunnableContext(new IRunnableContext() {
- public void run(boolean fork, boolean cancelable,
- IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException {
- fWizard.getContainer().run(fork, cancelable, runnable);
- final CommitWizardCommitPage page= fWizard.getCommitPage();
- if (page != null)
- page.updateEnablements();
- }
- });
+ configuration.setRunnableContext((fork, cancelable, runnable) -> {
+ fWizard.getContainer().run(fork, cancelable, runnable);
+ final CommitWizardCommitPage page = fWizard.getCommitPage();
+ if (page != null)
+ page.updateEnablements();
+ });
configuration.setSupportedModes(ISynchronizePageConfiguration.OUTGOING_MODE);
configuration.setMode(ISynchronizePageConfiguration.OUTGOING_MODE);
configuration.addActionContribution(new SynchronizePageActionGroup() {
- public void initialize(ISynchronizePageConfiguration configuration) {
+ @Override
+ public void initialize(ISynchronizePageConfiguration configuration) {
super.initialize(configuration);
showComparePaneAction = new Action(null, Action.AS_CHECK_BOX) {
- public void run() {
+ @Override
+ public void run() {
fWizard.getCommitPage().showComparePane(this.isChecked());
}
};
@@ -152,6 +151,7 @@ public class CommitWizardParticipant extends WorkspaceModelParticipant {
}
});
configuration.setProperty(SynchronizePageConfiguration.P_OPEN_ACTION, new Action() {
+ @Override
public void run() {
ISelection selection = configuration.getSite().getSelectionProvider().getSelection();
if(selection instanceof IStructuredSelection) {
@@ -168,7 +168,8 @@ public class CommitWizardParticipant extends WorkspaceModelParticipant {
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#doesSupportSynchronize()
*/
- public boolean doesSupportSynchronize() {
+ @Override
+ public boolean doesSupportSynchronize() {
return false;
}
@@ -177,8 +178,10 @@ public class CommitWizardParticipant extends WorkspaceModelParticipant {
return section == null ? false : section.getBoolean(CommitWizardCommitPage.SHOW_COMPARE);
}
+ @Override
protected ModelSynchronizeParticipantActionGroup createMergeActionGroup() {
return new WorkspaceMergeActionGroup() {
+ @Override
protected void addToContextMenu(String mergeActionId, Action action, IMenuManager manager) {
if (mergeActionId == SynchronizationActionProvider.MERGE_ACTION_ID
|| mergeActionId == SynchronizationActionProvider.OVERWRITE_ACTION_ID
@@ -189,6 +192,7 @@ public class CommitWizardParticipant extends WorkspaceModelParticipant {
super.addToContextMenu(mergeActionId, action, manager);
}
+ @Override
protected void appendToGroup(String menuId, String groupId, IAction action) {
if (menuId == ISynchronizePageConfiguration.P_CONTEXT_MENU
&& groupId == WorkspaceModelParticipant.CONTEXT_MENU_COMMIT_GROUP_1) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java
index 3280cbd0a..8c7e55a2c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizard.java
@@ -15,36 +15,21 @@ package org.eclipse.team.internal.ccvs.ui.wizards;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -106,11 +91,7 @@ public class ModeWizard extends ResizableWizard {
final ModeWizard [] wizard= new ModeWizard[1];
- BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
- public void run() {
- wizard[0]= new ModeWizard(shell, resources);
- }
- });
+ BusyIndicator.showWhile(shell.getDisplay(), () -> wizard[0] = new ModeWizard(shell, resources));
open(shell, wizard[0]);
return wizard[0];
@@ -134,14 +115,16 @@ public class ModeWizard extends ResizableWizard {
}
- public void addPages() {
+ @Override
+ public void addPages() {
addPage(fPage);
}
/* (Non-javadoc)
* Method declared on IWizard.
*/
- public boolean needsProgressMonitor() {
+ @Override
+ public boolean needsProgressMonitor() {
return true;
}
@@ -153,28 +136,26 @@ public class ModeWizard extends ResizableWizard {
for (int i = 0; i < resources.length; i++) {
final IResource currentResource = resources[i];
try {
- currentResource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- try {
- if (visited.contains(resource) || resource.getType() != IResource.FILE || !resource.exists())
- return true;
- visited.add(resource);
- IFile file = (IFile) resource;
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
- if (!cvsFile.isManaged())
- return true;
- final ResourceSyncInfo info = cvsFile.getSyncInfo();
- final KSubstOption mode = info.getKeywordMode();
-
- changes.add(new ModeChange(file, mode));
-
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
- // always return true and let the depth determine if children are visited
- return true;
- }
- }, IResource.DEPTH_INFINITE, false);
+ currentResource.accept((IResourceVisitor) resource -> {
+ try {
+ if (visited.contains(resource) || resource.getType() != IResource.FILE || !resource.exists())
+ return true;
+ visited.add(resource);
+ IFile file = (IFile) resource;
+ ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
+ if (!cvsFile.isManaged())
+ return true;
+ final ResourceSyncInfo info = cvsFile.getSyncInfo();
+ final KSubstOption mode = info.getKeywordMode();
+
+ changes.add(new ModeChange(file, mode));
+
+ } catch (TeamException e) {
+ throw new CoreException(e.getStatus());
+ }
+ // always return true and let the depth determine if children are visited
+ return true;
+ }, IResource.DEPTH_INFINITE, false);
} catch (CoreException e) {
CVSUIPlugin.openError(shell, CVSUIMessages.ModeWizard_2, null, e);
}
@@ -182,7 +163,8 @@ public class ModeWizard extends ResizableWizard {
return changes;
}
- public boolean performFinish() {
+ @Override
+ public boolean performFinish() {
try {
final List messages = new ArrayList();
final List changes= fPage.getChanges();
@@ -194,7 +176,8 @@ public class ModeWizard extends ResizableWizard {
return false;
getContainer().run(false /*fork*/, true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
final int totalWork= 10000;
monitor.beginTask(CVSUIMessages.ModeWizard_3, totalWork);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
index 1cf02db0f..5f310ad47 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
@@ -21,7 +21,6 @@ import java.util.Iterator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.wizard.IWizard;
@@ -69,17 +68,14 @@ public class ModuleSelectionPage extends CVSWizardPage {
this.helpContextId = helpContextId;
}
+ @Override
public void createControl(Composite parent) {
Composite composite = createComposite(parent, 2, false);
if (helpContextId != null)
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, helpContextId);
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- updateEnablements(false);
- }
- };
+ Listener listener = event -> updateEnablements(false);
if (project != null) {
useProjectNameButton = createRadioButton(composite, CVSUIMessages.ModuleSelectionPage_moduleIsProject, 2);
@@ -101,11 +97,7 @@ public class ModuleSelectionPage extends CVSWizardPage {
data.horizontalSpan = 2;
data.horizontalIndent = 10;
useModuleAndProjectNameButton.setLayoutData(data);
- useModuleAndProjectNameButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- updateText();
- }
- });
+ useModuleAndProjectNameButton.addListener(SWT.Selection, event -> updateText());
}
moduleList = createModuleTree(composite, 2);
@@ -145,6 +137,7 @@ public class ModuleSelectionPage extends CVSWizardPage {
&& useModuleAndProjectNameButton.getSelection();
}
+ @Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible) {
@@ -205,13 +198,11 @@ public class ModuleSelectionPage extends CVSWizardPage {
if (fetchModules) {
// Validate the location first since the module fecthing is
// done in a deferred fashion
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- validateLocation(monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
+ getContainer().run(true, true, monitor -> {
+ try {
+ validateLocation(monitor);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
}
});
setModuleListInput();
@@ -300,11 +291,7 @@ public class ModuleSelectionPage extends CVSWizardPage {
public ICVSRemoteFolder[] getSelectedModules() {
final ICVSRemoteFolder[][] folder = new ICVSRemoteFolder[][] { null };
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- folder[0] = internalGetSelectedModules();
- }
- });
+ Display.getDefault().syncExec(() -> folder[0] = internalGetSelectedModules());
return folder[0];
}
@@ -322,6 +309,7 @@ public class ModuleSelectionPage extends CVSWizardPage {
* Fix to allow filtering to be used without triggering fetching
* of the contents of all children (see bug 62268)
*/
+ @Override
public boolean isExpandable(Object element) {
ITreeContentProvider cp = (ITreeContentProvider) getContentProvider();
if(cp == null)
@@ -333,16 +321,14 @@ public class ModuleSelectionPage extends CVSWizardPage {
result.setContentProvider(new RemoteContentProvider());
result.setLabelProvider(new WorkbenchLabelProvider());
result.addFilter(new ViewerFilter() {
+ @Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
return !(element instanceof ICVSRemoteFile);
}
});
- result.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateText();
- }
- });
+ result.addSelectionChangedListener(event -> updateText());
result.getTree().addMouseListener(new MouseAdapter() {
+ @Override
public void mouseDoubleClick(MouseEvent e) {
if (getSelectedModule() != null) {
gotoNextPage();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java
index d97c77f96..d16e99685 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/NewLocationWizard.java
@@ -17,10 +17,8 @@ package org.eclipse.team.internal.ccvs.ui.wizards;
import java.lang.reflect.InvocationTargetException;
import java.util.Properties;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
@@ -67,6 +65,7 @@ public class NewLocationWizard extends Wizard implements INewWizard {
/**
* Creates the wizard pages
*/
+ @Override
public void addPages() {
mainPage = createMainPage();
if (properties != null) {
@@ -85,6 +84,7 @@ public class NewLocationWizard extends Wizard implements INewWizard {
/*
* @see IWizard#performFinish
*/
+ @Override
public boolean performFinish() {
final ICVSRepositoryLocation[] location = new ICVSRepositoryLocation[] { null };
boolean keepLocation = false;
@@ -96,13 +96,11 @@ public class NewLocationWizard extends Wizard implements INewWizard {
if (mainPage.getValidate()) {
try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- location[0].validateConnection(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
+ getContainer().run(true, true, monitor -> {
+ try {
+ location[0].validateConnection(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
keepLocation = true;
@@ -164,6 +162,7 @@ public class NewLocationWizard extends Wizard implements INewWizard {
return keepLocation;
}
+ @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
// Nothing to do
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
index 284151117..9eaf0314e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RestoreFromRepositoryFileSelectionPage.java
@@ -20,9 +20,9 @@ import java.util.*;
import org.eclipse.compare.*;
import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
@@ -74,23 +74,29 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
this.file= file;
this.logEntry = logEntry;
}
+ @Override
public InputStream getContents() throws CoreException {
IStorage s = getStorageFromLogEntry(logEntry);
if (s == null) return null;
return new BufferedInputStream(s.getContents());
}
+ @Override
public String getName() {
return file.getName();
}
+ @Override
public String getType() {
return file.getFileExtension();
}
+ @Override
public Image getImage() {
return CompareUI.getImage(file);
}
+ @Override
public long getModificationDate() {
return logEntry.getDate().getTime();
}
+ @Override
public String getCharset() throws CoreException {
IStorage s = getStorageFromLogEntry(logEntry);
if (s instanceof IEncodedStorage) {
@@ -118,6 +124,7 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
/**
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
+ @Override
public void createControl(Composite parent) {
Composite composite= createComposite(parent, 1, false);
setControl(composite);
@@ -151,6 +158,7 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
// Bottom: File content viewer
fileContentPane = new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
+ @Override
protected Viewer getViewer(Viewer oldViewer, Object input) {
return CompareUI.findContentViewer(oldViewer, input, this, null);
}
@@ -166,19 +174,23 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
protected CheckboxTableViewer createRevisionSelectionTable(CompareViewerPane composite, HistoryTableProvider tableProvider) {
CheckboxTableViewer table = tableProvider.createCheckBoxTable(composite);
table.setContentProvider(new IStructuredContentProvider() {
+ @Override
public Object[] getElements(Object inputElement) {
ILogEntry[] entries = getSelectedEntries();
if (entries != null) return entries;
return new Object[0];
}
+ @Override
public void dispose() {
}
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
table.setInput(this);
table.getTable().addSelectionListener(
new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
// Handle check selection in the check state listener
if (e.detail == SWT.CHECK) return;
@@ -186,11 +198,7 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
}
}
);
- table.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- handleRevisionChecked(event);
- }
- });
+ table.addCheckStateListener(event -> handleRevisionChecked(event));
composite.setContent(table.getControl());
return table;
}
@@ -202,6 +210,7 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
tree.setLabelProvider(
new DecoratingLabelProvider(
new WorkbenchLabelProvider() {
+ @Override
protected String decorateText(String input, Object element) {
String text;
if (element instanceof IFolder && element.equals(folder)) {
@@ -222,11 +231,7 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
tree.getTree().setLayoutData(data);
- tree.addPostSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleFileSelection(event);
- }
- });
+ tree.addPostSelectionChangedListener(event -> handleFileSelection(event));
composite.setContent(tree.getControl());
return tree;
}
@@ -400,16 +405,14 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
final ICVSRemoteFile remoteFile = location.getRemoteFile(new Path(null, info.getRepository()).append(file.getName()).toString(), CVSTag.DEFAULT);
// Then we need to fetch the log entries
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- // fetch the entries
- ILogEntry[] entries = remoteFile.getLogEntries(monitor);
- // cache the entries with the selected file
- entriesCache.put(selectedFile, entries);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
+ getContainer().run(true, true, monitor -> {
+ try {
+ // fetch the entries
+ ILogEntry[] entries = remoteFile.getLogEntries(monitor);
+ // cache the entries with the selected file
+ entriesCache.put(selectedFile, entries);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (CVSException e) {
@@ -438,14 +441,12 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
private IStorage getStorageFromLogEntry(final ILogEntry logEntry) {
final IStorage[] s = new IStorage[] { null };
try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSRemoteFile remoteFile = logEntry.getRemoteFile();
- s[0] = ((IResourceVariant)remoteFile).getStorage(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
+ getContainer().run(true, true, monitor -> {
+ try {
+ ICVSRemoteFile remoteFile = logEntry.getRemoteFile();
+ s[0] = ((IResourceVariant) remoteFile).getStorage(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {
@@ -506,23 +507,22 @@ public class RestoreFromRepositoryFileSelectionPage extends CVSWizardPage {
public boolean restoreSelectedFiles() {
try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(null, 100 * filesToRestore.size());
- for (Iterator iter = filesToRestore.keySet().iterator();iter.hasNext();) {
- IFile file = (IFile) iter.next();
- ILogEntry entry = (ILogEntry)filesToRestore.get(file);
- ensureParentExists(file);
- file.create(entry.getRemoteFile().getContents(Policy.subMonitorFor(monitor, 50)), false, Policy.subMonitorFor(monitor, 50));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
+ getContainer().run(true, true, monitor -> {
+ try {
+ monitor.beginTask(null, 100 * filesToRestore.size());
+ for (Iterator iter = filesToRestore.keySet().iterator(); iter.hasNext();) {
+ IFile file = (IFile) iter.next();
+ ILogEntry entry = (ILogEntry) filesToRestore.get(file);
+ ensureParentExists(file);
+ file.create(entry.getRemoteFile().getContents(Policy.subMonitorFor(monitor, 50)), false,
+ Policy.subMonitorFor(monitor, 50));
}
+ } catch (TeamException e1) {
+ throw new InvocationTargetException(e1);
+ } catch (CoreException e2) {
+ throw new InvocationTargetException(e2);
+ } finally {
+ monitor.done();
}
});
} catch (InvocationTargetException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
index 9bae903e8..c19406af1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
@@ -21,7 +21,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
@@ -89,6 +88,7 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
setWindowTitle(CVSUIMessages.SharingWizard_title);
}
+ @Override
public void addPages() {
ImageDescriptor sharingImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_SHARE);
boolean autoconnect = false;
@@ -146,17 +146,20 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
addPage(syncPage);
}
+ @Override
public boolean canFinish() {
IWizardPage page = getContainer().getCurrentPage();
return (page == autoconnectPage || page == syncPage);
}
+ @Override
public IWizardPage getNextPage(IWizardPage page) {
// Assume the page is about to be shown when this method is
// invoked
return getNextPage(page, true /* about to show*/);
}
+ @Override
public IWizardPage getNextPage(IWizardPage page, boolean aboutToShow) {
if (page == autoconnectPage) return null;
if (page == locationPage) {
@@ -227,19 +230,18 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
/*
* @see IWizard#performFinish
*/
+ @Override
public boolean performFinish() {
final boolean[] result = new boolean[] { true };
if (isAutoconnect()) {
try {
- getContainer().run(true /* fork */, true /* cancel */, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- result[0] = autoconnectCVSProject(monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
+ getContainer().run(true /* fork */, true /* cancel */, monitor -> {
+ try {
+ result[0] = autoconnectCVSProject(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ } finally {
+ monitor.done();
}
});
} catch (InterruptedException e) {
@@ -258,14 +260,12 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
if (getContainer().getCurrentPage() == syncPage) {
syncPage.saveSettings();
if (syncPage.commitChanges()) {
- Display.getCurrent().asyncExec(new Runnable() {
- public void run() {
- try {
- CommitWizard.run(null, parentShell, new IResource[] { syncPage.getProject() });
- } catch (CVSException e) {
- //TODO:handle
- CVSUIPlugin.log(e);
- }
+ Display.getCurrent().asyncExec(() -> {
+ try {
+ CommitWizard.run(null, parentShell, new IResource[] { syncPage.getProject() });
+ } catch (CVSException e) {
+ // TODO:handle
+ CVSUIPlugin.log(e);
}
});
}
@@ -276,6 +276,7 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#performCancel()
*/
+ @Override
public boolean performCancel() {
boolean disposeLocation = isNewLocation;
ICVSRepositoryLocation location;
@@ -299,12 +300,8 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
}
} else {
try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- new DisconnectOperation(null, new IProject[] { project }, true)
- .run(monitor);
- }
- });
+ getContainer().run(true, true,
+ monitor -> new DisconnectOperation(null, new IProject[] { project }, true).run(monitor));
} catch (InvocationTargetException e) {
CVSUIPlugin.log(IStatus.ERROR, e.getMessage(), e.getTargetException());
} catch (InterruptedException e) {
@@ -347,13 +344,11 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
// Otherwise, get the location from the create location page
final ICVSRepositoryLocation[] locations = new ICVSRepositoryLocation[] { null };
final CVSException[] exception = new CVSException[] { null };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- try {
- locations[0] = createLocationPage.getLocation();
- } catch (CVSException e) {
- exception[0] = e;
- }
+ getShell().getDisplay().syncExec(() -> {
+ try {
+ locations[0] = createLocationPage.getLocation();
+ } catch (CVSException e) {
+ exception[0] = e;
}
});
if (exception[0] != null) {
@@ -382,6 +377,7 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
/*
* @see IConfigurationWizard#init(IWorkbench, IProject)
*/
+ @Override
public void init(IWorkbench workbench, IProject project) {
this.project = project;
}
@@ -395,15 +391,13 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
}
final boolean[] isCVSFolder = new boolean[] { false };
try {
- CVSUIPlugin.runWithRefresh(shell, new IResource[] { project }, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
- FolderSyncInfo info = folder.getFolderSyncInfo();
- isCVSFolder[0] = info != null;
- } catch (final TeamException e) {
- throw new InvocationTargetException(e);
- }
+ CVSUIPlugin.runWithRefresh(shell, new IResource[] { project }, monitor -> {
+ try {
+ ICVSFolder folder = (ICVSFolder) CVSWorkspaceRoot.getCVSResourceFor(project);
+ FolderSyncInfo info = folder.getFolderSyncInfo();
+ isCVSFolder[0] = info != null;
+ } catch (final TeamException e) {
+ throw new InvocationTargetException(e);
}
}, null);
} catch (InvocationTargetException e) {
@@ -446,13 +440,11 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
} catch (final TeamException e) {
// Exception validating. We can continue if the user wishes.
final boolean[] keep = new boolean[] { false };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- keep[0] = MessageDialog.openQuestion(getContainer().getShell(),
- CVSUIMessages.SharingWizard_validationFailedTitle,
- NLS.bind(CVSUIMessages.SharingWizard_validationFailedText, (new Object[] {e.getStatus().getMessage()})));
- }
- });
+ getShell().getDisplay()
+ .syncExec(() -> keep[0] = MessageDialog.openQuestion(getContainer().getShell(),
+ CVSUIMessages.SharingWizard_validationFailedTitle,
+ NLS.bind(CVSUIMessages.SharingWizard_validationFailedText,
+ (new Object[] { e.getStatus().getMessage() }))));
if (!keep[0]) {
return false;
}
@@ -515,44 +507,41 @@ public class SharingWizard extends Wizard implements IConfigurationWizard, ICVSW
private boolean exists(final ICVSRemoteFolder folder) throws InvocationTargetException, InterruptedException {
final boolean[] result = new boolean[] { false };
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- result[0] = exists(folder, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
+ getContainer().run(true, true, monitor -> {
+ try {
+ result[0] = exists(folder, monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
return result[0];
}
private void populateSyncPage(final boolean exists) throws InvocationTargetException, InterruptedException {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- if (exists) {
- reconcileProject(Policy.subMonitorFor(monitor, 50));
- } else {
- shareProject(Policy.subMonitorFor(monitor, 50));
- }
- try {
- getParticipant().getContext().refresh(Utils.getResourceMappings(new IProject[] { project }), Policy.subMonitorFor(monitor, 50));
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- if (monitor.isCanceled()) {
- throw new InterruptedException();
- }
- monitor.done();
+ getContainer().run(true, true, monitor -> {
+ monitor.beginTask(null, IProgressMonitor.UNKNOWN);
+ if (exists) {
+ reconcileProject(Policy.subMonitorFor(monitor, 50));
+ } else {
+ shareProject(Policy.subMonitorFor(monitor, 50));
}
+ try {
+ getParticipant().getContext().refresh(Utils.getResourceMappings(new IProject[] { project }),
+ Policy.subMonitorFor(monitor, 50));
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ if (monitor.isCanceled()) {
+ throw new InterruptedException();
+ }
+ monitor.done();
});
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.IWizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
*/
+ @Override
public IWizardPage getPreviousPage(IWizardPage page) {
if (page == syncPage) {
// There's no going back from the sync page
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
index e09f5f117..30db2a3a6 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardSyncPage.java
@@ -18,8 +18,9 @@ import org.eclipse.compare.Splitter;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -31,7 +32,8 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.diff.*;
import org.eclipse.team.core.mapping.IResourceDiffTree;
-import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
import org.eclipse.team.internal.ccvs.ui.mappings.ModelSynchronizeWizard;
import org.eclipse.team.internal.ui.*;
@@ -72,6 +74,7 @@ public class SharingWizardSyncPage extends CVSWizardPage implements IDiffChangeL
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
+ @Override
public void createControl(Composite parent) {
final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
@@ -128,21 +131,19 @@ public class SharingWizardSyncPage extends CVSWizardPage implements IDiffChangeL
/* private */ void showErrors(final IStatus[] status) {
if (status.length == 0) return;
- getShell().getDisplay().syncExec(new Runnable() {
-
- public void run() {
- String title = CVSUIMessages.SharingWizardSyncPage_8;
- if (status.length == 1) {
- IStatus s = status[0];
- if (s.getException() instanceof CoreException) {
- s = ((CoreException)s.getException()).getStatus();
- }
- ErrorDialog.openError(getShell(), title, null, s);
- } else {
- MultiStatus multi = new MultiStatus(CVSUIPlugin.ID, 0, status, CVSUIMessages.SharingWizardSyncPage_9, null);
- ErrorDialog.openError(getShell(), title, null, multi);
+ getShell().getDisplay().syncExec(() -> {
+ String title = CVSUIMessages.SharingWizardSyncPage_8;
+ if (status.length == 1) {
+ IStatus s = status[0];
+ if (s.getException() instanceof CoreException) {
+ s = ((CoreException) s.getException()).getStatus();
}
- }
+ ErrorDialog.openError(getShell(), title, null, s);
+ } else {
+ MultiStatus multi = new MultiStatus(CVSUIPlugin.ID, 0, status, CVSUIMessages.SharingWizardSyncPage_9,
+ null);
+ ErrorDialog.openError(getShell(), title, null, multi);
+ }
});
}
@@ -158,6 +159,7 @@ public class SharingWizardSyncPage extends CVSWizardPage implements IDiffChangeL
cc.setLeftEditable(false);
cc.setRightEditable(false);
ParticipantPageCompareEditorInput part = new ParticipantPageCompareEditorInput(cc, configuration, participant) {
+ @Override
protected boolean isOfferToRememberParticipant() {
return false;
}
@@ -172,6 +174,7 @@ public class SharingWizardSyncPage extends CVSWizardPage implements IDiffChangeL
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
*/
+ @Override
public void dispose() {
if (input != null) {
input.getParticipant().dispose();
@@ -181,20 +184,20 @@ public class SharingWizardSyncPage extends CVSWizardPage implements IDiffChangeL
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.WizardPage#setPreviousPage(org.eclipse.jface.wizard.IWizardPage)
*/
+ @Override
public void setPreviousPage(IWizardPage page) {
// There's no going back from this page
super.setPreviousPage(null);
}
private void updatePage() {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (pageBook.isDisposed()) return;
- if (getDiffTree().isEmpty()) {
- pageBook.showPage(noChangesPage);
- } else {
- pageBook.showPage(syncPage);
- }
+ Display.getDefault().syncExec(() -> {
+ if (pageBook.isDisposed())
+ return;
+ if (getDiffTree().isEmpty()) {
+ pageBook.showPage(noChangesPage);
+ } else {
+ pageBook.showPage(syncPage);
}
});
}
@@ -206,6 +209,7 @@ public class SharingWizardSyncPage extends CVSWizardPage implements IDiffChangeL
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
*/
+ @Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (syncPage.isVisible()) {
@@ -253,6 +257,7 @@ public class SharingWizardSyncPage extends CVSWizardPage implements IDiffChangeL
private boolean hasOutgoingChanges() {
IResourceDiffTree tree = getDiffTree();
return tree != null && tree.hasMatchingDiffs(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), new FastDiffFilter() {
+ @Override
public boolean select(IDiff diff) {
if (diff instanceof IThreeWayDiff) {
IThreeWayDiff twd = (IThreeWayDiff) diff;
@@ -270,11 +275,13 @@ public class SharingWizardSyncPage extends CVSWizardPage implements IDiffChangeL
return project;
}
+ @Override
public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) {
showErrors(event.getErrors());
updatePage();
}
+ @Override
public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {
// Ignore
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java
index 5beecb0e0..4d23a4a8a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/dialogs/NoChangesDialog.java
@@ -118,12 +118,7 @@ public class NoChangesDialog extends DetailsDialog {
}
final Image[] image = new Image[1];
- display.syncExec(new Runnable() {
- @Override
- public void run() {
- image[0] = display.getSystemImage(imageID);
- }
- });
+ display.syncExec(() -> image[0] = display.getSystemImage(imageID));
return image[0];
}
diff --git a/examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF b/examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF
index b01dc5584..6eafd2767 100644
--- a/examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.compare.examples.xml/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.compare.examples.xml; singleton:=true
-Bundle-Version: 3.4.300.qualifier
+Bundle-Version: 3.4.400.qualifier
Bundle-Activator: org.eclipse.compare.examples.xml.XMLPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/examples/org.eclipse.compare.examples.xml/pom.xml b/examples/org.eclipse.compare.examples.xml/pom.xml
index 8a2b62639..31d413e7d 100644
--- a/examples/org.eclipse.compare.examples.xml/pom.xml
+++ b/examples/org.eclipse.compare.examples.xml/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.compare</groupId>
<artifactId>org.eclipse.compare.examples.xml</artifactId>
- <version>3.4.300-SNAPSHOT</version>
+ <version>3.4.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java
index b41f55f26..d18c76dc9 100644
--- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java
+++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java
@@ -358,12 +358,7 @@ public final class XMLPlugin extends AbstractUIPlugin {
IWorkbenchWindow window= fgXMLPlugin.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
final WindowRef windowRef= new WindowRef();
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- setActiveWorkbenchWindow(windowRef);
- }
- });
+ Display.getDefault().syncExec(() -> setActiveWorkbenchWindow(windowRef));
return windowRef.window;
}
return window;
diff --git a/examples/org.eclipse.team.examples.filesystem/META-INF/MANIFEST.MF b/examples/org.eclipse.team.examples.filesystem/META-INF/MANIFEST.MF
index b028b63b9..632eda215 100644
--- a/examples/org.eclipse.team.examples.filesystem/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.team.examples.filesystem/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.team.examples.filesystem; singleton:=true
-Bundle-Version: 3.5.200.qualifier
+Bundle-Version: 3.5.300.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.team.examples.filesystem,
diff --git a/examples/org.eclipse.team.examples.filesystem/pom.xml b/examples/org.eclipse.team.examples.filesystem/pom.xml
index 36446d1dc..144866ab9 100644
--- a/examples/org.eclipse.team.examples.filesystem/pom.xml
+++ b/examples/org.eclipse.team.examples.filesystem/pom.xml
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.team</groupId>
<artifactId>org.eclipse.team.examples.filesystem</artifactId>
- <version>3.5.200-SNAPSHOT</version>
+ <version>3.5.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergeOperation.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergeOperation.java
index cfaa2e924..32c0d8cf9 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergeOperation.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergeOperation.java
@@ -92,11 +92,7 @@ public class NonSyncModelMergeOperation extends ModelMergeOperation {
protected void handlePreviewRequest() {
// We perform a syncExec so that the job will dispose of the scope manager
// after the dialog closes
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- NonSyncMergeDialog.openFor(NonSyncModelMergeOperation.this);
- }
- });
+ Display.getDefault().syncExec(() -> NonSyncMergeDialog.openFor(NonSyncModelMergeOperation.this));
}
/* (non-Javadoc)
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java
index b70a0af5d..965c67188 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java
@@ -20,7 +20,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -60,26 +59,24 @@ public class OpenFileSystemRevisionAction extends BaseSelectionListenerAction {
if (revision == null || !revision.exists()) {
MessageDialog.openError(page.getSite().getShell(), "Deleted Revision", "Can't open a deleted revision");
} else {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IStorage file;
- try {
- file = revision.getStorage(monitor);
- String id = getEditorID(file.getName(), file.getContents());
-
- if (file instanceof IFile) {
- //if this is the current workspace file, open it
- IDE.openEditor(page.getSite().getPage(), (IFile) file);
- } else {
- FileSystemRevisionEditorInput fileRevEditorInput = new FileSystemRevisionEditorInput(revision);
- if (!editorAlreadyOpenOnContents(fileRevEditorInput))
- page.getSite().getPage().openEditor(fileRevEditorInput, id);
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
+ IRunnableWithProgress runnable = monitor -> {
+ IStorage file;
+ try {
+ file = revision.getStorage(monitor);
+ String id = getEditorID(file.getName(), file.getContents());
+
+ if (file instanceof IFile) {
+ //if this is the current workspace file, open it
+ IDE.openEditor(page.getSite().getPage(), (IFile) file);
+ } else {
+ FileSystemRevisionEditorInput fileRevEditorInput = new FileSystemRevisionEditorInput(revision);
+ if (!editorAlreadyOpenOnContents(fileRevEditorInput))
+ page.getSite().getPage().openEditor(fileRevEditorInput, id);
}
-
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
+
};
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java
index d3b165a8d..bc320a60a 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java
@@ -16,10 +16,8 @@ package org.eclipse.team.examples.filesystem.ui;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
@@ -38,17 +36,11 @@ public class ShowHistoryAction extends ActionDelegate implements IObjectActionDe
public void run(IAction action) {
final Shell shell = Display.getDefault().getActiveShell();
try {
- new ProgressMonitorDialog(shell).run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- final IResource resource = (IResource) fSelection.getFirstElement();
- Runnable r = new Runnable() {
- public void run() {
- TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resource, null);
- }
- };
+ new ProgressMonitorDialog(shell).run(true, true, monitor -> {
+ final IResource resource = (IResource) fSelection.getFirstElement();
+ Runnable r = () -> TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resource, null);
- FileSystemPlugin.getStandardDisplay().asyncExec(r);
- }
+ FileSystemPlugin.getStandardDisplay().asyncExec(r);
});
} catch (InvocationTargetException exception) {
// ignore
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java
index 24af182eb..94be06133 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/ModelNavigatorContentProvider.java
@@ -194,27 +194,21 @@ public class ModelNavigatorContentProvider extends BaseWorkbenchContentProvider
}
private void refreshProjects(final ModelProject[] projects) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (!getViewer().getControl().isDisposed()) {
- for (int i = 0; i < projects.length; i++) {
- ModelProject project = projects[i];
- ((AbstractTreeViewer)getViewer()).refresh(project, true);
- }
+ Display.getDefault().asyncExec(() -> {
+ if (!getViewer().getControl().isDisposed()) {
+ for (int i = 0; i < projects.length; i++) {
+ ModelProject project = projects[i];
+ ((AbstractTreeViewer)getViewer()).refresh(project, true);
}
}
-
});
}
private void refreshViewer() {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (!getViewer().getControl().isDisposed()) {
- getViewer().refresh();
- }
+ Display.getDefault().asyncExec(() -> {
+ if (!getViewer().getControl().isDisposed()) {
+ getViewer().refresh();
}
-
});
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java
index f12074c5c..33d390713 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticFilesystemProvider.java
@@ -76,29 +76,27 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
return;
}
final Set toAdd= new HashSet(resources.length);
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if (!isControlled(resource)) {
- toAdd.add(resource);
- }
+ IWorkspaceRunnable runnable= monitor1 -> {
+ for (int i1 = 0; i1 < resources.length; i1++) {
+ IResource resource= resources[i1];
+ if (!isControlled(resource)) {
+ toAdd.add(resource);
}
- Map byParent= sortByParent(toAdd);
+ }
+ Map byParent= sortByParent(toAdd);
- monitor.beginTask("Adding to control", 1000);
- for (Iterator i= byParent.keySet().iterator(); i.hasNext();) {
- IContainer parent= (IContainer) i.next();
- Set controlledResources= (Set)fControlledResources.get(parent);
- if (controlledResources == null) {
- controlledResources= new HashSet(1);
- fControlledResources.put(parent, controlledResources);
- }
- controlledResources.addAll((Set)byParent.get(parent));
- writeControlFile(parent, monitor);
+ monitor1.beginTask("Adding to control", 1000);
+ for (Iterator i2= byParent.keySet().iterator(); i2.hasNext();) {
+ IContainer parent= (IContainer) i2.next();
+ Set controlledResources= (Set)fControlledResources.get(parent);
+ if (controlledResources == null) {
+ controlledResources= new HashSet(1);
+ fControlledResources.put(parent, controlledResources);
}
- monitor.done();
+ controlledResources.addAll((Set)byParent.get(parent));
+ writeControlFile(parent, monitor1);
}
+ monitor1.done();
};
run(runnable, monitor);
fireStateChanged(toAdd, false);
@@ -122,41 +120,39 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
return;
}
final Set toRemove= new HashSet(resources.length);
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if (isControlled(resource)) {
- toRemove.add(resource);
- }
+ IWorkspaceRunnable runnable= monitor1 -> {
+ for (int i1 = 0; i1 < resources.length; i1++) {
+ IResource resource1= resources[i1];
+ if (isControlled(resource1)) {
+ toRemove.add(resource1);
}
- Map byParent= sortByParent(toRemove);
+ }
+ Map byParent= sortByParent(toRemove);
- monitor.beginTask("Removing from control", 1000);
- for (Iterator i= byParent.keySet().iterator(); i.hasNext();) {
- IContainer parent= (IContainer) i.next();
- Set controlledResources= (Set)fControlledResources.get(parent);
- if (controlledResources == null) {
- deleteControlFile(parent, monitor);
+ monitor1.beginTask("Removing from control", 1000);
+ for (Iterator i2= byParent.keySet().iterator(); i2.hasNext();) {
+ IContainer parent= (IContainer) i2.next();
+ Set controlledResources= (Set)fControlledResources.get(parent);
+ if (controlledResources == null) {
+ deleteControlFile(parent, monitor1);
+ } else {
+ Set toRemove1= (Set)byParent.get(parent);
+ controlledResources.removeAll(toRemove1);
+ if (controlledResources.isEmpty()) {
+ fControlledResources.remove(parent);
+ deleteControlFile(parent, monitor1);
} else {
- Set toRemove= (Set)byParent.get(parent);
- controlledResources.removeAll(toRemove);
- if (controlledResources.isEmpty()) {
- fControlledResources.remove(parent);
- deleteControlFile(parent, monitor);
- } else {
- writeControlFile(parent, monitor);
- }
- for (Iterator j= controlledResources.iterator(); j.hasNext();) {
- IResource resource= (IResource) j.next();
- if (!resource.exists()) {
- j.remove();
- }
+ writeControlFile(parent, monitor1);
+ }
+ for (Iterator j= controlledResources.iterator(); j.hasNext();) {
+ IResource resource2= (IResource) j.next();
+ if (!resource2.exists()) {
+ j.remove();
}
}
}
- monitor.done();
}
+ monitor1.done();
};
run(runnable, monitor);
fireStateChanged(toRemove, false);
@@ -184,15 +180,13 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
* Deletes the control file for the given container.
*/
private void deleteControlFile(final IContainer container, IProgressMonitor monitor) {
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IFile controlFile= getControlFile(container, monitor);
- monitor.beginTask("Deleting control file " + controlFile, 1);
- if (controlFile.exists()) {
- controlFile.delete(true, false, monitor);
- }
- monitor.done();
+ IWorkspaceRunnable runnable= monitor1 -> {
+ IFile controlFile= getControlFile(container, monitor1);
+ monitor1.beginTask("Deleting control file " + controlFile, 1);
+ if (controlFile.exists()) {
+ controlFile.delete(true, false, monitor1);
}
+ monitor1.done();
};
run(runnable, monitor);
}
@@ -371,17 +365,15 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
set.add(project);
fControlledResources.put(project.getParent(), set);
try {
- getProject().accept(new IResourceVisitor() {
- public boolean visit(IResource resource) {
- if (resource.getType() == IResource.FILE) {
- if (CONTROL_FILE_NAME.equals(resource.getName())) {
- Set controlledResources= readControlFile((IFile)resource);
- fControlledResources.put(resource.getParent(), controlledResources);
- }
- return false;
+ getProject().accept(resource -> {
+ if (resource.getType() == IResource.FILE) {
+ if (CONTROL_FILE_NAME.equals(resource.getName())) {
+ Set controlledResources= readControlFile((IFile)resource);
+ fControlledResources.put(resource.getParent(), controlledResources);
}
- return true;
+ return false;
}
+ return true;
});
} catch (CoreException e) {
PessimisticFilesystemProviderPlugin.getInstance().logError(e, "Problems traversing resource tree");
@@ -406,20 +398,18 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
return;
}
final Set modified= new HashSet(1);
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- monitor.beginTask("Checking in resources", 1000);
- for(int i= 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if (isControlled(resource)) {
- if (resource.exists()) {
- resource.setReadOnly(true);
- modified.add(resource);
- }
+ IWorkspaceRunnable runnable= monitor1 -> {
+ monitor1.beginTask("Checking in resources", 1000);
+ for(int i= 0; i < resources.length; i++) {
+ IResource resource= resources[i];
+ if (isControlled(resource)) {
+ if (resource.exists()) {
+ resource.setReadOnly(true);
+ modified.add(resource);
}
}
- monitor.done();
}
+ monitor1.done();
};
run(runnable, monitor);
fireStateChanged(modified, false);
@@ -446,20 +436,18 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
return;
}
final Set modified= new HashSet(1);
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- monitor.beginTask("Unchecking in resources", 1000);
- for(int i= 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if (isControlled(resource)) {
- if (resource.exists()) {
- resource.setReadOnly(true);
- modified.add(resource);
- }
+ IWorkspaceRunnable runnable= monitor1 -> {
+ monitor1.beginTask("Unchecking in resources", 1000);
+ for(int i= 0; i < resources.length; i++) {
+ IResource resource= resources[i];
+ if (isControlled(resource)) {
+ if (resource.exists()) {
+ resource.setReadOnly(true);
+ modified.add(resource);
}
}
- monitor.done();
}
+ monitor1.done();
};
run(runnable, monitor);
fireStateChanged(modified, false);
@@ -483,20 +471,18 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
return;
}
final Set modified= new HashSet(1);
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- monitor.beginTask("Checking out resources", 1000);
- for(int i= 0; i < resources.length; i++) {
- IResource resource= resources[i];
- if (isControlled(resource)) {
- if(resource.exists()) {
- resource.setReadOnly(false);
- modified.add(resource);
- }
+ IWorkspaceRunnable runnable= monitor1 -> {
+ monitor1.beginTask("Checking out resources", 1000);
+ for(int i= 0; i < resources.length; i++) {
+ IResource resource= resources[i];
+ if (isControlled(resource)) {
+ if(resource.exists()) {
+ resource.setReadOnly(false);
+ modified.add(resource);
}
}
- monitor.done();
}
+ monitor1.done();
};
run(runnable, monitor);
fireStateChanged(modified, false);
@@ -660,20 +646,16 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
}
if (queueAfterWorkspaceOperation) {
- Thread t= new Thread(new Runnable() {
- public void run() {
- try {
- ResourcesPlugin.getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- }
- },
- null);
- } catch (CoreException e) {
- PessimisticFilesystemProviderPlugin.getInstance().logError(e, "Problem during empty runnable");
- }
- fireStateChanged(resources, false);
+ Thread t= new Thread(() -> {
+ try {
+ ResourcesPlugin.getWorkspace().run(
+ (IWorkspaceRunnable) monitor -> {
+ },
+ null);
+ } catch (CoreException e) {
+ PessimisticFilesystemProviderPlugin.getInstance().logError(e, "Problem during empty runnable");
}
+ fireStateChanged(resources, false);
});
t.start();
} else {
@@ -688,17 +670,15 @@ public class PessimisticFilesystemProvider extends RepositoryProvider {
*/
private Collection getSubtreeMembers(IResource resource) {
final Set resources= new HashSet(1);
- IResourceVisitor visitor= new IResourceVisitor() {
- public boolean visit(IResource resource) {
- switch (resource.getType()) {
- case IResource.PROJECT:
- case IResource.FOLDER:
- case IResource.FILE:
- resources.add(resource);
- return true;
- }
- return true;
+ IResourceVisitor visitor= resource1 -> {
+ switch (resource1.getType()) {
+ case IResource.PROJECT:
+ case IResource.FOLDER:
+ case IResource.FILE:
+ resources.add(resource1);
+ return true;
}
+ return true;
};
try {
resource.accept(visitor);
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticModificationValidator.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticModificationValidator.java
index e8c286b2c..427d39f7e 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticModificationValidator.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/PessimisticModificationValidator.java
@@ -234,31 +234,29 @@ public class PessimisticModificationValidator
if (shell != null && !shell.isDisposed()) {
Display display = shell.getDisplay();
final Set[] result = {resources};
- display.syncExec(new Runnable() {
- public void run() {
- ILabelProvider labelProvider= new WorkbenchLabelProvider();
- Object[] resourceArray= result[0].toArray();
- ITreeContentProvider contentProvider= new ResourceSetContentProvider(result[0]);
- CheckedTreeSelectionDialog dialog= new CheckedTreeSelectionDialog(shell, labelProvider, contentProvider);
- dialog.setMessage("Select resources to be checked out.");
- dialog.setTitle("Check out resources");
- dialog.setContainerMode(true);
- dialog.setBlockOnOpen(true);
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
- dialog.setExpandedElements(resourceArray);
- dialog.setInitialSelections(resourceArray);
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- int status= dialog.open();
- result[0]= null;
- if (status == Window.OK) {
- Object[] results= dialog.getResult();
- result[0] = new HashSet(results.length);
- for (int i= 0; i < results.length; i++) {
- result[0].add(results[i]);
- }
- } else if(status == Window.CANCEL) {
- statusCode[0] = IStatus.CANCEL;
+ display.syncExec(() -> {
+ ILabelProvider labelProvider= new WorkbenchLabelProvider();
+ Object[] resourceArray= result[0].toArray();
+ ITreeContentProvider contentProvider= new ResourceSetContentProvider(result[0]);
+ CheckedTreeSelectionDialog dialog= new CheckedTreeSelectionDialog(shell, labelProvider, contentProvider);
+ dialog.setMessage("Select resources to be checked out.");
+ dialog.setTitle("Check out resources");
+ dialog.setContainerMode(true);
+ dialog.setBlockOnOpen(true);
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ dialog.setExpandedElements(resourceArray);
+ dialog.setInitialSelections(resourceArray);
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ int status= dialog.open();
+ result[0]= null;
+ if (status == Window.OK) {
+ Object[] results= dialog.getResult();
+ result[0] = new HashSet(results.length);
+ for (int i= 0; i < results.length; i++) {
+ result[0].add(results[i]);
}
+ } else if(status == Window.CANCEL) {
+ statusCode[0] = IStatus.CANCEL;
}
});
resources= result[0];
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ResourceChangeListener.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ResourceChangeListener.java
index 8b0a53d25..9c54c219a 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ResourceChangeListener.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ResourceChangeListener.java
@@ -132,28 +132,24 @@ public class ResourceChangeListener implements IResourceDeltaVisitor, IResourceC
}
if (!fRemoved.isEmpty() || !fAdded.isEmpty()) {
- final IWorkspaceRunnable workspaceRunnable= new IWorkspaceRunnable() {
- public void run(final IProgressMonitor monitor) {
- if (!fRemoved.isEmpty()) {
- remove(monitor);
- }
-
- if (!fAdded.isEmpty()) {
- add(monitor);
- }
+ final IWorkspaceRunnable workspaceRunnable= monitor -> {
+ if (!fRemoved.isEmpty()) {
+ remove(monitor);
}
+
+ if (!fAdded.isEmpty()) {
+ add(monitor);
+ }
};
// must fork since we are in resource callback.
- Runnable run= new Runnable() {
- public void run() {
- try {
- IWorkspace workspace= ResourcesPlugin.getWorkspace();
- if (workspace != null) {
- workspace.run(workspaceRunnable, null);
- }
- } catch (CoreException e) {
- PessimisticFilesystemProviderPlugin.getInstance().logError(e, "Problems encountered during attempt to add/remove control.");
+ Runnable run= () -> {
+ try {
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ if (workspace != null) {
+ workspace.run(workspaceRunnable, null);
}
+ } catch (CoreException e) {
+ PessimisticFilesystemProviderPlugin.getInstance().logError(e, "Problems encountered during attempt to add/remove control.");
}
};
new Thread(run).start();
@@ -188,29 +184,27 @@ public class ResourceChangeListener implements IResourceDeltaVisitor, IResourceC
final Shell shell= getShell();
if (shell != null && !shell.isDisposed()) {
final Set resources= new HashSet(fAdded);
- Runnable run= new Runnable() {
- public void run() {
- CheckedTreeSelectionDialog dialog= new CheckedTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new ResourceSetContentProvider(resources));
- dialog.setMessage("Select the resources to be added to the control of the repository.");
- dialog.setTitle("Add resources to control");
- dialog.setContainerMode(true);
- dialog.setBlockOnOpen(true);
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
- Object[] resourceArray= resources.toArray();
- dialog.setExpandedElements(resourceArray);
- dialog.setInitialSelections(resourceArray);
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- int status= dialog.open();
-
- if (status == Window.OK) {
- Object[] results= dialog.getResult();
- if (results != null) {
- Set resources= new HashSet(results.length);
- for (int i= 0; i < results.length; i++) {
- resources.add(results[i]);
- }
- addToControl(resources, monitor);
+ Runnable run= () -> {
+ CheckedTreeSelectionDialog dialog= new CheckedTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new ResourceSetContentProvider(resources));
+ dialog.setMessage("Select the resources to be added to the control of the repository.");
+ dialog.setTitle("Add resources to control");
+ dialog.setContainerMode(true);
+ dialog.setBlockOnOpen(true);
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ Object[] resourceArray= resources.toArray();
+ dialog.setExpandedElements(resourceArray);
+ dialog.setInitialSelections(resourceArray);
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ int status= dialog.open();
+
+ if (status == Window.OK) {
+ Object[] results= dialog.getResult();
+ if (results != null) {
+ Set resources1= new HashSet(results.length);
+ for (int i= 0; i < results.length; i++) {
+ resources1.add(results[i]);
}
+ addToControl(resources1, monitor);
}
}
};
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/AddToControlAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/AddToControlAction.java
index 6f30a0c4f..654a17ad5 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/AddToControlAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/AddToControlAction.java
@@ -20,7 +20,6 @@ import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.examples.pessimistic.PessimisticFilesystemProvider;
@@ -52,17 +51,15 @@ public class AddToControlAction extends PessimisticProviderAction {
}
if (!resourceSet.isEmpty()) {
final Map byProject= sortByProject(resourceSet);
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- for (Iterator i= byProject.keySet().iterator(); i.hasNext();) {
- IProject project= (IProject) i.next();
- PessimisticFilesystemProvider provider= getProvider(project);
- if (provider != null) {
- Set set= (Set)byProject.get(project);
- IResource[] resources= new IResource[set.size()];
- set.toArray(resources);
- provider.addToControl(resources, monitor);
- }
+ IRunnableWithProgress runnable= monitor -> {
+ for (Iterator i= byProject.keySet().iterator(); i.hasNext();) {
+ IProject project= (IProject) i.next();
+ PessimisticFilesystemProvider provider= getProvider(project);
+ if (provider != null) {
+ Set set= (Set)byProject.get(project);
+ IResource[] resources1= new IResource[set.size()];
+ set.toArray(resources1);
+ provider.addToControl(resources1, monitor);
}
}
};
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/DisconnectAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/DisconnectAction.java
index ee664702e..2a3f8ea27 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/DisconnectAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/DisconnectAction.java
@@ -22,7 +22,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.core.RepositoryProvider;
@@ -53,31 +52,26 @@ public class DisconnectAction extends PessimisticProviderAction {
}
}
if (!projects.isEmpty()) {
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor)
- throws CoreException {
- for (Iterator i= projects.iterator(); i.hasNext();) {
- IProject project= (IProject) i.next();
- PessimisticFilesystemProvider provider= getProvider(project);
- if (provider != null) {
- try {
- RepositoryProvider.unmap(project);
- } catch (TeamException e) {
- PessimisticFilesystemProviderPlugin.getInstance().logError(e, "Could not unmap " + project);
- }
- }
- }
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run(runnable, monitor);
- } catch (CoreException e) {
- PessimisticFilesystemProviderPlugin.getInstance().logError(e, "Problem during unmap runnable");
+ IRunnableWithProgress runnable= monitor -> {
+ IWorkspaceRunnable runnable1= monitor1 -> {
+ for (Iterator i= projects.iterator(); i.hasNext();) {
+ IProject project= (IProject) i.next();
+ PessimisticFilesystemProvider provider= getProvider(project);
+ if (provider != null) {
+ try {
+ RepositoryProvider.unmap(project);
+ } catch (TeamException e1) {
+ PessimisticFilesystemProviderPlugin.getInstance().logError(e1, "Could not unmap " + project);
+ }
}
-
}
+};
+ try {
+ ResourcesPlugin.getWorkspace().run(runnable1, monitor);
+ } catch (CoreException e2) {
+ PessimisticFilesystemProviderPlugin.getInstance().logError(e2, "Problem during unmap runnable");
+ }
+
};
runWithProgressDialog(runnable);
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/PessimisticDecorator.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/PessimisticDecorator.java
index cfbdbdd56..a5a66078c 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/PessimisticDecorator.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/PessimisticDecorator.java
@@ -88,11 +88,9 @@ public class PessimisticDecorator extends LabelProvider implements ILabelDecorat
*/
private void postLabelEvents(final LabelProviderChangedEvent[] events) {
if (events != null && events.length > 0) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- for (int i= 0; i < events.length; i++) {
- fireLabelProviderChanged(events[i]);
- }
+ Display.getDefault().asyncExec(() -> {
+ for (int i= 0; i < events.length; i++) {
+ fireLabelProviderChanged(events[i]);
}
});
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/RemoveFromControlAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/RemoveFromControlAction.java
index 6b014987e..ba24b1251 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/RemoveFromControlAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/RemoveFromControlAction.java
@@ -20,7 +20,6 @@ import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.examples.pessimistic.PessimisticFilesystemProvider;
@@ -49,17 +48,15 @@ public class RemoveFromControlAction extends PessimisticProviderAction {
}
if (!resourceSet.isEmpty()) {
final Map byProject= sortByProject(resourceSet);
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- for (Iterator i= byProject.keySet().iterator(); i.hasNext();) {
- IProject project= (IProject) i.next();
- PessimisticFilesystemProvider provider= getProvider(project);
- if (provider != null) {
- Set set= (Set)byProject.get(project);
- IResource[] resources= new IResource[set.size()];
- set.toArray(resources);
- provider.removeFromControl(resources, monitor);
- }
+ IRunnableWithProgress runnable= monitor -> {
+ for (Iterator i= byProject.keySet().iterator(); i.hasNext();) {
+ IProject project= (IProject) i.next();
+ PessimisticFilesystemProvider provider= getProvider(project);
+ if (provider != null) {
+ Set set= (Set)byProject.get(project);
+ IResource[] resources1= new IResource[set.size()];
+ set.toArray(resources1);
+ provider.removeFromControl(resources1, monitor);
}
}
};
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java
index 260835a1b..ffe6985cd 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/pessimistic/ui/SourceManagementAction.java
@@ -50,17 +50,15 @@ public abstract class SourceManagementAction extends PessimisticProviderAction {
}
if (!resourceSet.isEmpty()) {
final Map byProject= sortByProject(resourceSet);
- IRunnableWithProgress runnable= new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- for (Iterator i= byProject.keySet().iterator(); i.hasNext();) {
- IProject project= (IProject) i.next();
- PessimisticFilesystemProvider provider= getProvider(project);
- if (provider != null) {
- Set set= (Set)byProject.get(project);
- IResource[] resources= new IResource[set.size()];
- set.toArray(resources);
- manageResources(provider, resources, monitor);
- }
+ IRunnableWithProgress runnable= monitor -> {
+ for (Iterator i= byProject.keySet().iterator(); i.hasNext();) {
+ IProject project= (IProject) i.next();
+ PessimisticFilesystemProvider provider= getProvider(project);
+ if (provider != null) {
+ Set set= (Set)byProject.get(project);
+ IResource[] resources1= new IResource[set.size()];
+ set.toArray(resources1);
+ manageResources(provider, resources1, monitor);
}
}
};
diff --git a/tests/org.eclipse.team.tests.core/META-INF/MANIFEST.MF b/tests/org.eclipse.team.tests.core/META-INF/MANIFEST.MF
index e17d6c142..3b156d5e0 100644
--- a/tests/org.eclipse.team.tests.core/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.team.tests.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.team.tests.core; singleton:=true
-Bundle-Version: 3.8.200.qualifier
+Bundle-Version: 3.8.300.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.team.tests.core,
diff --git a/tests/org.eclipse.team.tests.core/pom.xml b/tests/org.eclipse.team.tests.core/pom.xml
index 07cf94dc2..fd875a66d 100644
--- a/tests/org.eclipse.team.tests.core/pom.xml
+++ b/tests/org.eclipse.team.tests.core/pom.xml
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.team</groupId>
<artifactId>org.eclipse.team.tests.core</artifactId>
- <version>3.8.200-SNAPSHOT</version>
+ <version>3.8.300-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/PessimisticRepositoryProvider.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/PessimisticRepositoryProvider.java
index 8ec075dd3..cf1f8bf60 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/PessimisticRepositoryProvider.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/regression/PessimisticRepositoryProvider.java
@@ -19,10 +19,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.RepositoryProvider;
/**
@@ -63,14 +60,12 @@ public class PessimisticRepositoryProvider extends RepositoryProvider implements
if (markWritableOnEdit) {
try {
ResourcesPlugin.getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- for (int i = 0, length = files.length; i < length; i++) {
- try {
- setReadOnly(files[i], false);
- } catch (CoreException e) {
- e.printStackTrace();
- }
+ (IWorkspaceRunnable) monitor -> {
+ for (int i = 0, length = files.length; i < length; i++) {
+ try {
+ setReadOnly(files[i], false);
+ } catch (CoreException e) {
+ e.printStackTrace();
}
}
},
diff --git a/tests/org.eclipse.team.tests.cvs.core/META-INF/MANIFEST.MF b/tests/org.eclipse.team.tests.cvs.core/META-INF/MANIFEST.MF
index f3d5fe911..ea5538ad6 100644
--- a/tests/org.eclipse.team.tests.cvs.core/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.team.tests.cvs.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.team.tests.cvs.core; singleton:=true
-Bundle-Version: 3.4.300.qualifier
+Bundle-Version: 3.4.400.qualifier
Bundle-Activator: org.eclipse.team.tests.ccvs.core.TeamCVSTestPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/tests/org.eclipse.team.tests.cvs.core/pom.xml b/tests/org.eclipse.team.tests.cvs.core/pom.xml
index a1496b70e..2affa4f3b 100644
--- a/tests/org.eclipse.team.tests.cvs.core/pom.xml
+++ b/tests/org.eclipse.team.tests.cvs.core/pom.xml
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.team</groupId>
<artifactId>org.eclipse.team.tests.cvs.core</artifactId>
- <version>3.4.300-SNAPSHOT</version>
+ <version>3.4.400-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
index 6fbcc5200..4e9a3bf89 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
@@ -97,7 +97,6 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourceAttributes;
@@ -872,14 +871,11 @@ public class EclipseTest extends ResourceTest {
protected void assertReadOnly(IResource[] resources, final boolean isReadOnly, final boolean recurse) throws CoreException {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- resource.accept(new IResourceVisitor() {
- @Override
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) {
- assertEquals(isReadOnly, resource.getResourceAttributes().isReadOnly());
- }
- return recurse;
+ resource.accept(resource1 -> {
+ if (resource1.getType() == IResource.FILE) {
+ assertEquals(isReadOnly, resource1.getResourceAttributes().isReadOnly());
}
+ return recurse;
});
}
}
@@ -1416,16 +1412,13 @@ public class EclipseTest extends ResourceTest {
private void ensureNotReadOnly(IResource resource) {
if (resource.exists()) {
try {
- resource.accept(new IResourceVisitor() {
- @Override
- public boolean visit(IResource resource) throws CoreException {
- ResourceAttributes attrs = resource.getResourceAttributes();
- if (resource.exists() && attrs.isReadOnly()) {
- attrs.setReadOnly(false);
- resource.setResourceAttributes(attrs);
- }
- return true;
+ resource.accept(resource1 -> {
+ ResourceAttributes attrs = resource1.getResourceAttributes();
+ if (resource1.exists() && attrs.isReadOnly()) {
+ attrs.setReadOnly(false);
+ resource1.setResourceAttributes(attrs);
}
+ return true;
});
} catch (CoreException e) {
fail("#ensureNotReadOnly " + resource.getFullPath(), e);
@@ -1440,28 +1433,25 @@ public class EclipseTest extends ResourceTest {
*/
public void ensureDoesNotExistInWorkspace(final IProject[] projects) {
final Map<IProject, CoreException> failures = new HashMap<IProject, CoreException>();
- IWorkspaceRunnable body = new IWorkspaceRunnable() {
- @Override
- public void run(IProgressMonitor monitor) {
- for (int i = 0; i < projects.length; i++) {
- try {
- if (projects[i].exists()) {
- try {
+ IWorkspaceRunnable body = monitor -> {
+ for (int i = 0; i < projects.length; i++) {
+ try {
+ if (projects[i].exists()) {
+ try {
+ projects[i].delete(true, null);
+ } catch (CoreException e1) {
+ // Ignore the exception and try again after making
+ // sure the project doesn't contain any read-only resources
+ ensureNotReadOnly(projects[i]);
+ if (projects[i].exists()) {
+ projects[i].refreshLocal(IResource.DEPTH_INFINITE, null);
projects[i].delete(true, null);
- } catch (CoreException e) {
- // Ignore the exception and try again after making
- // sure the project doesn't contain any read-only resources
- ensureNotReadOnly(projects[i]);
- if (projects[i].exists()) {
- projects[i].refreshLocal(IResource.DEPTH_INFINITE, null);
- projects[i].delete(true, null);
- }
}
}
- } catch (CoreException e) {
- write(new CVSStatus(IStatus.ERROR, "Could not delete project " + projects[i].getName(), e), 0);
- failures.put(projects[i], e);
}
+ } catch (CoreException e2) {
+ write(new CVSStatus(IStatus.ERROR, "Could not delete project " + projects[i].getName(), e2), 0);
+ failures.put(projects[i], e2);
}
}
};
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseFolderTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseFolderTest.java
index 24d3eeb33..a35827b6a 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseFolderTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseFolderTest.java
@@ -20,12 +20,10 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
@@ -82,17 +80,15 @@ public class EclipseFolderTest extends EclipseTest {
assertChildrenHaveSync(projectB, true);
// test that unmanaging in a CVS runnable flushes too
- cvsProjectB.run(new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- assertChildrenHaveSync(projectB, true);
- cvsProjectB.unmanage(null);
- assertChildrenHaveSync(projectB, false);
- } catch(CoreException e) {
- throw CVSException.wrapException(e);
- }
+ cvsProjectB.run(monitor -> {
+ try {
+ assertChildrenHaveSync(projectB, true);
+ cvsProjectB.unmanage(null);
+ assertChildrenHaveSync(projectB, false);
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
}
- }, null);
+ }, null);
assertChildrenHaveSync(projectB, false);
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
index 22a17a1f3..ea95e3ec4 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
@@ -33,7 +33,6 @@ import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.Team;
@@ -42,7 +41,6 @@ import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
@@ -875,25 +873,23 @@ public class EclipseSynchronizerTest extends EclipseTest {
// Create a project with dummy sync info
final IProject project = createProject(new String[] {"folder1/file1", "folder1/file2"});
- sync.run(project, new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- IFile file1 = project.getFile("folder1/file1");
- IFile file2 = project.getFile("folder1/file2");
- // Delete file 1
- file1.delete(false, false, null);
- assertHasSyncInfo(file1);
- assertHasSyncInfo(file2);
- sync.deleteResourceSync(file1);
- assertHasNoSyncInfo(file1);
- assertHasSyncInfo(file2);
- // Move file 2
- file2.move(new Path("file3"), false, false, null);
- assertHasNoSyncInfo(file1);
- assertHasSyncInfo(file2);
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
+ sync.run(project, monitor -> {
+ try {
+ IFile file1 = project.getFile("folder1/file1");
+ IFile file2 = project.getFile("folder1/file2");
+ // Delete file 1
+ file1.delete(false, false, null);
+ assertHasSyncInfo(file1);
+ assertHasSyncInfo(file2);
+ sync.deleteResourceSync(file1);
+ assertHasNoSyncInfo(file1);
+ assertHasSyncInfo(file2);
+ // Move file 2
+ file2.move(new Path("file3"), false, false, null);
+ assertHasNoSyncInfo(file1);
+ assertHasSyncInfo(file2);
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
}
}, null);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java
index 8dc981dcf..0224464d3 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java
@@ -31,7 +31,6 @@ import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
@@ -204,11 +203,9 @@ public class CreatePatchTest extends EclipseTest {
assertTrue(totalWaited < 2500);
}
try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ret[0] = filterStream(file.getContents(), prefixesToIgnore);
- }
- }, file, IResource.NONE, null);
+ ResourcesPlugin.getWorkspace().run(
+ (IWorkspaceRunnable) monitor -> ret[0] = filterStream(file.getContents(), prefixesToIgnore), file,
+ IResource.NONE, null);
} catch (CoreException e) {
fail(e.getMessage());
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/Bug152581Test.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/Bug152581Test.java
index 2c509dfb9..90c89a3f5 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/Bug152581Test.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/Bug152581Test.java
@@ -73,11 +73,7 @@ public class Bug152581Test extends BenchmarkTest {
}
public void ensureExistsInWorkspace(final IResource resource, final boolean local) {
- IWorkspaceRunnable body = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- create(resource, local);
- }
- };
+ IWorkspaceRunnable body = monitor -> create(resource, local);
try {
getWorkspace().run(body, null);
} catch (CoreException e) {

Back to the top