Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-04-18 08:33:32 -0400
committerAlexander Kurtakov2018-04-18 08:33:32 -0400
commitb771accd19e5806552c113be35e86e4f8bd9429b (patch)
treee8fe88ca4f7a7404457c36462380ae710ee64377
parent8130327f4416d4b951c1daaa60eceb0b793307b5 (diff)
downloadeclipse.platform.team-b771accd19e5806552c113be35e86e4f8bd9429b.tar.gz
eclipse.platform.team-b771accd19e5806552c113be35e86e4f8bd9429b.tar.xz
eclipse.platform.team-b771accd19e5806552c113be35e86e4f8bd9429b.zip
Bug 533755 - Direct use of IStructuredSelectionI20180420-2000I20180419-2000I20180418-2000
Instead of getSelection and cast. Touched files have been converted to lambdas and useless @see comments removed. Change-Id: I249927f61cab0dfd2a1645b6aee3b0a1cc9760f1 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java4
-rw-r--r--bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/preference/PreferencePage.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.core.prefs46
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.ui.prefs59
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java82
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java423
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java93
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java39
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsDialog.java117
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsTable.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java105
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java190
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java86
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java200
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizardSelectionPage.java93
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java45
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java10
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.java10
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java19
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergePage.java31
32 files changed, 849 insertions, 932 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
index b083e705f..3d24aefdd 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2017 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -220,7 +220,7 @@ public class PreviewPatchPage2 extends WizardPage {
fMoveAction .setToolTipText(PatchMessages.PreviewPatchPage2_RetargetTooltip);
fMoveAction.setEnabled(true);
fInput.getViewer().addSelectionChangedListener(event -> {
- IStructuredSelection sel= (IStructuredSelection) event.getSelection();
+ IStructuredSelection sel= event.getStructuredSelection();
Object obj= sel.getFirstElement();
boolean enable = false;
if (obj instanceof PatchProjectDiffNode) {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
index 42edcd234..fd8cc35e8 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2017 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -183,7 +183,7 @@ class RetargetPatchElementDialog extends Dialog {
void setupListeners() {
fViewer.addSelectionChangedListener(event -> {
- IStructuredSelection s= (IStructuredSelection) event.getSelection();
+ IStructuredSelection s= event.getStructuredSelection();
Object obj= s.getFirstElement();
if (obj instanceof IResource){
fSelectedResource = (IResource) obj;
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 2c8359675..ae32af140 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1385,7 +1385,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
void removeHostKey(){
- IStructuredSelection selection=(IStructuredSelection)viewer.getSelection();
+ IStructuredSelection selection=viewer.getStructuredSelection();
HostKeyRepository hkr=getJSch().getHostKeyRepository();
for(Iterator iterator=selection.iterator(); iterator.hasNext();){
HostKey hostkey=(HostKey)iterator.next();
diff --git a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.core.prefs
index 2299778fb..56f040d5b 100644
--- a/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.team.cvs.ui/.settings/org.eclipse.jdt.core.prefs
@@ -7,6 +7,15 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
@@ -16,15 +25,19 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
@@ -32,6 +45,7 @@ org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
@@ -40,40 +54,70 @@ org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disable
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
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 667149aae..515e129fe 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
@@ -1,6 +1,63 @@
-#Wed Jul 18 10:32:47 EDT 2007
eclipse.preferences.version=1
+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 * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\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
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+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.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+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_type_arguments=false
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
index 8de22e87f..4a28a8958 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
@@ -13,13 +13,8 @@ package org.eclipse.team.internal.ccvs.ui;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IStructureComparator;
+import org.eclipse.compare.*;
+import org.eclipse.compare.structuremergeviewer.*;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.*;
@@ -272,16 +267,12 @@ public class CVSCompareEditorInput extends CompareEditorInput {
}
}
- /* (Non-javadoc)
- * Method declared on CompareEditorInput
- */
+ @Override
public boolean isSaveNeeded() {
return false;
}
- /* (non-Javadoc)
- * Method declared on CompareEditorInput
- */
+ @Override
protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
final boolean threeWay = ancestor != null;
if (right == null || left == null) {
@@ -292,6 +283,7 @@ public class CVSCompareEditorInput extends CompareEditorInput {
initLabels();
final Differencer d = new Differencer() {
+ @Override
protected boolean contentsEqual(Object input1, Object input2) {
int compare = teamEqual(input1, input2);
if (compare == NODE_EQUAL) {
@@ -303,6 +295,7 @@ public class CVSCompareEditorInput extends CompareEditorInput {
//revert to slow content comparison
return super.contentsEqual(input1, input2);
}
+ @Override
protected void updateProgress(IProgressMonitor progressMonitor, Object node) {
if (node instanceof ITypedElement) {
ITypedElement element = (ITypedElement)node;
@@ -310,6 +303,7 @@ public class CVSCompareEditorInput extends CompareEditorInput {
progressMonitor.worked(1);
}
}
+ @Override
protected Object[] getChildren(Object input) {
if (input instanceof IStructureComparator) {
Object[] children= ((IStructureComparator)input).getChildren();
@@ -318,6 +312,7 @@ public class CVSCompareEditorInput extends CompareEditorInput {
}
return null;
}
+ @Override
protected Object visit(Object data, int result, Object ancestor, Object left, Object right) {
return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
}
@@ -406,40 +401,35 @@ public class CVSCompareEditorInput extends CompareEditorInput {
return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS);
}
+ @Override
public Viewer createDiffViewer(Composite parent) {
final Viewer viewer = super.createDiffViewer(parent);
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- CompareConfiguration cc = getCompareConfiguration();
- setLabels(cc, (IStructuredSelection)event.getSelection());
- }
+ viewer.addSelectionChangedListener(event -> {
+ CompareConfiguration cc = getCompareConfiguration();
+ setLabels(cc, event.getStructuredSelection());
+ });
+ ((StructuredViewer)viewer).addOpenListener(event -> {
+ ISelection selection = event.getSelection();
+ if (! selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Object o = ((IStructuredSelection)selection).getFirstElement();
+ if (o instanceof DiffNode) {
+ updateLabelsFor((DiffNode)o);
+ }
+ }
+ });
+ ((StructuredViewer)viewer).addDoubleClickListener(event -> {
+ ISelection selection = event.getSelection();
+ if (! selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Object o = ((IStructuredSelection)selection).getFirstElement();
+ if (o instanceof DiffNode) {
+ DiffNode diffNode = ((DiffNode)o);
+ if (diffNode.hasChildren()) {
+ AbstractTreeViewer atv = ((AbstractTreeViewer)viewer);
+ atv.setExpandedState(o, !atv.getExpandedState(o));
+ }
+ }
+ }
});
- ((StructuredViewer)viewer).addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- ISelection selection = event.getSelection();
- if (! selection.isEmpty() && selection instanceof IStructuredSelection) {
- Object o = ((IStructuredSelection)selection).getFirstElement();
- if (o instanceof DiffNode) {
- updateLabelsFor((DiffNode)o);
- }
- }
- }
- });
- ((StructuredViewer)viewer).addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if (! selection.isEmpty() && selection instanceof IStructuredSelection) {
- Object o = ((IStructuredSelection)selection).getFirstElement();
- if (o instanceof DiffNode) {
- DiffNode diffNode = ((DiffNode)o);
- if (diffNode.hasChildren()) {
- AbstractTreeViewer atv = ((AbstractTreeViewer)viewer);
- atv.setExpandedState(o, !atv.getExpandedState(o));
- }
- }
- }
- }
- });
return viewer;
}
@@ -466,9 +456,7 @@ public class CVSCompareEditorInput extends CompareEditorInput {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#getToolTipText()
- */
+ @Override
public String getToolTipText() {
if (toolTipText != null) {
return toolTipText;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
index 339c3bad6..40fa24516 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
@@ -27,7 +27,6 @@ import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.*;
import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.*;
import org.eclipse.jface.text.revisions.Revision;
@@ -215,9 +214,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
this.sortAscending = sortAscending;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
+ @Override
public void run() {
sortTagsAscending = sortAscending;
tagViewer.refresh();
@@ -225,6 +222,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
}
+ @Override
public void createControl(Composite parent) {
initializeImages();
@@ -246,11 +244,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
searchField = new Text(searchSashForm, SWT.SEARCH);
searchField.setMessage(CVSUIMessages.CVSHistoryPage_EnterSearchTerm);
final SearchHistoryTable searchHistoryTable = new SearchHistoryTable();
- searchField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e){
- Display.getDefault().timerExec(1000, searchHistoryTable);
- }
- });
+ searchField.addModifyListener(e -> Display.getDefault().timerExec(1000, searchHistoryTable));
contributeActions();
setViewerVisibility();
@@ -271,11 +265,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
PlatformUI.getWorkbench().getHelpSystem().setHelp(sashForm, IHelpContextIds.RESOURCE_HISTORY_VIEW);
- disposeListener = new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- saveState();
- }
- };
+ disposeListener = e -> saveState();
parent.addDisposeListener(disposeListener);
}
@@ -315,10 +305,12 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
SourceViewer result = new SourceViewer(parent, null, null, true, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.READ_ONLY);
result.getTextWidget().setIndent(2);
result.configure(new TextSourceViewerConfiguration(EditorsUI.getPreferenceStore()) {
- protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
+ @Override
+ protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
return Collections.singletonMap("org.eclipse.ui.DefaultTextEditor", //$NON-NLS-1$
new IAdaptable() {
- public <T> T getAdapter(Class<T> adapter) {
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
if(adapter==IFile.class && getInput() instanceof IFile) {
return adapter.cast(getInput());
} else if(adapter==IFileHistory.class && getInput() instanceof IFileHistory) {
@@ -330,11 +322,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
}
});
- result.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- copyAction.update();
- }
- });
+ result.addSelectionChangedListener(event -> copyAction.update());
result.setTextDoubleClickStrategy(
new DefaultTextDoubleClickStrategy(),
IDocument.DEFAULT_CONTENT_TYPE);
@@ -349,6 +337,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
layout.addColumnData(new ColumnWeightData(100));
table.setLayout(layout);
result.setContentProvider(new SimpleContentProvider() {
+ @Override
public Object[] getElements(Object inputElement) {
if (inputElement == null)
return new Object[0];
@@ -357,6 +346,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
}
});
result.setLabelProvider(new LabelProvider() {
+ @Override
public Image getImage(Object element) {
if (element == null)
return null;
@@ -374,11 +364,13 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return null;
}
+ @Override
public String getText(Object element) {
return ((ITag) element).getName();
}
});
result.setComparator(new ViewerComparator() {
+ @Override
public int compare(Viewer viewer, Object e1, Object e2) {
if (!(e1 instanceof ITag) || !(e2 instanceof ITag))
return super.compare(viewer, e1, e2);
@@ -395,22 +387,19 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return super.compare(viewer, tag2, tag1);
}
});
- result.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- copyTagAction.setEnabled(false);
- if (event.getSelection() instanceof StructuredSelection) {
- if (((StructuredSelection) event.getSelection()).getFirstElement() != null) {
- copyTagAction.setEnabled(true);
- }
+ result.addSelectionChangedListener(event -> {
+ copyTagAction.setEnabled(false);
+ if (event.getSelection() instanceof StructuredSelection) {
+ if (((StructuredSelection) event.getSelection()).getFirstElement() != null) {
+ copyTagAction.setEnabled(true);
}
-
}
});
return result;
}
+ @Override
public void setFocus() {
sashForm.setFocus();
if (refreshRequest != 0) {
@@ -424,6 +413,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Refresh
refreshAction = new Action(CVSUIMessages.HistoryView_refreshLabel, plugin.getImageDescriptor(ICVSUIConstants.IMG_REFRESH_ENABLED)) {
+ @Override
public void run() {
refresh();
}
@@ -435,6 +425,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Local Mode
final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
localMode = new Action(CVSUIMessages.CVSHistoryPage_LocalModeAction, plugin.getImageDescriptor(ICVSUIConstants.IMG_LOCALMODE)) {
+ @Override
public void run() {
if (isChecked()){
store.setValue(ICVSUIConstants.PREF_REVISION_MODE, LOCAL_MODE);
@@ -449,6 +440,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Remote Mode
remoteMode = new Action(CVSUIMessages.CVSHistoryPage_RemoteModeAction, plugin.getImageDescriptor(ICVSUIConstants.IMG_REMOTEMODE)) {
+ @Override
public void run() {
if (isChecked()){
store.setValue(ICVSUIConstants.PREF_REVISION_MODE, REMOTE_MODE);
@@ -463,6 +455,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Remote + Local Mode
remoteLocalMode = new Action(CVSUIMessages.CVSHistoryPage_CombinedModeAction, plugin.getImageDescriptor(ICVSUIConstants.IMG_LOCALREMOTE_MODE)) {
+ @Override
public void run() {
if (isChecked()){
store.setValue(ICVSUIConstants.PREF_REVISION_MODE, REMOTE_LOCAL_MODE);
@@ -480,6 +473,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Group by Date
groupByDateMode = new Action(CVSUIMessages.CVSHistoryPage_GroupByDate, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY)){
+ @Override
public void run() {
groupingOn = !groupingOn;
store.setValue(ICVSUIConstants.PREF_GROUPBYDATE_MODE, groupingOn);
@@ -494,6 +488,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Collapse All
collapseAll = new Action(CVSUIMessages.CVSHistoryPage_CollapseAllAction, plugin.getImageDescriptor(ICVSUIConstants.IMG_COLLAPSE_ALL)) {
+ @Override
public void run() {
treeViewer.collapseAll();
}
@@ -504,6 +499,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Compare Mode Action
compareModeAction = new Action(CVSUIMessages.CVSHistoryPage_CompareModeToggleAction,plugin.getImageDescriptor(ICVSUIConstants.IMG_COMPARE_VIEW)) {
+ @Override
public void run() {
compareMode = !compareMode;
compareModeAction.setChecked(compareMode);
@@ -518,30 +514,34 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
compareAction = new CompareRevisionAction(CVSUIMessages.CVSHistoryPage_CompareRevisionAction, this);
compareAction.setEnabled(!treeViewer.getSelection().isEmpty());
treeViewer.getTree().addSelectionListener(new SelectionAdapter(){
+ @Override
public void widgetSelected(SelectionEvent e) {
//update the current
compareAction.setCurrentFileRevision(getCurrentFileRevision());
- compareAction.selectionChanged((IStructuredSelection) treeViewer.getSelection());
+ compareAction.selectionChanged(treeViewer.getStructuredSelection());
}
});
openAction = new OpenRevisionAction(CVSUIMessages.CVSHistoryPage_OpenAction, this);
openAction.setEnabled(!treeViewer.getSelection().isEmpty());
treeViewer.getTree().addSelectionListener(new SelectionAdapter(){
+ @Override
public void widgetSelected(SelectionEvent e) {
- openAction.selectionChanged((IStructuredSelection) treeViewer.getSelection());
+ openAction.selectionChanged(treeViewer.getStructuredSelection());
}
});
// Add 'Open With...' sub-menu
openWithMenu = new OpenWithMenu(this);
treeViewer.getTree().addSelectionListener(new SelectionAdapter(){
+ @Override
public void widgetSelected(SelectionEvent e) {
- openWithMenu.selectionChanged((IStructuredSelection) treeViewer.getSelection());
+ openWithMenu.selectionChanged(treeViewer.getStructuredSelection());
}
});
new OpenAndLinkWithEditorHelper(treeViewer) {
+ @Override
protected void open(ISelection selection, boolean activate) {
if (getSite() != null && selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection= (IStructuredSelection)selection;
@@ -557,6 +557,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
}
}
+ @Override
protected void activate(ISelection selection) {
int currentMode= OpenStrategy.getOpenMethod();
try {
@@ -567,62 +568,56 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
}
}
+ @Override
protected void linkToEditor(ISelection selection) {
// XXX: Not yet implemented, see http://bugs.eclipse.org/324185
}
};
- getContentsAction = getContextMenuAction(CVSUIMessages.HistoryView_getContentsAction, true /* needs progress */, new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(null, 100);
- try {
- if(confirmOverwrite() && validateChange()) {
- IStorage currentStorage = currentSelection.getStorage(SubMonitor.convert(monitor, 50));
- InputStream in = currentStorage.getContents();
- ((IFile)file.getIResource()).setContents(in, false, true, SubMonitor.convert(monitor, 50));
- }
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- } finally {
- monitor.done();
+ getContentsAction = getContextMenuAction(CVSUIMessages.HistoryView_getContentsAction, true /* needs progress */, monitor -> {
+ monitor.beginTask(null, 100);
+ try {
+ if(confirmOverwrite() && validateChange()) {
+ IStorage currentStorage = currentSelection.getStorage(SubMonitor.convert(monitor, 50));
+ InputStream in = currentStorage.getContents();
+ ((IFile)file.getIResource()).setContents(in, false, true, SubMonitor.convert(monitor, 50));
}
+ } catch (TeamException e) {
+ throw new CoreException(e.getStatus());
+ } finally {
+ monitor.done();
}
});
PlatformUI.getWorkbench().getHelpSystem().setHelp(getContentsAction, IHelpContextIds.GET_FILE_CONTENTS_ACTION);
- getRevisionAction = getContextMenuAction(CVSUIMessages.HistoryView_getRevisionAction, true /* needs progress */, new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- ICVSRemoteFile remoteFile = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(((CVSFileRevision) currentSelection).getCVSRemoteFile());
- try {
- if(confirmOverwrite() && validateChange()) {
- CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
+ getRevisionAction = getContextMenuAction(CVSUIMessages.HistoryView_getRevisionAction, true /* needs progress */, monitor -> {
+ ICVSRemoteFile remoteFile = (ICVSRemoteFile) CVSWorkspaceRoot.getRemoteResourceFor(((CVSFileRevision) currentSelection).getCVSRemoteFile());
+ try {
+ if(confirmOverwrite() && validateChange()) {
+ CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
+
+ if(CVSAction.checkForMixingTags(getHistoryPageSite().getShell(), new IResource[] {file.getIResource()}, revisionTag)) {
+ new UpdateOperation(
+ null,
+ new IResource[] {file.getIResource()},
+ new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES},
+ revisionTag)
+ .run(monitor);
- if(CVSAction.checkForMixingTags(getHistoryPageSite().getShell(), new IResource[] {file.getIResource()}, revisionTag)) {
- new UpdateOperation(
- null,
- new IResource[] {file.getIResource()},
- new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES},
- revisionTag)
- .run(monitor);
-
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
+ Display.getDefault().asyncExec(() -> refresh());
}
- } catch (InvocationTargetException e) {
- throw CVSException.wrapException(e);
- } catch (InterruptedException e) {
- // Cancelled by user
}
+ } catch (InvocationTargetException e1) {
+ throw CVSException.wrapException(e1);
+ } catch (InterruptedException e2) {
+ // Cancelled by user
}
});
PlatformUI.getWorkbench().getHelpSystem().setHelp(getRevisionAction, IHelpContextIds.GET_FILE_REVISION_ACTION);
// Override MoveRemoteTagAction to work for log entries
final IActionDelegate tagActionDelegate = new MoveRemoteTagAction() {
+ @Override
protected ICVSResource[] getSelectedCVSResources() {
ICVSResource[] resources = super.getSelectedCVSResources();
if (resources == null || resources.length == 0) {
@@ -657,31 +652,30 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
* Override the creation of the tag operation in order to support
* the refresh of the view after the tag operation completes
*/
- protected ITagOperation createTagOperation() {
+ @Override
+ protected ITagOperation createTagOperation() {
return new TagInRepositoryOperation(getTargetPart(), getSelectedRemoteResources()) {
- public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
+ @Override
+ public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
super.execute(monitor);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if( ! wasCancelled()) {
- refresh();
- }
- }
- });
+ Display.getDefault().asyncExec(() -> {
+ if( ! wasCancelled()) {
+ refresh();
+ }
+ });
};
};
}
};
- tagWithExistingAction = getContextMenuAction(CVSUIMessages.HistoryView_tagWithExistingAction, false /* no progress */, new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- tagActionDelegate.selectionChanged(tagWithExistingAction, treeViewer.getSelection());
- tagActionDelegate.run(tagWithExistingAction);
- }
+ tagWithExistingAction = getContextMenuAction(CVSUIMessages.HistoryView_tagWithExistingAction, false /* no progress */, monitor -> {
+ tagActionDelegate.selectionChanged(tagWithExistingAction, treeViewer.getSelection());
+ tagActionDelegate.run(tagWithExistingAction);
});
PlatformUI.getWorkbench().getHelpSystem().setHelp(getRevisionAction, IHelpContextIds.TAG_WITH_EXISTING_ACTION);
// Toggle text visible action
toggleTextAction = new Action(TeamUIMessages.GenericHistoryView_ShowCommentViewer) {
+ @Override
public void run() {
setViewerVisibility();
store.setValue(ICVSUIConstants.PREF_SHOW_COMMENTS, toggleTextAction.isChecked());
@@ -692,6 +686,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
// Toggle wrap comments action
toggleTextWrapAction = new Action(TeamUIMessages.GenericHistoryView_WrapComments) {
+ @Override
public void run() {
setViewerVisibility();
store.setValue(ICVSUIConstants.PREF_WRAP_COMMENTS, toggleTextWrapAction.isChecked());
@@ -702,6 +697,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
// Toggle list visible action
toggleListAction = new Action(TeamUIMessages.GenericHistoryView_ShowTagViewer) {
+ @Override
public void run() {
setViewerVisibility();
store.setValue(ICVSUIConstants.PREF_SHOW_TAGS, toggleListAction.isChecked());
@@ -712,6 +708,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Toggle search field
toggleSearchAction= new Action(CVSUIMessages.CVSHistoryPage_ShowSearchField) {
+ @Override
public void run() {
setViewerVisibility();
store.setValue(ICVSUIConstants.PREF_SHOW_SEARCH, toggleSearchAction.isChecked());
@@ -729,6 +726,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleListAction, IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION);
toggleFilterAction = new Action(CVSUIMessages.CVSHistoryPage_NoFilter){
+ @Override
public void run(){
if (historyFilter != null)
treeViewer.removeFilter(historyFilter);
@@ -751,11 +749,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
//Contribute actions to popup menu
MenuManager menuMgr = new MenuManager();
Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTableMenu(menuMgr);
- }
- });
+ menuMgr.addMenuListener(menuMgr1 -> fillTableMenu(menuMgr1));
menuMgr.setRemoveAllWhenShown(true);
treeViewer.getTree().setMenu(menu);
//Don't add the object contribution menu items if this page is hosted in a dialog
@@ -824,22 +818,14 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTextMenu(menuMgr);
- }
- });
+ menuMgr.addMenuListener(menuMgr1 -> fillTextMenu(menuMgr1));
StyledText text = textViewer.getTextWidget();
menu = menuMgr.createContextMenu(text);
text.setMenu(menu);
menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTagMenu(menuMgr);
- }
- });
+ menuMgr.addMenuListener(menuMgr1 -> fillTagMenu(menuMgr1));
menu = menuMgr.createContextMenu(tagViewer.getControl());
tagViewer.getControl().setMenu(menu);
}
@@ -926,6 +912,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
TreeViewer viewer = historyTableProvider.createTree(parent);
viewer.setContentProvider(new ITreeContentProvider() {
+ @Override
public Object[] getElements(Object inputElement) {
// The entries of already been fetch so return them
@@ -946,13 +933,16 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return entries;
}
+ @Override
public void dispose() {
}
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
entries = null;
}
+ @Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof AbstractHistoryCategory){
return ((AbstractHistoryCategory) parentElement).getRevisions();
@@ -961,10 +951,12 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return null;
}
+ @Override
public Object getParent(Object element) {
return null;
}
+ @Override
public boolean hasChildren(Object element) {
if (element instanceof AbstractHistoryCategory){
IFileRevision[] revs = ((AbstractHistoryCategory) element).getRevisions();
@@ -975,34 +967,32 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
}
});
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection == null || !(selection instanceof IStructuredSelection)) {
- textViewer.setDocument(new Document("")); //$NON-NLS-1$
- tagViewer.setInput(null);
- setStatusLineMessage(null);
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- if (ss.size() != 1) {
- textViewer.setDocument(new Document("")); //$NON-NLS-1$
- tagViewer.setInput(null);
- setStatusLineMessage(null);
- return;
- }
- Object o = ss.getFirstElement();
- if (o instanceof AbstractHistoryCategory){
- textViewer.setDocument(new Document("")); //$NON-NLS-1$
- tagViewer.setInput(null);
- setStatusLineMessage(null);
- return;
- }
- IFileRevision entry = (IFileRevision)o;
- textViewer.setDocument(new Document(entry.getComment()));
- tagViewer.setInput(entry.getTags());
- setStatusLineMessage(CVSHistoryTableProvider.getCommentAsSingleLine(entry));
+ viewer.addSelectionChangedListener(event -> {
+ ISelection selection = event.getSelection();
+ if (selection == null || !(selection instanceof IStructuredSelection)) {
+ textViewer.setDocument(new Document("")); //$NON-NLS-1$
+ tagViewer.setInput(null);
+ setStatusLineMessage(null);
+ return;
+ }
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ if (ss.size() != 1) {
+ textViewer.setDocument(new Document("")); //$NON-NLS-1$
+ tagViewer.setInput(null);
+ setStatusLineMessage(null);
+ return;
+ }
+ Object o = ss.getFirstElement();
+ if (o instanceof AbstractHistoryCategory){
+ textViewer.setDocument(new Document("")); //$NON-NLS-1$
+ tagViewer.setInput(null);
+ setStatusLineMessage(null);
+ return;
}
+ IFileRevision entry = (IFileRevision)o;
+ textViewer.setDocument(new Document(entry.getComment()));
+ tagViewer.setInput(entry.getTags());
+ setStatusLineMessage(CVSHistoryTableProvider.getCommentAsSingleLine(entry));
});
return viewer;
@@ -1010,6 +1000,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
private Action getContextMenuAction(String title, final boolean needsProgressDialog, final IWorkspaceRunnable action) {
return new Action(title) {
+ @Override
public void run() {
try {
if (file == null) return;
@@ -1023,13 +1014,11 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
currentSelection = (IFileRevision)o;
if(needsProgressDialog) {
- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- action.run(monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ PlatformUI.getWorkbench().getProgressService().run(true, true, monitor -> {
+ try {
+ action.run(monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
} else {
@@ -1047,6 +1036,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
}
}
+ @Override
public boolean isEnabled() {
ISelection selection = treeViewer.getSelection();
if (!(selection instanceof IStructuredSelection)) return false;
@@ -1066,10 +1056,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
IHistoryPageSite parentSite = getHistoryPageSite();
final MessageDialog dialog = new MessageDialog(parentSite.getShell(), title, null, msg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
final int[] result = new int[1];
- parentSite.getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }});
+ parentSite.getShell().getDisplay().syncExec(() -> result[0] = dialog.open());
if (result[0] != 0) {
// cancel
return false;
@@ -1095,6 +1082,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
/*
* Refresh the view by refetching the log entries for the remote file
*/
+ @Override
public void refresh() {
refresh(CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE);
}
@@ -1210,7 +1198,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
protected static ICVSFile getCVSFile(Object object) {
// First, adapt to IResource and ensure mapped to CVS
- IResource resource = (IResource)Adapters.adapt(object, IResource.class);
+ IResource resource = Adapters.adapt(object, IResource.class);
if (resource instanceof IFile) {
RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject());
if (provider instanceof CVSTeamProvider)
@@ -1218,22 +1206,22 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return null;
}
// Second, try ICVSFile
- ICVSFile remoteFile = (ICVSFile)Adapters.adapt(object, ICVSFile.class);
+ ICVSFile remoteFile = Adapters.adapt(object, ICVSFile.class);
if (remoteFile != null) {
return remoteFile;
}
// Next, try ICVSResource
- ICVSResource remote = (ICVSResource)Adapters.adapt(object, ICVSResource.class);
+ ICVSResource remote = Adapters.adapt(object, ICVSResource.class);
if (remote instanceof RemoteFile) {
return (ICVSFile)remote;
}
// Next, try IResourceVariant
- IResourceVariant variant = (IResourceVariant)Adapters.adapt(object, IResourceVariant.class);
+ IResourceVariant variant = Adapters.adapt(object, IResourceVariant.class);
if (variant instanceof RemoteFile) {
return (ICVSFile)remote;
}
// Finally, try IFileRevision
- IFileRevision revision = (IFileRevision)Adapters.adapt(object, IFileRevision.class);
+ IFileRevision revision = Adapters.adapt(object, IFileRevision.class);
if (revision instanceof CVSFileRevision) {
return ((CVSFileRevision)revision).getCVSRemoteFile();
}
@@ -1326,6 +1314,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
branchImage = plugin.getImageDescriptor(ICVSUIConstants.IMG_TAG).createImage();
}
+ @Override
public void dispose() {
shutdown = true;
@@ -1411,6 +1400,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
super(page, editorInput, treeViewer);
}
+ @Override
protected Object getHistoryEntry(Revision selected) {
return CVSHistoryPage.this.getFileRevision(selected.getId());
}
@@ -1418,6 +1408,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
private final class SearchHistoryTable implements Runnable {
+ @Override
public void run() {
String searchString = searchField.getText();
if (searchString.equals("") || //$NON-NLS-1$
@@ -1502,6 +1493,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
this.localFileRevision = localRev;
}
+ @Override
public IStatus run(IProgressMonitor monitor) {
final int cachedRefreshFlags = refreshFlags;
final boolean cachedSelectOnly= selectOnly;
@@ -1567,65 +1559,63 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
if (grouping)
revisionsFound = sortRevisions();
- Utils.asyncExec(new Runnable() {
- public void run() {
- printDebugInfo("RefreshCVSFileHistory#updateTable, in asyncExec", workspaceFile, cvsFileHistory, null); //$NON-NLS-1$
- treeViewer.refresh();
- historyTableProvider.setFile(fileHistory, workspaceFile);
- //historyTableProvider.setWorkspaceFile(workspaceFile);
- if (!selectOnly){
- if (grouping) {
- mapExpandedElements(treeViewer.getExpandedElements());
- treeViewer.getTree().setLinesVisible(revisionsFound);
- treeViewer.getTree().setRedraw(false);
- printDebugInfo("RefreshCVSFileHistory#updateTable, setInput:grouping", workspaceFile, cvsFileHistory, null); //$NON-NLS-1$
- treeViewer.setInput(categories);
- //if user is switching modes and already has expanded elements
- //selected try to expand those, else expand all
- if (elementsToExpand.length > 0)
- treeViewer.setExpandedElements(elementsToExpand);
- else {
- treeViewer.expandAll();
- Object[] el = treeViewer.getExpandedElements();
- if (el != null && el.length > 0) {
- treeViewer.setSelection(new StructuredSelection(el[0]));
- treeViewer.getTree().deselectAll();
- }
+ Utils.asyncExec((Runnable) () -> {
+ printDebugInfo("RefreshCVSFileHistory#updateTable, in asyncExec", workspaceFile, cvsFileHistory, null); //$NON-NLS-1$
+ treeViewer.refresh();
+ historyTableProvider.setFile(fileHistory, workspaceFile);
+ //historyTableProvider.setWorkspaceFile(workspaceFile);
+ if (!selectOnly){
+ if (grouping) {
+ mapExpandedElements(treeViewer.getExpandedElements());
+ treeViewer.getTree().setLinesVisible(revisionsFound);
+ treeViewer.getTree().setRedraw(false);
+ printDebugInfo("RefreshCVSFileHistory#updateTable, setInput:grouping", workspaceFile, cvsFileHistory, null); //$NON-NLS-1$
+ treeViewer.setInput(categories);
+ //if user is switching modes and already has expanded elements
+ //selected try to expand those, else expand all
+ if (elementsToExpand.length > 0)
+ treeViewer.setExpandedElements(elementsToExpand);
+ else {
+ treeViewer.expandAll();
+ Object[] el = treeViewer.getExpandedElements();
+ if (el != null && el.length > 0) {
+ treeViewer.setSelection(new StructuredSelection(el[0]));
+ treeViewer.getTree().deselectAll();
}
- treeViewer.getTree().setRedraw(true);
+ }
+ treeViewer.getTree().setRedraw(true);
+ } else {
+ if (fileHistory.getFileRevisions().length > 0) {
+ treeViewer.getTree().setLinesVisible(true);
+ printDebugInfo("RefreshCVSFileHistory#updateTable, setInput:no grouping", workspaceFile, cvsFileHistory, null); //$NON-NLS-1$
+ treeViewer.setInput(fileHistory);
} else {
- if (fileHistory.getFileRevisions().length > 0) {
- treeViewer.getTree().setLinesVisible(true);
- printDebugInfo("RefreshCVSFileHistory#updateTable, setInput:no grouping", workspaceFile, cvsFileHistory, null); //$NON-NLS-1$
- treeViewer.setInput(fileHistory);
- } else {
- categories = new AbstractHistoryCategory[] {getErrorMessage()};
- treeViewer.getTree().setLinesVisible(false);
- treeViewer.setInput(categories);
- }
+ categories = new AbstractHistoryCategory[] {getErrorMessage()};
+ treeViewer.getTree().setLinesVisible(false);
+ treeViewer.setInput(categories);
}
}
- //Update the history (if it exists) to reflect the new
- //counts
- if (historyFilter != null){
- CVSHistoryFilter tempFilter = new CVSHistoryFilter(historyFilter.branchName, historyFilter.author, historyFilter.comment, historyFilter.fromDate, historyFilter.toDate, historyFilter.isOr);
- showFilter(tempFilter);
- }
-
- //Select the current file if we didn't have to refetch the history
- if (file != null){
- try {
- if (useLocalSelect){
- page.selectLocalRevision(localFileRevision.getTimestamp());
- } else {
- byte[] syncBytes = file.getSyncBytes();
- if (syncBytes != null) {
- String workspaceRevision = ResourceSyncInfo.getRevision(syncBytes);
- page.selectRevision(workspaceRevision);
- }
+ }
+ //Update the history (if it exists) to reflect the new
+ //counts
+ if (historyFilter != null){
+ CVSHistoryFilter tempFilter = new CVSHistoryFilter(historyFilter.branchName, historyFilter.author, historyFilter.comment, historyFilter.fromDate, historyFilter.toDate, historyFilter.isOr);
+ showFilter(tempFilter);
+ }
+
+ //Select the current file if we didn't have to refetch the history
+ if (file != null){
+ try {
+ if (useLocalSelect){
+ page.selectLocalRevision(localFileRevision.getTimestamp());
+ } else {
+ byte[] syncBytes = file.getSyncBytes();
+ if (syncBytes != null) {
+ String workspaceRevision = ResourceSyncInfo.getRevision(syncBytes);
+ page.selectRevision(workspaceRevision);
}
- } catch (CVSException e){
}
+ } catch (CVSException e){
}
}
}, treeViewer);
@@ -1732,22 +1722,16 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
super();
}
- /*
- * @see SimpleContentProvider#dispose()
- */
+ @Override
public void dispose() {
}
- /*
- * @see SimpleContentProvider#getElements()
- */
+ @Override
public Object[] getElements(Object element) {
return new Object[0];
}
- /*
- * @see SimpleContentProvider#inputChanged()
- */
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
@@ -1756,6 +1740,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
/**
* @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
*/
+ @Override
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta root = event.getDelta();
//Safety check for non-managed files that are added with the CVSHistoryPage
@@ -1767,18 +1752,16 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
if (resourceDelta != null){
String revision = getRevision();
final boolean hasRevision = cvsFileHistory.getFileRevision(revision) != null;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (treeViewer.getControl().isDisposed())
- return;
- if (treeViewer.getControl().isVisible()) {
- if (hasRevision)
- refresh(CVSFileHistory.REFRESH_LOCAL);
- else
- refresh();
- } else {
- refreshRequest = hasRevision ? CVSFileHistory.REFRESH_LOCAL : CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE;
- }
+ Display.getDefault().asyncExec(() -> {
+ if (treeViewer.getControl().isDisposed())
+ return;
+ if (treeViewer.getControl().isVisible()) {
+ if (hasRevision)
+ refresh(CVSFileHistory.REFRESH_LOCAL);
+ else
+ refresh();
+ } else {
+ refreshRequest = hasRevision ? CVSFileHistory.REFRESH_LOCAL : CVSFileHistory.REFRESH_LOCAL | CVSFileHistory.REFRESH_REMOTE;
}
});
}
@@ -1797,14 +1780,17 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
}
}
+ @Override
public Control getControl() {
return sashForm;
}
+ @Override
public boolean isValidInput(Object object) {
return getCVSFile(object) != null;
}
+ @Override
public String getName() {
if (description != null)
return description;
@@ -1825,6 +1811,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return null;
}
+ @Override
public <T> T getAdapter(Class<T> adapter) {
if(adapter == IHistoryCompareAdapter.class) {
return adapter.cast(this);
@@ -1832,6 +1819,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return null;
}
+ @Override
public ICompareInput getCompareInput(Object object) {
if (object instanceof IFileRevision){
IFileRevision selectedFileRevision = (IFileRevision)object;
@@ -1864,6 +1852,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
compareModeAction.run();
}
+ @Override
public void prepareInput(ICompareInput input, CompareConfiguration configuration, IProgressMonitor monitor) {
initLabels(input, configuration);
// TODO: pre-fetch contents
@@ -1921,6 +1910,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return dateTimeFormat;
}
+ @Override
public String getDescription() {
try {
if (file != null)
@@ -1931,6 +1921,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
return null;
}
+ @Override
public boolean inputSet() {
//reset currentFileRevision
currentFileRevision = null;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
index 36f6174a0..51185893a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectPropertiesPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,9 +19,9 @@ 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.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -92,12 +92,14 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
}
compatibleLocations = (ICVSRepositoryLocation[]) locations.toArray(new ICVSRepositoryLocation[locations.size()]);
}
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
okButton.setEnabled(false);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
+ @Override
protected Control createDialogArea(Composite parent) {
parent.getShell().setText(CVSUIMessages.CVSProjectPropertiesPage_Select_a_Repository_1);
Composite composite = (Composite) super.createDialogArea(parent);
@@ -111,6 +113,7 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
viewer.setLabelProvider(new WorkbenchLabelProvider());
viewer.setComparator(new RepositoryComparator());
viewer.setContentProvider(new WorkbenchContentProvider() {
+ @Override
public Object[] getElements(Object inputElement) {
if (showCompatible) {
return compatibleLocations;
@@ -119,28 +122,23 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
}
}
});
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- if (selection.isEmpty()) {
- selectedLocation = null;
- okButton.setEnabled(false);
- } else {
- selectedLocation = (ICVSRepositoryLocation)selection.getFirstElement();
- okButton.setEnabled(true);
- }
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
+ viewer.addSelectionChangedListener(event -> {
+ IStructuredSelection selection = event.getStructuredSelection();
+ if (selection.isEmpty()) {
+ selectedLocation = null;
+ okButton.setEnabled(false);
+ } else {
+ selectedLocation = (ICVSRepositoryLocation)selection.getFirstElement();
+ okButton.setEnabled(true);
}
});
+ viewer.addDoubleClickListener(event -> okPressed());
viewer.setInput(compatibleLocations);
final Button compatibleButton = createCheckBox(composite, CVSUIMessages.CVSProjectPropertiesPage_31);
compatibleButton.setSelection(showCompatible);
compatibleButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
showCompatible = compatibleButton.getSelection();
viewer.refresh();
@@ -151,6 +149,7 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
return composite;
}
+ @Override
protected void cancelPressed() {
selectedLocation = null;
super.cancelPressed();
@@ -160,9 +159,7 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
}
}
- /*
- * @see PreferencesPage#createContents
- */
+ @Override
protected Control createContents(Composite parent) {
initialize();
@@ -197,19 +194,11 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
// Should absent directories be fetched on update
fetchButton = createCheckBox(composite, CVSUIMessages.CVSProjectPropertiesPage_fetchAbsentDirectoriesOnUpdate);
- fetchButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- fetch = fetchButton.getSelection();
- }
- });
+ fetchButton.addListener(SWT.Selection, event -> fetch = fetchButton.getSelection());
// Should the project be configured for watch/edit
watchEditButton = createCheckBox(composite, CVSUIMessages.CVSProjectPropertiesPage_configureForWatchEdit);
- watchEditButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- watchEdit = watchEditButton.getSelection();
- }
- });
+ watchEditButton.addListener(SWT.Selection, event -> watchEdit = watchEditButton.getSelection());
createLabel(composite, "", 1); //$NON-NLS-1$
createLabel(composite, "", 1); //$NON-NLS-1$
@@ -225,15 +214,13 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
Button changeButton = new Button(composite, SWT.PUSH);
changeButton.setText(CVSUIMessages.CVSProjectPropertiesPage_Change_Sharing_5);
- changeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- RepositorySelectionDialog dialog = new RepositorySelectionDialog(getShell(), oldLocation);
- dialog.open();
- ICVSRepositoryLocation location = dialog.getLocation();
- if (location == null) return;
- newLocation = location;
- initializeValues(newLocation);
- }
+ changeButton.addListener(SWT.Selection, e -> {
+ RepositorySelectionDialog dialog = new RepositorySelectionDialog(getShell(), oldLocation);
+ dialog.open();
+ ICVSRepositoryLocation location = dialog.getLocation();
+ if (location == null) return;
+ newLocation = location;
+ initializeValues(newLocation);
});
initializeValues(oldLocation);
@@ -249,6 +236,7 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
* @param text the text for the new label
* @return the new label
*/
+ @Override
protected Label createLabel(Composite parent, String text, int span) {
Label label = new Label(parent, SWT.LEFT);
label.setText(text);
@@ -354,6 +342,7 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
/*
* @see PreferencesPage#performOk
*/
+ @Override
public boolean performOk() {
final boolean[] changeReadOnly = { false };
try {
@@ -375,18 +364,16 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
return false;
}
}
- new ProgressMonitorDialog(getShell()).run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(CVSUIMessages.CVSProjectPropertiesPage_progressTaskName,
- ((newLocation == null)?0:100) + (changeReadOnly[0]?100:0));
- if (newLocation != null)
- provider.setRemoteRoot(newLocation, Policy.subMonitorFor(monitor, 100));
- if (changeReadOnly[0])
- setReadOnly(watchEdit, Policy.infiniteSubMonitorFor(monitor, 100));
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
+ new ProgressMonitorDialog(getShell()).run(true, true, monitor -> {
+ try {
+ monitor.beginTask(CVSUIMessages.CVSProjectPropertiesPage_progressTaskName,
+ ((newLocation == null)?0:100) + (changeReadOnly[0]?100:0));
+ if (newLocation != null)
+ provider.setRemoteRoot(newLocation, Policy.subMonitorFor(monitor, 100));
+ if (changeReadOnly[0])
+ setReadOnly(watchEdit, Policy.infiniteSubMonitorFor(monitor, 100));
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
}
});
newLocation = null;
@@ -412,6 +399,7 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
monitor.subTask(taskName);
ICVSFolder root = CVSWorkspaceRoot.getCVSFolderFor(project);
root.accept(new ICVSResourceVisitor() {
+ @Override
public void visitFile(ICVSFile file) throws CVSException {
// only change managed, unmodified files
if (file.isManaged() && !file.isModified(null))
@@ -419,6 +407,7 @@ public class CVSProjectPropertiesPage extends CVSPropertiesPage {
monitor.worked(1);
}
+ @Override
public void visitFolder(ICVSFolder folder) throws CVSException {
folder.acceptChildren(this);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java
index f489cc651..bdf3a4518 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CommentTemplatesPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,6 +33,7 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
private Button removeButton;
private Text preview;
+ @Override
protected Control createContents(Composite ancestor) {
Composite parent = new Composite(ancestor, SWT.NONE);
GridLayout layout = new GridLayout();
@@ -75,6 +76,7 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
viewer = new ListViewer(listAndButtons);
viewer.setLabelProvider(new LabelProvider() {
+ @Override
public String getText(Object element) {
String template = (String) element;
return Util.flattenText(template);
@@ -82,17 +84,14 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
});
viewer.addSelectionChangedListener(this);
viewer.setComparator(new ViewerComparator() {
+ @Override
public int compare(Viewer viewer, Object e1, Object e2) {
String template1 = Util.flattenText((String) e1);
String template2 = Util.flattenText((String) e2);
return template1.compareToIgnoreCase(template2);
}
});
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- editTemplate();
- }
- });
+ viewer.addDoubleClickListener(event -> editTemplate());
List list = viewer.getList();
list.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -124,11 +123,7 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
newButton.setLayoutData(data);
newButton.setEnabled(true);
- newButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- newTemplate();
- }
- });
+ newButton.addListener(SWT.Selection, event -> newTemplate());
editButton = new Button(buttons, SWT.PUSH);
editButton.setText(CVSUIMessages.CommentTemplatesPreferencePage_Edit);
@@ -139,11 +134,7 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
editButton.setLayoutData(data);
editButton.setEnabled(false);
- editButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- editTemplate();
- }
- });
+ editButton.addListener(SWT.Selection, e -> editTemplate());
removeButton = new Button(buttons, SWT.PUSH);
removeButton.setText(CVSUIMessages.CommentTemplatesPreferencePage_Remove);
@@ -154,15 +145,12 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
removeButton.setLayoutData(data);
removeButton.setEnabled(false);
- removeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- remove();
- }
- });
+ removeButton.addListener(SWT.Selection, e -> remove());
}
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ IStructuredSelection selection = event.getStructuredSelection();
switch (selection.size()) {
case 0:
editButton.setEnabled(false);
@@ -196,7 +184,7 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
}
void editTemplate() {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ IStructuredSelection selection = viewer.getStructuredSelection();
if (selection.size() == 1) {
String oldTemplate = (String) selection.getFirstElement();
CommentTemplateEditDialog dialog = new CommentTemplateEditDialog(
@@ -212,10 +200,11 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
}
void remove() {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ IStructuredSelection selection = viewer.getStructuredSelection();
viewer.remove(selection.toArray());
}
+ @Override
public boolean performOk() {
int numTemplates = viewer.getList().getItemCount();
String[] templates = new String[numTemplates];
@@ -232,10 +221,12 @@ public class CommentTemplatesPreferencePage extends PreferencePage implements
return super.performOk();
}
+ @Override
public void init(IWorkbench workbench) {
// Nothing to do
}
+ @Override
protected void performDefaults() {
// default: the list of comments is cleaned
viewer.getList().removeAll();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsDialog.java
index d32c55f8e..44e46d20b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,7 @@ import java.util.Map;
import java.util.Properties;
import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
@@ -52,11 +51,7 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
alternativesMap);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.TitleAreaDialog#createContents(org.eclipse.swt.widgets.Composite)
- */
+ @Override
protected Control createContents(Composite parent) {
Control contents = super.createContents(parent);
setTitle(CVSUIMessages.ConfigureRepositoryLocationsWizard_title);
@@ -67,6 +62,7 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
return contents;
}
+ @Override
public boolean close() {
if (dlgTitleImage != null) {
dlgTitleImage.dispose();
@@ -74,9 +70,7 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
return super.close();
}
- /*
- * (non-Javadoc) Method declared in Window.
- */
+ @Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(CVSUIMessages.ConfigureRepositoryLocationsWizard_title);
@@ -85,9 +79,7 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
IHelpContextIds.ALTERNATIVE_REPOSITORY_DIALOG);
}
- /**
- * @see Dialog#createDialogArea
- */
+ @Override
protected Control createDialogArea(Composite parent) {
initializeDialogUnits(parent);
@@ -111,13 +103,9 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
.setText(CVSUIMessages.ConfigureRepositoryLocationsWizard_showOnlyCompatible);
showOnlyCompatibleLocationsButton.setSelection(true);
showOnlyCompatibleLocationsButton.addListener(SWT.Selection,
- new Listener() {
- public void handleEvent(Event event) {
- fConfigureRepositoryLocationsTable
- .setShowOnlyCompatibleLocations(showOnlyCompatibleLocationsButton
- .getSelection());
- }
- });
+ event -> fConfigureRepositoryLocationsTable
+ .setShowOnlyCompatibleLocations(showOnlyCompatibleLocationsButton
+ .getSelection()));
showOnlyCompatibleLocationsButton.setLayoutData(new GridData(
SWT.BEGINNING, SWT.NONE, false, false));
@@ -126,41 +114,39 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
.setText(CVSUIMessages.ConfigureRepositoryLocationsWizard_createLocation);
createLocationButton
.setToolTipText(CVSUIMessages.ConfigureRepositoryLocationsWizard_createLocationTooltip);
- createLocationButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
-
- CVSRepositoryLocation selectedAlternativeRepository = fConfigureRepositoryLocationsTable
- .getSelectedAlternativeRepository();
-
- Properties properties = new Properties();
- properties
- .put(
- "connection", selectedAlternativeRepository.getMethod().getName()); //$NON-NLS-1$
- properties.put(
- "user", selectedAlternativeRepository.getUsername()); //$NON-NLS-1$
- // TODO: retrieve password (if available) and use it to prime
- // the field
- // properties.put("password", ""); //$NON-NLS-1$
- properties.put("host", selectedAlternativeRepository.getHost()); //$NON-NLS-1$
- int port = selectedAlternativeRepository.getPort();
- if (port != ICVSRepositoryLocation.USE_DEFAULT_PORT)
- properties.put("port", String.valueOf(port)); //$NON-NLS-1$
- properties
- .put(
- "root", selectedAlternativeRepository.getRootDirectory()); //$NON-NLS-1$
-
- AlternativeLocationWizard wizard = new AlternativeLocationWizard(
- properties);
- wizard.setSwitchPerspectives(false);
- WizardDialog dialog = new ConfigureRepositoryLocationsWizardDialog(
- getShell(), wizard);
- dialog.open();
-
- ICVSRepositoryLocation location = wizard.getLocation();
- if (location != null)
- fConfigureRepositoryLocationsTable
- .addAlternativeRepository(location);
- }
+ createLocationButton.addListener(SWT.Selection, event -> {
+
+ CVSRepositoryLocation selectedAlternativeRepository = fConfigureRepositoryLocationsTable
+ .getSelectedAlternativeRepository();
+
+ Properties properties = new Properties();
+ properties
+ .put(
+ "connection", selectedAlternativeRepository.getMethod().getName()); //$NON-NLS-1$
+ properties.put(
+ "user", selectedAlternativeRepository.getUsername()); //$NON-NLS-1$
+ // TODO: retrieve password (if available) and use it to prime
+ // the field
+ // properties.put("password", ""); //$NON-NLS-1$
+ properties.put("host", selectedAlternativeRepository.getHost()); //$NON-NLS-1$
+ int port = selectedAlternativeRepository.getPort();
+ if (port != ICVSRepositoryLocation.USE_DEFAULT_PORT)
+ properties.put("port", String.valueOf(port)); //$NON-NLS-1$
+ properties
+ .put(
+ "root", selectedAlternativeRepository.getRootDirectory()); //$NON-NLS-1$
+
+ AlternativeLocationWizard wizard = new AlternativeLocationWizard(
+ properties);
+ wizard.setSwitchPerspectives(false);
+ WizardDialog dialog = new ConfigureRepositoryLocationsWizardDialog(
+ getShell(), wizard);
+ dialog.open();
+
+ ICVSRepositoryLocation location = wizard.getLocation();
+ if (location != null)
+ fConfigureRepositoryLocationsTable
+ .addAlternativeRepository(location);
});
createLocationButton.setEnabled(fConfigureRepositoryLocationsTable
.getSelection().getFirstElement() != null);
@@ -168,13 +154,10 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
false, false));
fConfigureRepositoryLocationsTable.getViewer().addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection sel = (IStructuredSelection) event
- .getSelection();
- Object firstElement = sel.getFirstElement();
- createLocationButton.setEnabled(firstElement != null);
- }
+ event -> {
+ IStructuredSelection sel = event.getStructuredSelection();
+ Object firstElement = sel.getFirstElement();
+ createLocationButton.setEnabled(firstElement != null);
});
return composite;
@@ -184,11 +167,7 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
return fConfigureRepositoryLocationsTable.getSelected();
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings()
- */
+ @Override
protected IDialogSettings getDialogBoundsSettings() {
String sectionName = getClass().getName() + "_dialogBounds"; //$NON-NLS-1$
IDialogSettings settings = CVSUIPlugin.getPlugin().getDialogSettings();
@@ -205,6 +184,7 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
* @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsStrategy()
* @since 3.2
*/
+ @Override
protected int getDialogBoundsStrategy() {
return DIALOG_PERSISTLOCATION | DIALOG_PERSISTSIZE;
}
@@ -220,6 +200,7 @@ public class ConfigureRepositoryLocationsDialog extends TitleAreaDialog {
super(parentShell, newWizard);
}
+ @Override
protected Button createButton(Composite parent, int id, String label,
boolean defaultButton) {
if (id == IDialogConstants.FINISH_ID)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsTable.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsTable.java
index c59281ec6..53260515c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsTable.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ConfigureRepositoryLocationsTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,6 +41,7 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
return 2;
}
+ @Override
public int compare(Viewer viewer, Object e1, Object e2) {
final int compare = getCategory(e1) - getCategory(e2);
if (compare != 0)
@@ -61,11 +62,7 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
this.selected = 0;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
+ @Override
public int compareTo(Object o) {
return location.getLocation(false).compareTo(
((Item) o).location.getLocation(false));
@@ -120,12 +117,10 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
// table.setLayoutData(SWTUtils.createHVFillGridData());
table.setLinesVisible(true);
table.setHeaderVisible(true);
- table.addListener(SWT.MeasureItem, new Listener() {
- public void handleEvent(Event event) {
- // int clientWidth = table.getClientArea().width;
- event.height = event.gc.getFontMetrics().getHeight() + 5;
- // event.width = clientWidth * 2;
- }
+ table.addListener(SWT.MeasureItem, event -> {
+ // int clientWidth = table.getClientArea().width;
+ event.height = event.gc.getFontMetrics().getHeight() + 5;
+ // event.width = clientWidth * 2;
});
/**
@@ -145,6 +140,7 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
.setText(CVSUIMessages.ConfigureRepositoryLocationsWizard_column1);
composite.addControlListener(new ControlAdapter() {
+ @Override
public void controlResized(ControlEvent e) {
Rectangle area = composite.getClientArea();
Point size = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
@@ -193,6 +189,7 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
fTableViewer, new FocusCellOwnerDrawHighlighter(fTableViewer));
ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(
fTableViewer) {
+ @Override
protected boolean isEditorActivationEvent(
ColumnViewerEditorActivationEvent event) {
return event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
@@ -239,6 +236,7 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
return table;
}
+ @Override
public Object getValue(Object element, String property) {
final Item item = (Item) element;
@@ -249,6 +247,7 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
return null;
}
+ @Override
public boolean canModify(Object element, String property) {
// set the correct cell editor for this element
cellEditors[1] = getCellEditor(element);
@@ -268,10 +267,10 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
return dummyAlternativeRepositoryEditor;
}
+ @Override
public void modify(Object element, String property, Object value) {
- final IStructuredSelection selection = (IStructuredSelection) fTableViewer
- .getSelection();
+ final IStructuredSelection selection = fTableViewer.getStructuredSelection();
final Item item = (Item) selection.getFirstElement();
if (item == null)
return;
@@ -284,10 +283,12 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
fTableViewer.refresh(item);
}
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
+ @Override
public String getColumnText(Object element, int columnIndex) {
final Item item = (Item) element;
@@ -301,28 +302,34 @@ public class ConfigureRepositoryLocationsTable implements ICellModifier,
}
}
+ @Override
public void addListener(ILabelProviderListener listener) {
}
+ @Override
public void dispose() {
}
+ @Override
public boolean isLabelProperty(Object element, String property) {
return false;
}
+ @Override
public void removeListener(ILabelProviderListener listener) {
}
+ @Override
public Object[] getElements(Object inputElement) {
return ((Collection) inputElement).toArray();
}
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
public IStructuredSelection getSelection() {
- return (IStructuredSelection) fTableViewer.getSelection();
+ return fTableViewer.getStructuredSelection();
}
public TableViewer getViewer() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
index d5ca3c0dc..ecbc6e0ad 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.*;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.osgi.util.NLS;
@@ -70,31 +69,28 @@ public class RepositoriesView extends RemoteViewPart {
private static final String FILTER_SHOW_MODULES = "filterShowModules"; //$NON-NLS-1$
IRepositoryListener listener = new IRepositoryListener() {
+ @Override
public void repositoryAdded(final ICVSRepositoryLocation root) {
- getViewer().getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- refreshViewer();
- getViewer().setSelection(new StructuredSelection(root));
- }
+ getViewer().getControl().getDisplay().asyncExec(() -> {
+ refreshViewer();
+ getViewer().setSelection(new StructuredSelection(root));
});
}
+ @Override
public void repositoriesChanged(ICVSRepositoryLocation[] roots) {
refresh();
}
private void refresh() {
Display display = getViewer().getControl().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- RepositoriesView.this.refreshViewer();
- }
- });
+ display.asyncExec(() -> RepositoriesView.this.refreshViewer());
}
};
private static final class RepositoryDragSourceListener implements DragSourceListener {
private IStructuredSelection selection;
- public void dragStart(DragSourceEvent event) {
+ @Override
+ public void dragStart(DragSourceEvent event) {
if(selection!=null) {
final Object[] array = selection.toArray();
// event.doit = Utils.getResources(array).length > 0;
@@ -108,7 +104,8 @@ public class RepositoriesView extends RemoteViewPart {
}
}
- public void dragSetData(DragSourceEvent event) {
+ @Override
+ public void dragSetData(DragSourceEvent event) {
if (selection!=null && CVSResourceTransfer.getInstance().isSupportedType(event.dataType)) {
final Object[] array = selection.toArray();
for (int i = 0; i < array.length; i++) {
@@ -129,7 +126,8 @@ public class RepositoriesView extends RemoteViewPart {
}
}
- public void dragFinished( DragSourceEvent event) {
+ @Override
+ public void dragFinished( DragSourceEvent event) {
}
public void updateSelection( IStructuredSelection selection) {
@@ -172,6 +170,7 @@ public class RepositoriesView extends RemoteViewPart {
/**
* Contribute actions to the view
*/
+ @Override
protected void contributeActions() {
final Shell shell = getShell();
@@ -180,6 +179,7 @@ public class RepositoriesView extends RemoteViewPart {
// New Repository (popup)
newAction = new Action(CVSUIMessages.RepositoriesView_new, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION)) {
+ @Override
public void run() {
NewLocationWizard wizard = new NewLocationWizard();
wizard.setSwitchPerspectives(false);
@@ -191,6 +191,7 @@ public class RepositoriesView extends RemoteViewPart {
if (includeAnonConnection()) {
newAnonAction = new Action(CVSUIMessages.RepositoriesView_newAnonCVS, CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_NEWLOCATION)) {
+ @Override
public void run() {
Properties p = new Properties();
p.setProperty("connection", "pserver"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -209,24 +210,23 @@ public class RepositoriesView extends RemoteViewPart {
// Properties
propertiesAction = new PropertyDialogAction(shell, getViewer());
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
- IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection();
+ IStructuredSelection selection = getViewer().getStructuredSelection();
if (selection.size() == 1 && selection.getFirstElement() instanceof RepositoryRoot) {
propertiesAction.setEnabled(true);
} else {
propertiesAction.setEnabled(false);
}
- getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection ss = (IStructuredSelection)event.getSelection();
- boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof RepositoryRoot;
- propertiesAction.setEnabled(enabled);
- }
+ getViewer().addSelectionChangedListener(event -> {
+ IStructuredSelection ss = event.getStructuredSelection();
+ boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof RepositoryRoot;
+ propertiesAction.setEnabled(enabled);
});
removeRootAction = new RemoveRootAction(viewer.getControl().getShell(), this);
removeRootAction.selectionChanged((IStructuredSelection)null);
removeDateTagAction = new RemoveDateTagAction();
removeDateTagAction.selectionChanged( (IStructuredSelection)null);
removeAction = new Action(){
+ @Override
public void run(){
if(removeRootAction.isEnabled()){
removeRootAction.run();
@@ -241,17 +241,15 @@ public class RepositoriesView extends RemoteViewPart {
bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), removeAction);
// Sort By action group
- IPropertyChangeListener comparatorUpdater = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (RepositoriesSortingActionGroup.CHANGE_COMPARATOR
- .equals(property)) {
- Object newValue = event.getNewValue();
- getViewer().refresh();
- saveSelectedComparator((RepositoryComparator) newValue);
- }
- }
- };
+ IPropertyChangeListener comparatorUpdater = event -> {
+ String property = event.getProperty();
+ if (RepositoriesSortingActionGroup.CHANGE_COMPARATOR
+ .equals(property)) {
+ Object newValue = event.getNewValue();
+ getViewer().refresh();
+ saveSelectedComparator((RepositoryComparator) newValue);
+ }
+ };
setActionGroup(new RepositoriesSortingActionGroup(shell,
comparatorUpdater));
// restore comparator selection
@@ -261,6 +259,7 @@ public class RepositoriesView extends RemoteViewPart {
super.contributeActions();
toggleFilterAction = new Action(CVSUIMessages.RepositoriesView_NoFilter){
+ @Override
public void run(){
if (repositoriesFilter != null)
getViewer().removeFilter(repositoriesFilter);
@@ -320,15 +319,13 @@ public class RepositoriesView extends RemoteViewPart {
return System.getProperty("eclipse.cvs.anon") != null; //$NON-NLS-1$
}
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#addWorkbenchActions(org.eclipse.jface.action.IMenuManager)
- */
+ @Override
protected void addWorkbenchActions(IMenuManager manager) {
// New actions go next
MenuManager sub = new MenuManager(CVSUIMessages.RepositoriesView_newSubmenu, IWorkbenchActionConstants.GROUP_ADD);
manager.add(sub);
super.addWorkbenchActions(manager);
- IStructuredSelection selection = (IStructuredSelection)getViewer().getSelection();
+ IStructuredSelection selection = getViewer().getStructuredSelection();
removeRootAction.selectionChanged(selection);
removeDateTagAction.selectionChanged(selection);
@@ -348,9 +345,7 @@ public class RepositoriesView extends RemoteViewPart {
sub.add(new Separator("group1")); //$NON-NLS-1$
}
- /*
- * @see WorkbenchPart#createPartControl
- */
+ @Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
CVSUIPlugin.getPlugin().getRepositoryManager().addRepositoryListener(listener);
@@ -362,9 +357,7 @@ public class RepositoriesView extends RemoteViewPart {
getRepositoriesSortingActionGroup().fillActionBars(getViewSite().getActionBars());
}
- /*
- * @see WorkbenchPart#dispose
- */
+ @Override
public void dispose() {
if (repositoriesFilter != null)
dialogSettings.put(FILTER_SHOW_MODULES, repositoriesFilter.isShowModules());
@@ -384,15 +377,14 @@ public class RepositoriesView extends RemoteViewPart {
root = new AllRootsElement();
}
+ @Override
protected void initializeListeners() {
super.initializeListeners();
viewer.addSelectionChangedListener(removeRootAction);
viewer.addSelectionChangedListener(removeDateTagAction);
- viewer.addSelectionChangedListener(new ISelectionChangedListener(){
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- handleChange(selection);
- }
+ viewer.addSelectionChangedListener(event -> {
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ handleChange(selection);
});
repositoryDragSourceListener = new RepositoryDragSourceListener();
@@ -401,17 +393,13 @@ public class RepositoriesView extends RemoteViewPart {
repositoryDragSourceListener);
}
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getTreeInput()
- */
+ @Override
protected Object getTreeInput() {
initialize();
return root;
}
- /**
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
+ @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
String msg = getStatusLineMessage(selection);
getViewSite().getActionBars().getStatusLineManager().setMessage(msg);
@@ -443,18 +431,15 @@ public class RepositoriesView extends RemoteViewPart {
return CVSUIMessages.RepositoriesView_OneItemSelected;
}
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getHelpContextId()
- */
+ @Override
protected String getHelpContextId() {
return IHelpContextIds.REPOSITORIES_VIEW;
}
- /**
- * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getKeyListener()
- */
+ @Override
protected KeyAdapter getKeyListener() {
return new KeyAdapter() {
+ @Override
public void keyPressed(KeyEvent event) {
if (event.keyCode == SWT.F5) {
if (WorkbenchUserAuthenticator.USE_ALTERNATE_PROMPTER) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java
index 9524bb979..b95a62b5b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagConfigurationDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,9 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
@@ -84,6 +82,7 @@ public class TagConfigurationDialog extends TrayDialog {
private final TagSourceWrapper wrappedTagSource;
class FileComparator extends ViewerComparator {
+ @Override
public int compare(Viewer viewer, Object e1, Object e2) {
boolean oneIsFile = e1 instanceof CVSFileElement;
boolean twoIsFile = e2 instanceof CVSFileElement;
@@ -113,10 +112,8 @@ public class TagConfigurationDialog extends TrayDialog {
dates.addAll(Arrays.asList(tagSource.getTags(CVSTag.DATE)));
}
- /* (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);
}
@@ -138,25 +135,19 @@ public class TagConfigurationDialog extends TrayDialog {
return null;
}
- /* (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 {
// The wrapper is never refreshed
return new CVSTag[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getLocation()
- */
- public ICVSRepositoryLocation getLocation() {
+ @Override
+ public ICVSRepositoryLocation getLocation() {
return tagSource.getLocation();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.merge.TagSource#getShortDescription()
- */
- public String getShortDescription() {
+ @Override
+ public String getShortDescription() {
return tagSource.getShortDescription();
}
@@ -193,17 +184,13 @@ public class TagConfigurationDialog extends TrayDialog {
tagSource.commit(getTags(new int[] { CVSTag.VERSION, CVSTag.BRANCH, CVSTag.DATE }), true /* replace */, monitor);
}
- /* (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(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
+ @Override
+ public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
// Not invoked
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
- */
- public ICVSResource[] getCVSResources() {
+ @Override
+ public ICVSResource[] getCVSResources() {
return tagSource.getCVSResources();
}
}
@@ -221,17 +208,13 @@ public class TagConfigurationDialog extends TrayDialog {
}
}
- /**
- * @see Window#configureShell(Shell)
- */
+ @Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(NLS.bind(CVSUIMessages.TagConfigurationDialog_1, new String[] { tagSource.getShortDescription() }));
}
- /**
- * @see Dialog#createDialogArea(Composite)
- */
+ @Override
protected Control createDialogArea(Composite parent) {
Composite shell = new Composite(parent, SWT.NONE);
GridData data = new GridData (GridData.FILL_BOTH);
@@ -267,11 +250,9 @@ public class TagConfigurationDialog extends TrayDialog {
cvsResourceTree.getTree().setLayoutData(data);
cvsResourceTree.setComparator(new FileComparator());
cvsResourceTree.setInput(TagSourceResourceAdapter.getViewerInput(tagSource));
- cvsResourceTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateShownTags();
- updateEnablements();
- }
+ cvsResourceTree.addSelectionChangedListener(event -> {
+ updateShownTags();
+ updateEnablements();
});
comp = new Composite(shell, SWT.NULL);
@@ -296,11 +277,7 @@ public class TagConfigurationDialog extends TrayDialog {
cvsTagTree = new CheckboxTableViewer(table);
cvsTagTree.setContentProvider(new WorkbenchContentProvider());
cvsTagTree.setLabelProvider(new WorkbenchLabelProvider());
- cvsTagTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements();
- }
- });
+ cvsTagTree.addSelectionChangedListener(event -> updateEnablements());
Composite selectComp = new Composite(comp, SWT.NONE);
GridLayout selectLayout = new GridLayout(2, true);
@@ -311,6 +288,7 @@ public class TagConfigurationDialog extends TrayDialog {
selectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
selectAllButton.setText(CVSUIMessages.ReleaseCommentDialog_selectAll);
selectAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
int nItems = table.getItemCount();
for (int j=0; j<nItems; j++)
@@ -321,6 +299,7 @@ public class TagConfigurationDialog extends TrayDialog {
deselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
deselectAllButton.setText(CVSUIMessages.ReleaseCommentDialog_deselectAll);
deselectAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
int nItems = table.getItemCount();
for (int j=0; j<nItems; j++)
@@ -329,6 +308,7 @@ public class TagConfigurationDialog extends TrayDialog {
});
cvsTagTree.setComparator(new ViewerComparator() {
+ @Override
public int compare(Viewer viewer, Object e1, Object e2) {
if (!(e1 instanceof TagElement) || !(e2 instanceof TagElement)) return super.compare(viewer, e1, e2);
CVSTag tag1 = ((TagElement)e1).getTag();
@@ -370,11 +350,7 @@ public class TagConfigurationDialog extends TrayDialog {
cvsDefinedTagsTree.getTree().setLayoutData(data);
cvsDefinedTagsRootElement = new TagSourceWorkbenchAdapter(wrappedTagSource, TagSourceWorkbenchAdapter.INCLUDE_BRANCHES | TagSourceWorkbenchAdapter.INCLUDE_VERSIONS |TagSourceWorkbenchAdapter.INCLUDE_DATES);
cvsDefinedTagsTree.setInput(cvsDefinedTagsRootElement);
- cvsDefinedTagsTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablements();
- }
- });
+ cvsDefinedTagsTree.addSelectionChangedListener(event -> updateEnablements());
cvsDefinedTagsTree.setComparator(new ProjectElementComparator());
Composite buttonComposite = new Composite(rememberedTags, SWT.NONE);
@@ -391,51 +367,43 @@ public class TagConfigurationDialog extends TrayDialog {
data = getStandardButtonData(addSelectedTagsButton);
data.horizontalAlignment = GridData.FILL;
addSelectedTagsButton.setLayoutData(data);
- addSelectedTagsButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- rememberCheckedTags();
- updateShownTags();
- updateEnablements();
- }
- });
+ addSelectedTagsButton.addListener(SWT.Selection, event -> {
+ rememberCheckedTags();
+ updateShownTags();
+ updateEnablements();
+ });
Button addDatesButton = new Button(buttonComposite, SWT.PUSH);
addDatesButton.setText(CVSUIMessages.TagConfigurationDialog_0);
data = getStandardButtonData(addDatesButton);
data.horizontalAlignment = GridData.FILL;
addDatesButton.setLayoutData(data);
- addDatesButton.addListener(SWT.Selection, new Listener(){
- public void handleEvent(Event event){
- CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), tagSource.getLocation());
- addDateTagsSelected(dateTag);
- updateShownTags();
- updateEnablements();
- }
+ addDatesButton.addListener(SWT.Selection, event -> {
+ CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), tagSource.getLocation());
+ addDateTagsSelected(dateTag);
+ updateShownTags();
+ updateEnablements();
});
removeTagButton = new Button (buttonComposite, SWT.PUSH);
removeTagButton.setText (CVSUIMessages.TagConfigurationDialog_9);
data = getStandardButtonData(removeTagButton);
data.horizontalAlignment = GridData.FILL;
removeTagButton.setLayoutData(data);
- removeTagButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- deleteSelected();
- updateShownTags();
- updateEnablements();
- }
- });
+ removeTagButton.addListener(SWT.Selection, event -> {
+ deleteSelected();
+ updateShownTags();
+ updateEnablements();
+ });
Button removeAllTags = new Button (buttonComposite, SWT.PUSH);
removeAllTags.setText (CVSUIMessages.TagConfigurationDialog_10);
data = getStandardButtonData(removeAllTags);
data.horizontalAlignment = GridData.FILL;
removeAllTags.setLayoutData(data);
- removeAllTags.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- removeAllKnownTags();
- updateShownTags();
- updateEnablements();
- }
- });
+ removeAllTags.addListener(SWT.Selection, event -> {
+ removeAllKnownTags();
+ updateShownTags();
+ updateEnablements();
+ });
if(allowSettingAutoRefreshFiles) {
Label explanation = new Label(rememberedTags, SWT.WRAP);
@@ -458,9 +426,11 @@ public class TagConfigurationDialog extends TrayDialog {
CVSUIPlugin.log(e);
}
autoRefreshFileList.addSelectionListener(new SelectionListener() {
+ @Override
public void widgetSelected(SelectionEvent e) {
updateEnablements();
}
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
updateEnablements();
}
@@ -480,26 +450,20 @@ public class TagConfigurationDialog extends TrayDialog {
data = getStandardButtonData(addSelectedFilesButton);
data.horizontalAlignment = GridData.FILL;
addSelectedFilesButton.setLayoutData(data);
- addSelectedFilesButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- addSelectionToAutoRefreshList();
- }
- });
+ addSelectedFilesButton.addListener(SWT.Selection, event -> addSelectionToAutoRefreshList());
removeFileButton = new Button (buttonComposite2, SWT.PUSH);
removeFileButton.setText (CVSUIMessages.TagConfigurationDialog_13);
data = getStandardButtonData(removeFileButton);
data.horizontalAlignment = GridData.FILL;
removeFileButton.setLayoutData(data);
- removeFileButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- String[] selected = autoRefreshFileList.getSelection();
- for (int i = 0; i < selected.length; i++) {
- autoRefreshFileList.remove(selected[i]);
- autoRefreshFileList.setFocus();
- }
- }
- });
+ removeFileButton.addListener(SWT.Selection, event -> {
+ String[] selected = autoRefreshFileList.getSelection();
+ for (int i = 0; i < selected.length; i++) {
+ autoRefreshFileList.remove(selected[i]);
+ autoRefreshFileList.setFocus();
+ }
+ });
PlatformUI.getWorkbench().getHelpSystem().setHelp(autoRefreshFileList, IHelpContextIds.TAG_CONFIGURATION_REFRESHLIST);
}
@@ -520,19 +484,17 @@ public class TagConfigurationDialog extends TrayDialog {
final Set tags = new HashSet();
if(filesSelection.length!=0) {
try {
- CVSUIPlugin.runWithProgress(getShell(), true /*cancelable*/, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- monitor.beginTask(CVSUIMessages.TagConfigurationDialog_22, filesSelection.length);
- try {
- for (int i = 0; i < filesSelection.length; i++) {
- ICVSFile file = filesSelection[i].getCVSFile();
- tags.addAll(Arrays.asList(getTagsFor(file, Policy.subMonitorFor(monitor, 1))));
- }
- } catch (TeamException e) {
- // ignore the exception
- } finally {
- monitor.done();
+ CVSUIPlugin.runWithProgress(getShell(), true /*cancelable*/, monitor -> {
+ monitor.beginTask(CVSUIMessages.TagConfigurationDialog_22, filesSelection.length);
+ try {
+ for (int i = 0; i < filesSelection.length; i++) {
+ ICVSFile file = filesSelection[i].getCVSFile();
+ tags.addAll(Arrays.asList(getTagsFor(file, Policy.subMonitorFor(monitor, 1))));
}
+ } catch (TeamException e) {
+ // ignore the exception
+ } finally {
+ monitor.done();
}
});
} catch (InterruptedException e) {
@@ -555,7 +517,7 @@ public class TagConfigurationDialog extends TrayDialog {
}
private CVSFileElement[] getSelectedFiles() {
- IStructuredSelection selection = (IStructuredSelection)cvsResourceTree.getSelection();
+ IStructuredSelection selection = cvsResourceTree.getStructuredSelection();
if (!selection.isEmpty()) {
final List filesSelection = new ArrayList();
Iterator it = selection.iterator();
@@ -571,7 +533,7 @@ public class TagConfigurationDialog extends TrayDialog {
}
private void addSelectionToAutoRefreshList() {
- IStructuredSelection selection = (IStructuredSelection)cvsResourceTree.getSelection();
+ IStructuredSelection selection = cvsResourceTree.getStructuredSelection();
if (!selection.isEmpty()) {
final List filesSelection = new ArrayList();
Iterator it = selection.iterator();
@@ -617,7 +579,7 @@ public class TagConfigurationDialog extends TrayDialog {
}
private void deleteSelected() {
- IStructuredSelection selection = (IStructuredSelection)cvsDefinedTagsTree.getSelection();
+ IStructuredSelection selection = cvsDefinedTagsTree.getStructuredSelection();
List tagsToRemove = new ArrayList();
if (!selection.isEmpty()) {
Iterator it = selection.iterator();
@@ -646,7 +608,7 @@ public class TagConfigurationDialog extends TrayDialog {
}
}
private boolean isTagSelectedInKnownTagTree() {
- IStructuredSelection selection = (IStructuredSelection)cvsDefinedTagsTree.getSelection();
+ IStructuredSelection selection = cvsDefinedTagsTree.getStructuredSelection();
if (!selection.isEmpty()) {
Iterator it = selection.iterator();
while(it.hasNext()) {
@@ -681,9 +643,7 @@ public class TagConfigurationDialog extends TrayDialog {
}
}
- /**
- * @see Dialog#okPressed()
- */
+ @Override
protected void okPressed() {
try {
// save auto refresh file names
@@ -708,9 +668,7 @@ public class TagConfigurationDialog extends TrayDialog {
return null;
}
- /**
- * @see Window#getInitialSize()
- */
+ @Override
protected Point getInitialSize() {
int width, height;
if(allowSettingAutoRefreshFiles) {
@@ -731,9 +689,7 @@ public class TagConfigurationDialog extends TrayDialog {
return new Point(width, height);
}
- /**
- * @see Dialog#cancelPressed()
- */
+ @Override
protected void cancelPressed() {
super.cancelPressed();
}
@@ -747,9 +703,7 @@ public class TagConfigurationDialog extends TrayDialog {
return data;
}
- /**
- * @see Window#close()
- */
+ @Override
public boolean close() {
// Close the tray so we only remember the size without the tray
if (getTray() != null)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java
index 7db11ca01..e272f4f79 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSelectionArea.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,9 +11,7 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.tags;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
+import java.util.*;
import java.util.List;
import org.eclipse.jface.action.*;
@@ -86,24 +84,16 @@ public class TagSelectionArea extends DialogArea {
private TagSource tagSource;
private final Shell shell;
private TagRefreshButtonArea tagRefreshArea;
- private final TagSource.ITagSourceChangeListener listener = new TagSource.ITagSourceChangeListener() {
- public void tagsChanged(TagSource source) {
- Shell shell = getShell();
- if (!shell.isDisposed()) {
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- refresh();
- }
- });
- }
- }
- };
- private final DisposeListener disposeListener = new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (tagSource != null)
- tagSource.removeListener(listener);
- }
- };
+ private final TagSource.ITagSourceChangeListener listener = source -> {
+ Shell shell = getShell();
+ if (!shell.isDisposed()) {
+ shell.getDisplay().syncExec(() -> refresh());
+ }
+ };
+ private final DisposeListener disposeListener = e -> {
+ if (tagSource != null)
+ tagSource.removeListener(listener);
+ };
private PageBook switcher;
private TreeViewer tagTree;
@@ -122,10 +112,8 @@ public class TagSelectionArea extends DialogArea {
setSelection(null);
}
- /* (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) {
initializeDialogUnits(parent);
Dialog.applyDialogFont(parent);
final PixelConverter converter= new PixelConverter(parent);
@@ -169,18 +157,16 @@ public class TagSelectionArea extends DialogArea {
private void createFilterInput(Composite inner) {
createWrappingLabel(inner, NLS.bind(CVSUIMessages.TagSelectionArea_2, new String[] { getTagAreaLabel() }), 1);
filterText = createText(inner, 1);
- filterText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setFilter(filterText.getText());
- }
- });
+ filterText.addModifyListener(e -> setFilter(filterText.getText()));
filterText.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
+ @Override
+ public void keyPressed(KeyEvent e) {
if (e.keyCode == SWT.ARROW_DOWN && e.stateMask == 0) {
tagTable.getControl().setFocus();
}
}
- public void keyReleased(KeyEvent e) {
+ @Override
+ public void keyReleased(KeyEvent e) {
// Ignore
}
});
@@ -315,12 +301,10 @@ public class TagSelectionArea extends DialogArea {
parent.addDisposeListener(disposeListener);
Listener listener = null;
if ((includeFlags & TagSourceWorkbenchAdapter.INCLUDE_DATES) != 0) {
- listener = new Listener() {
- public void handleEvent(Event event) {
- CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), getLocation());
- addDateTag(dateTag);
- }
- };
+ listener = event -> {
+ CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), getLocation());
+ addDateTag(dateTag);
+ };
}
tagRefreshArea = new TagRefreshButtonArea(shell, tagSource, listener);
if (context != null)
@@ -334,12 +318,7 @@ public class TagSelectionArea extends DialogArea {
MenuManager menuMgr = new MenuManager();
Tree tree = tagTree.getTree();
Menu menu = menuMgr.createContextMenu(tree);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- addMenuItemActions(manager);
- }
-
- });
+ menuMgr.addMenuListener(manager -> addMenuItemActions(manager));
menuMgr.setRemoveAllWhenShown(true);
tree.setMenu(menu);
}
@@ -360,9 +339,11 @@ public class TagSelectionArea extends DialogArea {
TreeViewer result = new TreeViewer(tree);
initialize(result);
result.getControl().addKeyListener(new KeyListener() {
+ @Override
public void keyPressed(KeyEvent event) {
handleKeyPressed(event);
}
+ @Override
public void keyReleased(KeyEvent event) {
handleKeyReleased(event);
}
@@ -391,14 +372,11 @@ public class TagSelectionArea extends DialogArea {
viewer.setContentProvider(new WorkbenchContentProvider());
viewer.setLabelProvider(new WorkbenchLabelProvider());
viewer.setComparator(new ProjectElementComparator());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChange();
- }
- });
+ viewer.addSelectionChangedListener(event -> handleSelectionChange());
// select and close on double click
// To do: use defaultselection instead of double click
viewer.getControl().addMouseListener(new MouseAdapter() {
+ @Override
public void mouseDoubleClick(MouseEvent e) {
CVSTag tag = internalGetSelectedTag();
if (tag != null) {
@@ -436,7 +414,7 @@ public class TagSelectionArea extends DialogArea {
*/
private TagElement[] getSelectedDateTagElement() {
ArrayList dateTagElements = null;
- IStructuredSelection selection = (IStructuredSelection)tagTree.getSelection();
+ IStructuredSelection selection = tagTree.getStructuredSelection();
if (selection!=null && !selection.isEmpty()) {
dateTagElements = new ArrayList();
Iterator elements = selection.iterator();
@@ -475,6 +453,7 @@ public class TagSelectionArea extends DialogArea {
}
private void addMenuItemActions(IMenuManager manager) {
manager.add(new Action(CVSUIMessages.TagSelectionDialog_0) {
+ @Override
public void run() {
CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), getLocation());
addDateTag(dateTag);
@@ -482,6 +461,7 @@ public class TagSelectionArea extends DialogArea {
});
if(getSelectedDateTagElement().length > 0){
manager.add(new Action(CVSUIMessages.TagSelectionDialog_1) {
+ @Override
public void run() {
deleteDateTag();
}
@@ -510,9 +490,9 @@ public class TagSelectionArea extends DialogArea {
private CVSTag internalGetSelectedTag() {
IStructuredSelection selection;
if (isTreeVisible()) {
- selection = (IStructuredSelection)tagTree.getSelection();
+ selection = tagTree.getStructuredSelection();
} else {
- selection = (IStructuredSelection)tagTable.getSelection();
+ selection = tagTable.getStructuredSelection();
}
Object o = selection.getFirstElement();
if (o instanceof TagElement)
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java
index 18aa4c6f2..c4c562f4f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/GenerateDiffFileWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,12 +15,12 @@ import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
@@ -43,8 +43,9 @@ import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.client.*;
+import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
+import org.eclipse.team.internal.ccvs.core.client.Diff;
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.*;
@@ -135,6 +136,7 @@ public class GenerateDiffFileWizard extends Wizard {
//Never show closed projects
boolean showClosedProjects=false;
+ @Override
public Object[] getChildren(Object element) {
if (element instanceof IWorkspace) {
// check if closed projects should be shown
@@ -167,6 +169,7 @@ public class GenerateDiffFileWizard extends Wizard {
super(shell);
}
+ @Override
protected Control createContents(Composite parent) {
Control control = super.createContents(parent);
setTitle(CVSUIMessages.WorkspacePatchDialogTitle);
@@ -178,6 +181,7 @@ public class GenerateDiffFileWizard extends Wizard {
return control;
}
+ @Override
protected Control createDialogArea(Composite parent){
Composite parentComposite = (Composite) super.createDialogArea(parent);
@@ -232,6 +236,7 @@ public class GenerateDiffFileWizard extends Wizard {
return parent;
}
+ @Override
protected Button createButton(Composite parent, int id,
String label, boolean defaultButton) {
Button button = super.createButton(parent, id, label,
@@ -285,6 +290,7 @@ public class GenerateDiffFileWizard extends Wizard {
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
+ @Override
protected void okPressed() {
IFile file = wsSelectedContainer.getFile(new Path(
wsFilenameText.getText()));
@@ -296,7 +302,7 @@ public class GenerateDiffFileWizard extends Wizard {
}
private IContainer getSelectedContainer() {
- Object obj = ((IStructuredSelection)wsTreeViewer.getSelection()).getFirstElement();
+ Object obj = wsTreeViewer.getStructuredSelection().getFirstElement();
if (obj instanceof IContainer) {
wsSelectedContainer = (IContainer) obj;
} else if (obj instanceof IFile) {
@@ -305,11 +311,13 @@ public class GenerateDiffFileWizard extends Wizard {
return wsSelectedContainer;
}
+ @Override
protected void cancelPressed() {
validatePage();
super.cancelPressed();
}
+ @Override
public boolean close() {
if (dlgTitleImage != null)
dlgTitleImage.dispose();
@@ -318,41 +326,35 @@ public class GenerateDiffFileWizard extends Wizard {
void setupListeners(){
wsTreeViewer.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection s = (IStructuredSelection)event.getSelection();
- Object obj=s.getFirstElement();
- if (obj instanceof IContainer)
- wsSelectedContainer = (IContainer) obj;
- else if (obj instanceof IFile){
- IFile tempFile = (IFile) obj;
- wsSelectedContainer = tempFile.getParent();
- wsFilenameText.setText(tempFile.getName());
- }
- validateDialog();
+ event -> {
+ IStructuredSelection s = event.getStructuredSelection();
+ Object obj=s.getFirstElement();
+ if (obj instanceof IContainer)
+ wsSelectedContainer = (IContainer) obj;
+ else if (obj instanceof IFile){
+ IFile tempFile = (IFile) obj;
+ wsSelectedContainer = tempFile.getParent();
+ wsFilenameText.setText(tempFile.getName());
}
+ validateDialog();
});
wsTreeViewer.addDoubleClickListener(
- new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection s= event.getSelection();
- if (s instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection)s).getFirstElement();
- if (wsTreeViewer.getExpandedState(item))
- wsTreeViewer.collapseToLevel(item, 1);
- else
- wsTreeViewer.expandToLevel(item, 1);
- }
- validateDialog();
+ event -> {
+ ISelection s= event.getSelection();
+ if (s instanceof IStructuredSelection) {
+ Object item = ((IStructuredSelection)s).getFirstElement();
+ if (wsTreeViewer.getExpandedState(item))
+ wsTreeViewer.collapseToLevel(item, 1);
+ else
+ wsTreeViewer.expandToLevel(item, 1);
}
+ validateDialog();
});
- wsFilenameText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- modified = true;
- validateDialog();
- }
+ wsFilenameText.addModifyListener(e -> {
+ modified = true;
+ validateDialog();
});
}
}
@@ -545,6 +547,7 @@ public class GenerateDiffFileWizard extends Wizard {
* Allow the user to chose to save the patch to the workspace or outside
* of the workspace.
*/
+ @Override
public void createControl(Composite parent) {
final Composite composite= new Composite(parent, SWT.NULL);
@@ -690,6 +693,7 @@ public class GenerateDiffFileWizard extends Wizard {
Button showChanges = new Button(changeDesc, SWT.PUSH);
showChanges.setText(CVSUIMessages.CommitWizardCommitPage_5);
showChanges.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
showChangesPane();
}
@@ -723,6 +727,7 @@ public class GenerateDiffFileWizard extends Wizard {
return control;
}
+ @Override
public void dispose() {
if (fPagePane != null)
fPagePane.dispose();
@@ -795,68 +800,55 @@ public class GenerateDiffFileWizard extends Wizard {
*/
private void setupListeners() {
- cpRadio.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- selectedLocation= CLIPBOARD;
- validatePage();
- updateEnablements();
- }
+ cpRadio.addListener(SWT.Selection, event -> {
+ selectedLocation= CLIPBOARD;
+ validatePage();
+ updateEnablements();
});
- fsRadio.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- selectedLocation= FILESYSTEM;
- validatePage();
- updateEnablements();
- }
+ fsRadio.addListener(SWT.Selection, event -> {
+ selectedLocation= FILESYSTEM;
+ validatePage();
+ updateEnablements();
});
- wsRadio.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- selectedLocation= WORKSPACE;
- validatePage();
- updateEnablements();
- }
+ wsRadio.addListener(SWT.Selection, event -> {
+ selectedLocation= WORKSPACE;
+ validatePage();
+ updateEnablements();
});
- ModifyListener pathTextModifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validatePage();
- }
- };
+ ModifyListener pathTextModifyListener = e -> validatePage();
fsPathText.addModifyListener(pathTextModifyListener);
wsPathText.addModifyListener(pathTextModifyListener);
- fsBrowseButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- final FileDialog dialog = new FileDialog(getShell(), SWT.PRIMARY_MODAL | SWT.SAVE);
- if (pageValid) {
- final File file= new File(fsPathText.getText());
- dialog.setFilterPath(file.getParent());
- }
- dialog.setText(CVSUIMessages.Save_Patch_As_5);
- dialog.setFileName(CVSUIMessages.patch_txt_6);
- final String path = dialog.open();
- fsBrowsed = true;
- if (path != null) {
- fsPathText.setText(new Path(path).toOSString());
- }
- validatePage();
+ fsBrowseButton.addListener(SWT.Selection, event -> {
+ final FileDialog dialog = new FileDialog(getShell(), SWT.PRIMARY_MODAL | SWT.SAVE);
+ if (pageValid) {
+ final File file= new File(fsPathText.getText());
+ dialog.setFilterPath(file.getParent());
+ }
+ dialog.setText(CVSUIMessages.Save_Patch_As_5);
+ dialog.setFileName(CVSUIMessages.patch_txt_6);
+ final String path = dialog.open();
+ fsBrowsed = true;
+ if (path != null) {
+ fsPathText.setText(new Path(path).toOSString());
}
+ validatePage();
});
- wsBrowseButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- final WorkspaceDialog dialog = new WorkspaceDialog(getShell());
- wsBrowsed = true;
- dialog.open();
- validatePage();
- }
+ wsBrowseButton.addListener(SWT.Selection, event -> {
+ final WorkspaceDialog dialog = new WorkspaceDialog(getShell());
+ wsBrowsed = true;
+ dialog.open();
+ validatePage();
});
chgSelectAll.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
initCheckedItems();
//Only bother changing isPageComplete state if the current state
@@ -867,6 +859,7 @@ public class GenerateDiffFileWizard extends Wizard {
});
chgDeselectAll.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
ISynchronizePage page = fConfiguration.getPage();
if (page != null){
@@ -887,11 +880,7 @@ public class GenerateDiffFileWizard extends Wizard {
if (page != null) {
Viewer viewer = page.getViewer();
if (viewer instanceof CheckboxTreeViewer) {
- ((CheckboxTreeViewer)viewer).addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- setPageComplete(validatePage());
- }
- });
+ ((CheckboxTreeViewer)viewer).addCheckStateListener(event -> setPageComplete(validatePage()));
}
}
}
@@ -958,15 +947,14 @@ public class GenerateDiffFileWizard extends Wizard {
super(""); //$NON-NLS-1$
fLocationPage=page;
}
+ @Override
public IStatus run(IProgressMonitor monitor) {
monitor.beginTask(CVSUIMessages.CommitWizard_4, IProgressMonitor.UNKNOWN);
syncInfoCollector.waitForCollector(monitor);
- Utils.syncExec(new Runnable() {
- public void run() {
- fLocationPage.initCheckedItems();
- fLocationPage.canValidate=true;
- fLocationPage.validatePage();
- }
+ Utils.syncExec((Runnable) () -> {
+ fLocationPage.initCheckedItems();
+ fLocationPage.canValidate=true;
+ fLocationPage.validatePage();
}, getControl());
monitor.done();
return Status.OK_STATUS;
@@ -982,12 +970,10 @@ public class GenerateDiffFileWizard extends Wizard {
public IFile findBinaryFile() {
try {
final IFile[] found = new IFile[1];
- fParticipant.getSubscriber().accept(resources, IResource.DEPTH_INFINITE, new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- if (isBinaryFile(diff))
- found[0] = getFile(diff);
- return true;
- }
+ fParticipant.getSubscriber().accept(resources, IResource.DEPTH_INFINITE, (IDiffVisitor) diff -> {
+ if (isBinaryFile(diff))
+ found[0] = getFile(diff);
+ return true;
});
return found[0];
} catch (CoreException e) {
@@ -1026,15 +1012,13 @@ public class GenerateDiffFileWizard extends Wizard {
public void removeBinaryFiles() {
try {
final List nonBinaryFiles = new ArrayList();
- fParticipant.getSubscriber().accept(resources, IResource.DEPTH_INFINITE, new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- if (!isBinaryFile(diff)) {
- IFile file = getFile(diff);
- if (file != null)
- nonBinaryFiles.add(file);
- }
- return true;
+ fParticipant.getSubscriber().accept(resources, IResource.DEPTH_INFINITE, (IDiffVisitor) diff -> {
+ if (!isBinaryFile(diff)) {
+ IFile file = getFile(diff);
+ if (file != null)
+ nonBinaryFiles.add(file);
}
+ return true;
});
resources = (IResource[]) nonBinaryFiles
.toArray(new IResource[nonBinaryFiles.size()]);
@@ -1102,6 +1086,7 @@ public class GenerateDiffFileWizard extends Wizard {
/*
* @see IDialogPage#createControl(Composite)
*/
+ @Override
public void createControl(Composite parent) {
Composite composite= new Composite(parent, SWT.NULL);
GridLayout layout= new GridLayout();
@@ -1159,6 +1144,7 @@ public class GenerateDiffFileWizard extends Wizard {
//add listeners
unifiedDiffOption.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
setEnableUnifiedGroup(true);
updateEnablements();
@@ -1167,6 +1153,7 @@ public class GenerateDiffFileWizard extends Wizard {
});
contextDiffOption.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
setEnableUnifiedGroup(false);
updateEnablements();
@@ -1175,6 +1162,7 @@ public class GenerateDiffFileWizard extends Wizard {
});
regularDiffOption.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
setEnableUnifiedGroup(false);
updateEnablements();
@@ -1184,6 +1172,7 @@ public class GenerateDiffFileWizard extends Wizard {
unified_workspaceRelativeOption
.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
unifiedRadioGroup.setSelection(ROOT_WORKSPACE, false);
}
@@ -1191,6 +1180,7 @@ public class GenerateDiffFileWizard extends Wizard {
unified_projectRelativeOption
.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
unifiedRadioGroup.setSelection(ROOT_PROJECT, false);
}
@@ -1198,6 +1188,7 @@ public class GenerateDiffFileWizard extends Wizard {
unified_selectionRelativeOption
.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
unifiedRadioGroup.setSelection(ROOT_SELECTION, false);
}
@@ -1461,6 +1452,7 @@ public class GenerateDiffFileWizard extends Wizard {
this.unifiedSelectionEnabled=unifiedSelectionEnabled;
}
+ @Override
public void addPages() {
String pageTitle = CVSUIMessages.GenerateCVSDiff_pageTitle;
String pageDescription = CVSUIMessages.GenerateCVSDiff_pageDescription;
@@ -1493,6 +1485,7 @@ public class GenerateDiffFileWizard extends Wizard {
/* (Non-javadoc)
* Method declared on IWizard.
*/
+ @Override
public boolean needsProgressMonitor() {
return true;
}
@@ -1501,6 +1494,7 @@ public class GenerateDiffFileWizard extends Wizard {
* Completes processing of the wizard. If this method returns <code>
* true</code>, the wizard will close; otherwise, it will stay active.
*/
+ @Override
public boolean performFinish() {
final int location= locationPage.getSelectedLocation();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizardSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizardSelectionPage.java
index fd59de180..f21fca9c1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizardSelectionPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModeWizardSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,43 +12,23 @@ package org.eclipse.team.internal.ccvs.ui.wizards;
import java.text.Collator; // don't use ICU, pending resolution of issue
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Iterator;
+import java.util.*;
import java.util.List;
-import java.util.Observable;
-import java.util.Observer;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.util.StringMatcher;
import org.eclipse.team.internal.ccvs.ui.*;
@@ -71,10 +51,12 @@ public class ModeWizardSelectionPage extends WizardPage {
fTable= table;
}
+ @Override
public boolean canModify(Object element, String property) {
return PROPERTY_MODE.equals(property);
}
+ @Override
public Object getValue(Object element, String property) {
if (PROPERTY_MODE.equals(property)) {
final KSubstOption mode= ((ModeChange)element).getNewMode();
@@ -87,6 +69,7 @@ public class ModeWizardSelectionPage extends WizardPage {
return null;
}
+ @Override
public void modify(Object element, String property, Object value) {
if (element instanceof Item)
element= ((Item)element).getData();
@@ -108,6 +91,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fDecoratingLP.addListener(fTable);
}
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == INDEX_FILE) {
return fDecoratingLP.getImage(((ModeChange)element).getFile());
@@ -115,6 +99,7 @@ public class ModeWizardSelectionPage extends WizardPage {
return null;
}
+ @Override
public String getColumnText(Object element, int columnIndex) {
final ModeChange change= (ModeChange)element;
switch (columnIndex) {
@@ -125,17 +110,21 @@ public class ModeWizardSelectionPage extends WizardPage {
throw new IllegalArgumentException();
}
+ @Override
public void addListener(ILabelProviderListener listener) {
}
+ @Override
public boolean isLabelProperty(Object element, String property) {
return false;
}
+ @Override
public void dispose() {
fDecoratingLP.removeListener(fTable);
}
+ @Override
public void removeListener(ILabelProviderListener listener) {
}
}
@@ -170,6 +159,7 @@ public class ModeWizardSelectionPage extends WizardPage {
pathColumn.addSelectionListener(this);
}
+ @Override
public int compare(Viewer viewer, Object e1, Object e2) {
final ModeChange mc1= (ModeChange)e1;
@@ -202,6 +192,7 @@ public class ModeWizardSelectionPage extends WizardPage {
return fAscending ? compare : -compare;
}
+ @Override
public void widgetSelected(SelectionEvent e) {
final int index= columnToIndex(e.widget);
if (index == fIndex) {
@@ -230,6 +221,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fViewer.refresh();
}
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
// nop
}
@@ -306,6 +298,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fViewer.addSelectionChangedListener(this);
fileColumn.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
}
@@ -318,6 +311,7 @@ public class ModeWizardSelectionPage extends WizardPage {
return fViewer;
}
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
setChanged();
notifyObservers(fViewer.getSelection());
@@ -340,9 +334,10 @@ public class ModeWizardSelectionPage extends WizardPage {
}
public IStructuredSelection getSelection() {
- return (IStructuredSelection)fViewer.getSelection();
+ return fViewer.getStructuredSelection();
}
+ @Override
public void labelProviderChanged(LabelProviderChangedEvent event) {
fViewer.refresh();
}
@@ -364,15 +359,18 @@ public class ModeWizardSelectionPage extends WizardPage {
private static final class ModeChangeContentProvider implements IStructuredContentProvider {
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
+ @Override
public Object[] getElements(Object inputElement) {
// new FetchJob(fViewer, (List)inputElement, fPattern);
// return new Object[0];
return ((List)inputElement).toArray();
}
+ @Override
public void dispose() {
}
}
@@ -391,6 +389,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fTable.addObserver(this);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
final KSubstOption mode= MODES[fCombo.getSelectionIndex()];
final IStructuredSelection selection= fTable.getSelection();
@@ -401,8 +400,9 @@ public class ModeWizardSelectionPage extends WizardPage {
fTable.modelChanged(true);
}
+ @Override
public void update(Observable o, Object arg) {
- final IStructuredSelection selection= (IStructuredSelection)fTable.getViewer().getSelection();
+ final IStructuredSelection selection= fTable.getViewer().getStructuredSelection();
if (selection.isEmpty()) {
fCombo.deselectAll();
@@ -431,6 +431,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fMatcher= new StringMatcher("*", true, false); //$NON-NLS-1$
}
+ @Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
final ModeChange change= (ModeChange)element;
if (fFilterUnchanged && !change.hasChanged())
@@ -469,6 +470,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fTable.addObserver(this);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
fButton.setEnabled(false);
final IStructuredSelection selection= fTable.getSelection();
@@ -479,6 +481,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fTable.modelChanged(true);
}
+ @Override
public void update(Observable o, Object arg) {
final IStructuredSelection selection= fTable.getSelection();
for (final Iterator iter = selection.iterator(); iter.hasNext();) {
@@ -508,6 +511,7 @@ public class ModeWizardSelectionPage extends WizardPage {
}
+ @Override
public void widgetSelected(SelectionEvent e) {
final IStructuredSelection selection= fTable.getSelection();
for (Iterator iter = selection.iterator(); iter.hasNext();) {
@@ -517,6 +521,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fTable.modelChanged(true);
}
+ @Override
public void update(Observable o, Object arg) {
fButton.setEnabled(!fTable.getSelection().isEmpty());
}
@@ -536,6 +541,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fButton.addSelectionListener(this);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
fPage.getTable().selectAll();
}
@@ -555,6 +561,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fButton.addSelectionListener(this);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
fPage.getTable().selectNone();
}
@@ -574,6 +581,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fCheck.addSelectionListener(this);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
final ModeChangeTable table= fPage.getTable();
table.getFilter().filterUnchanged(fCheck.getSelection());
@@ -599,11 +607,13 @@ public class ModeWizardSelectionPage extends WizardPage {
fTextField.addModifyListener(this);
}
+ @Override
public void widgetSelected(SelectionEvent e) {
fTextField.setText(""); //$NON-NLS-1$
fTextField.setFocus();
}
+ @Override
public void modifyText(ModifyEvent e) {
final ModeChangeTable table= fPage.getTable();
table.getFilter().setPattern(fTextField.getText());
@@ -627,6 +637,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
}
+ @Override
public void update(Observable o, Object arg) {
updateText(fTable.getNumberOfChanges());
}
@@ -652,6 +663,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
}
+ @Override
public void update(Observable o, Object arg) {
updateText(fTable.getSelection().size());
}
@@ -681,12 +693,10 @@ public class ModeWizardSelectionPage extends WizardPage {
static {
MODES= KSubstOption.getAllKSubstOptions();
- Arrays.sort(MODES, new Comparator() {
- public int compare(Object a, Object b) {
- String aKey = ((KSubstOption)a).getLongDisplayText();
- String bKey = ((KSubstOption) b).getLongDisplayText();
- return aKey.compareTo(bKey);
- }
+ Arrays.sort(MODES, (a, b) -> {
+ String aKey = a.getLongDisplayText();
+ String bKey = b.getLongDisplayText();
+ return aKey.compareTo(bKey);
});
COMBO_TEXT= new String[MODES.length];
int maxLength= 0;
@@ -708,6 +718,7 @@ public class ModeWizardSelectionPage extends WizardPage {
fChanges= modeChanges;
}
+ @Override
public void createControl(final Composite parent) {
final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent);
@@ -771,12 +782,10 @@ public class ModeWizardSelectionPage extends WizardPage {
SWTUtils.createPlaceholder(leftGroup, 1);
final Label infoLabel= SWTUtils.createLabel(leftGroup, CVSUIMessages.ModeWizardSelectionPage_23, 3);
- fTable.addObserver(new Observer() {
- public void update(Observable o, Object arg) {
- final boolean enabled= !fTable.getSelection().isEmpty();
- leftGroup.setEnabled(enabled);
- infoLabel.setEnabled(enabled);
- }
+ fTable.addObserver((o, arg) -> {
+ final boolean enabled= !fTable.getSelection().isEmpty();
+ leftGroup.setEnabled(enabled);
+ infoLabel.setEnabled(enabled);
});
/**
@@ -803,11 +812,9 @@ public class ModeWizardSelectionPage extends WizardPage {
}
private void setupListeners() {
- fCommentArea.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty() != null) {
- validatePage();
- }
+ fCommentArea.addPropertyChangeListener(event -> {
+ if (event.getProperty() != null) {
+ validatePage();
}
});
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java
index 51f150e8f..6335babb7 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/RepositorySelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,6 +34,7 @@ import org.eclipse.ui.model.*;
public class RepositorySelectionPage extends CVSWizardPage {
private class DecoratingRepoLabelProvider extends WorkbenchLabelProvider {
+ @Override
protected String decorateText(String input, Object element) {
//Used to process RTL locales only
return TextProcessor.process(input, ":@/"); //$NON-NLS-1$
@@ -78,6 +79,7 @@ public class RepositorySelectionPage extends CVSWizardPage {
*
* @param parent the parent of the created widgets
*/
+ @Override
public void createControl(Composite parent) {
Composite composite = createComposite(parent, 1, false);
// set F1 help
@@ -91,6 +93,7 @@ public class RepositorySelectionPage extends CVSWizardPage {
useExistingRepo = createRadioButton(composite, CVSUIMessages.RepositorySelectionPage_useExisting, 1);
useExistingRepo.addKeyListener(new KeyAdapter() {
+ @Override
public void keyPressed(KeyEvent e) {
if (table.getTable().getItemCount() > 0) {
table.getTable().setFocus();
@@ -103,12 +106,9 @@ public class RepositorySelectionPage extends CVSWizardPage {
table.setContentProvider(new WorkbenchContentProvider());
table.setLabelProvider(new DecoratingRepoLabelProvider()/*WorkbenchLabelProvider()*/);
table.setComparator(new RepositoryComparator());
- table.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- getContainer().showPage(getNextPage());
- }
- });
+ table.addDoubleClickListener(event -> getContainer().showPage(getNextPage()));
table.getTable().addKeyListener(new KeyAdapter() {
+ @Override
public void keyPressed(KeyEvent e) {
traverseRepositories(e.character);
}
@@ -119,25 +119,21 @@ public class RepositorySelectionPage extends CVSWizardPage {
initializeValues();
Dialog.applyDialogFont(parent);
- table.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- result = (ICVSRepositoryLocation)((IStructuredSelection)table.getSelection()).getFirstElement();
- setPageComplete(true);
- }
- });
+ table.addSelectionChangedListener(event -> {
+ result = (ICVSRepositoryLocation)table.getStructuredSelection().getFirstElement();
+ setPageComplete(true);
+ });
- useExistingRepo.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- if (useNewRepo.getSelection()) {
- table.getTable().setEnabled(false);
- result = null;
- } else {
- table.getTable().setEnabled(true);
- result = (ICVSRepositoryLocation)((IStructuredSelection)table.getSelection()).getFirstElement();
- }
- setPageComplete(true);
- }
- });
+ useExistingRepo.addListener(SWT.Selection, event -> {
+ if (useNewRepo.getSelection()) {
+ table.getTable().setEnabled(false);
+ result = null;
+ } else {
+ table.getTable().setEnabled(true);
+ result = (ICVSRepositoryLocation)table.getStructuredSelection().getFirstElement();
+ }
+ setPageComplete(true);
+ });
}
/**
* Initializes states of the controls.
@@ -163,6 +159,7 @@ public class RepositorySelectionPage extends CVSWizardPage {
public ICVSRepositoryLocation getLocation() {
return result;
}
+ @Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
index f639405ee..56e7f7d17 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/history/LocalHistoryPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2017 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -390,7 +390,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
@Override
public void widgetSelected(SelectionEvent e) {
compareAction.setCurrentFileRevision(getCurrentFileRevision());
- compareAction.selectionChanged((IStructuredSelection) treeViewer.getSelection());
+ compareAction.selectionChanged(treeViewer.getStructuredSelection());
}
});
@@ -401,7 +401,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
treeViewer.getTree().addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
- openAction.selectionChanged((IStructuredSelection) treeViewer.getSelection());
+ openAction.selectionChanged(treeViewer.getStructuredSelection());
}
});
@@ -410,7 +410,7 @@ public class LocalHistoryPage extends HistoryPage implements IHistoryCompareAdap
treeViewer.getTree().addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
- openWithMenu.selectionChanged((IStructuredSelection) treeViewer.getSelection());
+ openWithMenu.selectionChanged(treeViewer.getStructuredSelection());
}
});
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java
index 0eef4dd9b..c29257cb4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/FileTypeTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -65,9 +65,6 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
public Item(String name, boolean contributed) { this.name= name; this.contributed = contributed; save= true; mode= Team.BINARY; }
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
@Override
public int compareTo(Object o) {
return name.compareTo(((Item)o).name);
@@ -196,7 +193,7 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
@Override
public void modify(Object element, String property, Object value) {
- final IStructuredSelection selection = (IStructuredSelection)fTableViewer.getSelection();
+ final IStructuredSelection selection = fTableViewer.getStructuredSelection();
final Item item= (Item)selection.getFirstElement();
if (item == null)
return;
@@ -270,7 +267,7 @@ public class FileTypeTable implements ICellModifier, IStructuredContentProvider,
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
public IStructuredSelection getSelection() {
- return (IStructuredSelection)fTableViewer.getSelection();
+ return fTableViewer.getStructuredSelection();
}
public void setInput(List items) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
index de9a9ec3d..c300416d3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -404,7 +404,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
*/
protected IResource[] getSelectedResources() {
StructuredViewer viewer = getViewer();
- return getResources(((IStructuredSelection) viewer.getSelection()).toArray());
+ return getResources(viewer.getStructuredSelection().toArray());
}
/*
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
index 64e7edc28..e7fb11159 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractTreeViewerAdvisor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -59,7 +59,7 @@ public abstract class AbstractTreeViewerAdvisor extends StructuredViewerAdvisor
if (!noNextChange) {
// Check to see if the selected element can be opened.
// If it can't, try the next one
- Object selectedObject = AbstractTreeViewerAdvisor.this.getFirstElement((IStructuredSelection)getViewer().getSelection());
+ Object selectedObject = AbstractTreeViewerAdvisor.this.getFirstElement(getViewer().getStructuredSelection());
if (!hasCompareInput(selectedObject)) {
return selectChange(next);
}
@@ -101,7 +101,7 @@ public abstract class AbstractTreeViewerAdvisor extends StructuredViewerAdvisor
private CompareNavigator getSubNavigator() {
IWorkbenchSite ws = AbstractTreeViewerAdvisor.this.getConfiguration().getSite().getWorkbenchSite();
if (ws instanceof IWorkbenchPartSite) {
- Object selectedObject = AbstractTreeViewerAdvisor.this.getFirstElement((IStructuredSelection)getViewer().getSelection());
+ Object selectedObject = AbstractTreeViewerAdvisor.this.getFirstElement(getViewer().getStructuredSelection());
IEditorPart editor = OpenInCompareAction.findOpenCompareEditor((IWorkbenchPartSite)ws, selectedObject, getConfiguration().getParticipant());
if(editor != null) {
// if an existing editor is open on the current selection, use it
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
index 2b7b3194e..f7b55174e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/StructuredViewerAdvisor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -148,7 +148,7 @@ public abstract class StructuredViewerAdvisor extends AbstractViewerAdvisor {
viewer.addDoubleClickListener(event -> handleDoubleClick(viewer, event));
- viewer.addSelectionChangedListener(event -> updateActionBars((IStructuredSelection)viewer.getSelection()));
+ viewer.addSelectionChangedListener(event -> updateActionBars(viewer.getStructuredSelection()));
TeamUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(propertyListener);
}
@@ -367,7 +367,7 @@ public abstract class StructuredViewerAdvisor extends AbstractViewerAdvisor {
*/
protected void fillActionBars(IActionBars actionBars) {
getActionGroup().fillActionBars(actionBars);
- updateActionBars((IStructuredSelection) getViewer().getSelection());
+ updateActionBars(getViewer().getStructuredSelection());
Object input = getViewer().getInput();
if (input instanceof ISynchronizeModelElement) {
getActionGroup().modelChanged((ISynchronizeModelElement) input);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
index 8bd19e955..d56c4d060 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -900,7 +900,7 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
}
private boolean inputIsSelected(IEditorInput input) {
- IStructuredSelection selection= (IStructuredSelection) getViewer().getSelection();
+ IStructuredSelection selection= getViewer().getStructuredSelection();
if (selection.size() != 1)
return false;
IEditorInput selectionAsInput= getEditorInput(selection.getFirstElement());
@@ -1019,9 +1019,6 @@ public class SynchronizeView extends PageBookView implements ISynchronizeView, I
return selection.getFirstElement();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
- */
@Override
public boolean show(ShowInContext context) {
Object selection = getSingleElement(context.getSelection());
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
index 72ae10e2f..9c3b37b5b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TreeViewerAdvisor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -169,21 +169,15 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
return modelManager;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#initializeViewer(org.eclipse.jface.viewers.StructuredViewer)
- */
@Override
public boolean validateViewer(StructuredViewer viewer) {
return viewer instanceof AbstractTreeViewer;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.synchronize.viewers.StructuredViewerAdvisor#initializeListeners(org.eclipse.jface.viewers.StructuredViewer)
- */
@Override
protected void initializeListeners(final StructuredViewer viewer) {
super.initializeListeners(viewer);
- viewer.addSelectionChangedListener(event -> updateStatusLine((IStructuredSelection) event.getSelection()));
+ viewer.addSelectionChangedListener(event -> updateStatusLine(event.getStructuredSelection()));
}
/* private */ void updateStatusLine(IStructuredSelection selection) {
@@ -261,7 +255,7 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
@Override
public void dragStart(DragSourceEvent event) {
- final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ final IStructuredSelection selection = viewer.getStructuredSelection();
final Object [] array= selection.toArray();
event.doit= Utils.getResources(array).length > 0;
}
@@ -270,7 +264,7 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
public void dragSetData(DragSourceEvent event) {
if (ResourceTransfer.getInstance().isSupportedType(event.dataType)) {
- final IStructuredSelection selection= (IStructuredSelection)viewer.getSelection();
+ final IStructuredSelection selection= viewer.getStructuredSelection();
final Object [] array= selection.toArray();
event.data= Utils.getResources(array);
}
@@ -314,9 +308,6 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
return new DecoratingColorLabelProvider(provider, decorators);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#dispose()
- */
@Override
public void dispose() {
if (statusLine != null) {
@@ -325,9 +316,6 @@ public class TreeViewerAdvisor extends AbstractTreeViewerAdvisor {
super.dispose();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.StructuredViewerAdvisor#initializeStatusLine(org.eclipse.ui.IActionBars)
- */
@Override
protected void initializeStatusLine(IActionBars actionBars) {
statusLine = new SyncInfoSetStatusLineContributionGroup(
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java
index 5d586ee18..7cd5e9e03 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,9 +32,9 @@ public class ExpandAllAction extends Action implements ISelectionChangedListener
protected void expandAllFromSelection() {
AbstractTreeViewer tree = viewer;
if (tree == null) return;
- ISelection selection = tree.getSelection();
+ IStructuredSelection selection = tree.getStructuredSelection();
if(! selection.isEmpty()) {
- Iterator elements = ((IStructuredSelection)selection).iterator();
+ Iterator elements = selection.iterator();
try {
tree.getControl().setRedraw(false);
while (elements.hasNext()) {
@@ -46,9 +46,7 @@ public class ExpandAllAction extends Action implements ISelectionChangedListener
}
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
+
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
index 74c820758..ee65cf432 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ConfigureProjectWizardMainPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -207,7 +207,7 @@ public class ConfigureProjectWizardMainPage extends WizardPage {
@Override
public IWizardPage getNextPage() {
if (selectedWizard == null) return null;
- if(! WorkbenchActivityHelper.allowUseOf(getTriggerPoint(), ((IStructuredSelection)viewer.getSelection()).getFirstElement())) return null;
+ if(! WorkbenchActivityHelper.allowUseOf(getTriggerPoint(), viewer.getStructuredSelection().getFirstElement())) return null;
return selectedWizard.getStartingPage();
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java
index 1165f337f..260b79743 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ExportProjectSetLocationPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2017 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -314,7 +314,7 @@ public class ExportProjectSetLocationPage extends TeamWizardPage {
}
private void getSelectedContainer() {
- Object obj = ((IStructuredSelection) wsTreeViewer.getSelection()).getFirstElement();
+ Object obj = wsTreeViewer.getStructuredSelection().getFirstElement();
if (obj instanceof IContainer)
wsContainer = (IContainer) obj;
@@ -339,7 +339,7 @@ public class ExportProjectSetLocationPage extends TeamWizardPage {
void setupListeners() {
wsTreeViewer.addSelectionChangedListener(event -> {
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
+ IStructuredSelection s = event.getStructuredSelection();
Object obj = s.getFirstElement();
if (obj != null) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java
index 15f61a3d7..97651b3ea 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/GlobalRefreshWizardSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -90,9 +90,6 @@ public class GlobalRefreshWizardSelectionPage extends WizardPage implements IDou
setTitle(TeamUIMessages.GlobalRefreshParticipantSelectionPage_2);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
@Override
public void dispose() {
if (createdImages != null) {
@@ -110,16 +107,13 @@ public class GlobalRefreshWizardSelectionPage extends WizardPage implements IDou
if (fViewer.getControl().isDisposed())
return;
- final IStructuredSelection selection= (IStructuredSelection)fViewer.getSelection();
+ final IStructuredSelection selection= fViewer.getStructuredSelection();
final Object selected= selection.getFirstElement();
if (!(selected instanceof SynchronizeWizardDescription))
return;
getDialogSettings().put(DEFAULT_SELECTION, ((SynchronizeWizardDescription)selected).getId());
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
@Override
public void createControl(Composite parent2) {
Composite top = new Composite(parent2, SWT.NULL);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
index 276e97b74..b7e712905 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/WorkingSetsDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2017 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -111,7 +111,7 @@ public class WorkingSetsDialog extends TitleAreaDialog {
void setupListeners() {
wsTableViewer.addSelectionChangedListener(event -> {
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
+ IStructuredSelection s = event.getStructuredSelection();
Object obj = s.getFirstElement();
if (obj instanceof IWorkingSet)
wsNameText.setText(((IWorkingSet) obj).getName());
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.java
index a56c8ca73..44e56bfb3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/MergeActionHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2017 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -83,7 +83,7 @@ public abstract class MergeActionHandler extends AbstractHandler {
}
/* private */ void updatedEnablement(SelectionChangedEvent event) {
- updateEnablement((IStructuredSelection)event.getSelection());
+ updateEnablement(event.getStructuredSelection());
}
/**
@@ -118,9 +118,6 @@ public abstract class MergeActionHandler extends AbstractHandler {
return selection;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- */
@Override
public boolean isEnabled() {
return enabled;
@@ -137,9 +134,6 @@ public abstract class MergeActionHandler extends AbstractHandler {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
try {
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java
index e2f55e7d4..5e1876125 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java
@@ -16,12 +16,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
@@ -80,11 +77,7 @@ public class FileSystemHistoryPage extends HistoryPage {
fileHistory.refresh(monitor);
//Internal code used for convenience - you can use
//your own here
- Utils.asyncExec(new Runnable() {
- public void run() {
- tableViewer.setInput(fileHistory);
- }
- }, tableViewer);
+ Utils.asyncExec((Runnable) () -> tableViewer.setInput(fileHistory), tableViewer);
}
return status;
@@ -143,18 +136,16 @@ public class FileSystemHistoryPage extends HistoryPage {
openAction = new OpenFileSystemRevisionAction("Open"); //$NON-NLS-1$
tableViewer.getTable().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- openAction.selectionChanged((IStructuredSelection) tableViewer.getSelection());
+ openAction.selectionChanged(tableViewer.getStructuredSelection());
}
});
openAction.setPage(this);
//Contribute actions to popup menu
MenuManager menuMgr = new MenuManager();
Menu menu = menuMgr.createContextMenu(tableViewer.getTable());
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- menuMgr.add(new Separator(IWorkbenchActionConstants.GROUP_FILE));
- menuMgr.add(openAction);
- }
+ menuMgr.addMenuListener(menuMgr1 -> {
+ menuMgr1.add(new Separator(IWorkbenchActionConstants.GROUP_FILE));
+ menuMgr1.add(openAction);
});
menuMgr.setRemoveAllWhenShown(true);
tableViewer.getTable().setMenu(menu);
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergePage.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergePage.java
index 1ec6e3b52..863fcb8d0 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergePage.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/NonSyncModelMergePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,7 +19,6 @@ import org.eclipse.core.resources.*;
import org.eclipse.core.resources.mapping.*;
import org.eclipse.core.runtime.*;
import org.eclipse.jface.action.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.*;
@@ -204,11 +203,7 @@ public class NonSyncModelMergePage extends Page {
private void hookContextMenu(final TreeViewer viewer) {
final MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager);
- }
- });
+ menuMgr.addMenuListener(manager -> fillContextMenu(manager));
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
}
@@ -230,18 +225,16 @@ public class NonSyncModelMergePage extends Page {
Action markAsMerged = new Action("Mark as Merged") {
public void run() {
try {
- final IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IDiff[] diffs = getSelectedDiffs(selection, monitor);
- if (!checkForModelOverlap(diffs, monitor)) {
- return;
- }
- try {
- context.markAsMerged(diffs, false, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
+ final IStructuredSelection selection = viewer.getStructuredSelection();
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(monitor -> {
+ IDiff[] diffs = getSelectedDiffs(selection, monitor);
+ if (!checkForModelOverlap(diffs, monitor)) {
+ return;
+ }
+ try {
+ context.markAsMerged(diffs, false, monitor);
+ } catch (CoreException e) {
+ throw new InvocationTargetException(e);
}
});
} catch (InvocationTargetException e) {

Back to the top