From 6839fa9c6be38c0d1cd20c4f1b1ae912cf1c375d Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Thu, 15 Oct 2015 11:23:56 +0300 Subject: [PATCH] autotools: Modernize o.e.cdt.autotools.ui. * Enable warnings and save actions. * Replace useless @see comments with proper Override annotations. * Remove redundant type declarations. * Add missing Deprecated annotations. * Remove useless throws declarations. * Remove useless casts. * Remove useless method parameters. Change-Id: Ic93548f0d0b20706b36efb921a7a86adbe1b2608 Signed-off-by: Alexander Kurtakov --- .../.settings/org.eclipse.jdt.core.prefs | 95 ++++++- .../.settings/org.eclipse.jdt.ui.prefs | 60 +++++ .../META-INF/MANIFEST.MF | 2 +- build/org.eclipse.cdt.autotools.ui/pom.xml | 2 +- .../cdt/autotools/ui/AutotoolsUIPlugin.java | 3 + .../ui/editors/AutoconfAnnotationHover.java | 33 +-- .../ui/editors/AutoconfCodeScanner.java | 12 +- .../ui/editors/AutoconfDocumentProvider.java | 4 +- .../AutoconfDocumentSetupParticipant.java | 10 +- .../autotools/ui/editors/AutoconfEditor.java | 76 +++--- .../editors/AutoconfEditorMacroValidator.java | 4 +- .../ui/editors/AutoconfErrorHandler.java | 9 +- .../ui/editors/AutoconfIdentifierRule.java | 9 +- .../ui/editors/AutoconfKeywordDetector.java | 8 +- .../ui/editors/AutoconfM4WordDetector.java | 7 +- .../autotools/ui/editors/AutoconfMacro.java | 3 + .../ui/editors/AutoconfMacroCodeScanner.java | 12 +- .../AutoconfMacroContentAssistProcessor.java | 10 +- .../editors/AutoconfMacroDamagerRepairer.java | 8 +- .../AutoconfMacroParameterListValidator.java | 13 +- .../editors/AutoconfMacroPartitionRule.java | 3 + ...toconfMacroProposalContextInformation.java | 22 +- .../ui/editors/AutoconfMacroRule.java | 1 + .../ui/editors/AutoconfMacroWordDetector.java | 2 + .../ui/editors/AutoconfPKGWordDetector.java | 2 + .../ui/editors/AutoconfPartitionScanner.java | 2 +- .../ui/editors/AutoconfPartitioner.java | 1 + .../editors/AutoconfReconcilingStrategy.java | 3 + .../AutoconfSourceViewerConfiguration.java | 22 +- .../editors/AutoconfWhitespaceDetector.java | 1 + .../ui/editors/AutoconfWordDetector.java | 8 +- .../autotools/ui/editors/InlineDataRule.java | 1 + .../editors/MultilineRuleDamagerRepairer.java | 4 +- .../autotools/ui/editors/ParseException.java | 1 + .../ui/editors/RecursiveSingleLineRule.java | 6 +- .../ui/editors/RestrictedEndOfLineRule.java | 3 +- .../outline/AutoconfContentOutlinePage.java | 5 +- .../outline/AutoconfContentProvider.java | 6 + .../outline/AutoconfLabelProvider.java | 6 + .../ui/editors/parser/AutoconfElement.java | 9 +- .../parser/AutoconfMacroArgumentElement.java | 1 + .../editors/parser/AutoconfMacroDetector.java | 7 +- .../editors/parser/AutoconfMacroElement.java | 3 +- .../parser/AutoconfOutlineErrorHandler.java | 2 +- .../ui/editors/parser/AutoconfParser.java | 78 +++--- .../ui/editors/parser/ParseException.java | 1 + .../autotools/ui/editors/parser/Token.java | 1 + .../ui/AbstractAutotoolsCPropertyTab.java | 1 + .../cdt/internal/autotools/ui/Console.java | 4 + .../autotools/ui/ErrorParserBlock.java | 28 +- .../autotools/ui/HTML2TextReader.java | 11 +- .../autotools/ui/HTMLTextPresenter.java | 4 +- .../internal/autotools/ui/ResourceLookup.java | 1 + .../autotools/ui/ResourceLookupTree.java | 25 +- .../autotools/ui/SingleCharReader.java | 5 +- .../autotools/ui/SubstitutionTextReader.java | 18 +- .../ui/actions/AbstractAutotoolsHandler.java | 3 +- .../ui/actions/AbstractTargetAction.java | 3 + .../autotools/ui/actions/AclocalHandler.java | 4 +- .../autotools/ui/actions/AutoconfHandler.java | 4 +- .../ui/actions/AutoheaderHandler.java | 4 +- .../autotools/ui/actions/AutomakeHandler.java | 4 +- .../ui/actions/AutoreconfHandler.java | 4 +- .../ui/actions/InvokeAclocalAction.java | 2 + .../autotools/ui/actions/InvokeAction.java | 58 ++--- .../ui/actions/InvokeAutoconfAction.java | 2 + .../ui/actions/InvokeAutoheaderAction.java | 2 + .../ui/actions/InvokeAutomakeAction.java | 2 + .../ui/actions/InvokeAutoreconfAction.java | 2 + .../ui/actions/InvokeLibtoolizeAction.java | 2 + .../ui/actions/LibtoolizeHandler.java | 4 +- .../ui/actions/ReconfigureAction.java | 9 +- .../ui/actions/ReconfigureHandler.java | 4 +- .../ui/actions/SingleInputDialog.java | 5 +- .../autotools/ui/actions/TwoInputDialog.java | 6 +- .../autoconf/ProjectionFileUpdater.java | 42 ++- .../AbstractElementListSelectionDialog.java | 21 +- .../ui/editors/automake/AbstractMakefile.java | 68 +++-- .../automake/AbstractMakefileCodeScanner.java | 4 +- .../editors/automake/AutoconfSubstRule.java | 4 + .../automake/AutomakeCompletionProcessor.java | 48 +--- .../editors/automake/AutomakeConfigMacro.java | 1 + .../automake/AutomakeDocumentProvider.java | 20 +- .../ui/editors/automake/AutomakeEditor.java | 16 +- .../automake/AutomakeErrorHandler.java | 3 + .../ui/editors/automake/AutomakeIfElse.java | 2 - .../automake/AutomakeMacroDefinitionRule.java | 3 + .../automake/AutomakeMacroReferenceRule.java | 2 + .../editors/automake/AutomakeTextHover.java | 14 +- .../automake/AutomakeWordDetector.java | 2 + .../automake/AutomakefileCodeScanner.java | 12 +- .../AutomakefileContentOutlinePage.java | 74 +----- .../AutomakefileReconcilingStrategy.java | 14 +- .../AutomakefileSourceConfiguration.java | 14 +- .../ui/editors/automake/BadDirective.java | 1 + .../ui/editors/automake/Command.java | 10 +- .../ui/editors/automake/Comment.java | 3 + .../CompletionProposalComparator.java | 17 +- .../ui/editors/automake/Conditional.java | 8 + .../ui/editors/automake/DefineVariable.java | 2 + .../ui/editors/automake/Directive.java | 20 +- .../ui/editors/automake/EditorUtility.java | 246 +----------------- .../automake/ElementListSelectionDialog.java | 19 +- .../autotools/ui/editors/automake/Else.java | 14 +- .../ui/editors/automake/EmptyLine.java | 1 + .../autotools/ui/editors/automake/Endef.java | 2 + .../autotools/ui/editors/automake/Endif.java | 4 +- .../ui/editors/automake/ExportVariable.java | 1 + .../editors/automake/ExternalEditorInput.java | 54 ++-- .../automake/ExternalEditorInputFactory.java | 11 +- .../ui/editors/automake/GNUAutomakefile.java | 34 +-- .../ui/editors/automake/GNUTargetRule.java | 5 +- .../ui/editors/automake/GNUVariableDef.java | 18 +- .../ui/editors/automake/IDirective.java | 1 + .../ui/editors/automake/ITarget.java | 1 + .../autotools/ui/editors/automake/If.java | 14 +- .../autotools/ui/editors/automake/Ifdef.java | 2 + .../autotools/ui/editors/automake/Ifeq.java | 2 + .../autotools/ui/editors/automake/Ifndef.java | 2 + .../autotools/ui/editors/automake/Ifneq.java | 2 + .../ui/editors/automake/Include.java | 3 + .../ui/editors/automake/InferenceRule.java | 4 +- .../automake/LexicalSortingAction.java | 2 + .../ui/editors/automake/MacroDefinition.java | 28 +- .../editors/automake/MacroDefinitionRule.java | 3 + .../editors/automake/MacroReferenceRule.java | 2 + .../automake/MakefileAnnotationHover.java | 20 +- .../editors/automake/MakefileCodeScanner.java | 5 +- .../automake/MakefileCompletionProcessor.java | 48 +--- .../automake/MakefileContentOutlinePage.java | 52 ++-- .../automake/MakefileDocumentProvider.java | 28 +- .../MakefileDocumentSetupParticipant.java | 4 +- .../ui/editors/automake/MakefileEditor.java | 52 +--- .../MakefileEditorActionContributor.java | 12 +- ...akefileEditorTogglePresentationAction.java | 8 +- .../automake/MakefilePartitionScanner.java | 6 +- .../ui/editors/automake/MakefileReader.java | 1 + .../automake/MakefileReconcilingStrategy.java | 12 +- .../automake/MakefileSourceConfiguration.java | 26 +- .../MakefileStorageDocumentProvider.java | 5 +- .../editors/automake/MakefileTextHover.java | 14 +- .../automake/MakefileWordDetector.java | 8 +- .../ui/editors/automake/MessageLine.java | 10 +- .../ui/editors/automake/NullMakefile.java | 15 +- .../automake/OpenDeclarationAction.java | 6 +- .../editors/automake/OpenIncludeAction.java | 15 +- .../ui/editors/automake/OverrideDefine.java | 2 + .../ui/editors/automake/OverrideVariable.java | 1 + .../autotools/ui/editors/automake/Parent.java | 11 +- .../editors/automake/PosixMakefileUtil.java | 4 +- .../automake/ProjectionMakefileUpdater.java | 42 ++- .../ResourceMarkerAnnotationModel.java | 26 +- .../autotools/ui/editors/automake/Rule.java | 8 +- .../ui/editors/automake/SelectionList.java | 18 +- .../automake/SelectionStatusDialog.java | 12 +- .../ui/editors/automake/SpecialRule.java | 2 + .../ui/editors/automake/StaticTargetRule.java | 4 +- .../ui/editors/automake/StatusInfo.java | 37 +-- .../ui/editors/automake/StringMatcher.java | 3 +- .../autotools/ui/editors/automake/Target.java | 1 + .../ui/editors/automake/TargetRule.java | 5 +- .../ui/editors/automake/TargetVariable.java | 1 + .../ui/editors/automake/Terminal.java | 3 + .../ui/editors/automake/UnExport.java | 2 + .../autotools/ui/editors/automake/VPath.java | 3 + .../editors/automake/VariableDefinition.java | 14 +- .../ui/editors/automake/WordPartDetector.java | 4 +- .../editors/automake/WorkingCopyManager.java | 26 +- .../AbstractEditorPreferencePage.java | 30 ++- .../AutoconfEditorPreferencePage.java | 27 +- .../AutomakeEditorPreferencePage.java | 23 +- .../preferences/AutotoolsPreferencePage.java | 5 +- .../autotools/ui/preferences/ColorEditor.java | 2 + .../ui/preferences/ColorManager.java | 14 +- .../preferences/OverlayPreferenceStore.java | 36 ++- .../autotools/ui/preferences/StatusInfo.java | 12 +- .../ui/preferences/TabFolderLayout.java | 2 + .../AbstractConfigurePropertyOptionsPage.java | 1 + .../AutotoolsBuildPropertyPage.java | 13 + .../AutotoolsCategoryPropertyOptionPage.java | 16 +- .../AutotoolsConfigurePrefStore.java | 129 +++------ .../AutotoolsConfigurePropertyPage.java | 2 + .../AutotoolsConfigurePropertyTab.java | 36 ++- .../AutotoolsEditorPropertyTab.java | 64 +---- .../properties/AutotoolsPropertyManager.java | 11 +- .../AutotoolsToolPropertyOptionPage.java | 14 +- .../properties/AutotoolsToolsPropertyTab.java | 8 + .../properties/ToolListContentProvider.java | 8 +- .../ui/properties/ToolListElement.java | 2 +- .../ui/properties/ToolListLabelProvider.java | 8 +- .../ui/text/hover/AutoconfPrototype.java | 14 +- .../ui/text/hover/AutoconfTextHover.java | 26 +- .../ui/wizards/AutotoolsBuildWizard.java | 5 +- .../AutotoolsNewCCProjectWizardV2.java | 6 + .../wizards/AutotoolsNewCProjectWizardV2.java | 9 +- .../wizards/AutotoolsProjectImportWizard.java | 7 +- .../AutotoolsProjectImportWizardPage.java | 2 + .../ui/wizards/CProjectPlatformPage.java | 17 +- .../wizards/ConfigurationContentProvider.java | 3 + .../wizards/ConfigurationLabelProvider.java | 2 + .../ConvertToAutotoolsProjectWizard.java | 11 +- .../ConvertToAutotoolsProjectWizardPage.java | 11 +- .../ui/wizards/ManagedProjectOptionBlock.java | 6 +- .../NewAutotoolsProjectOptionPage.java | 23 +- .../autotools/ui/wizards/ReferenceBlock.java | 4 +- 205 files changed, 1282 insertions(+), 1605 deletions(-) create mode 100644 build/org.eclipse.cdt.autotools.ui/.settings/org.eclipse.jdt.ui.prefs diff --git a/build/org.eclipse.cdt.autotools.ui/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.autotools.ui/.settings/org.eclipse.jdt.core.prefs index 754c0e99e46..389a70f419c 100644 --- a/build/org.eclipse.cdt.autotools.ui/.settings/org.eclipse.jdt.core.prefs +++ b/build/org.eclipse.cdt.autotools.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,101 @@ -#Tue Oct 06 15:50:25 EDT 2009 eclipse.preferences.version=1 +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.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +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.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 +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.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=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +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=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +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=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +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=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 diff --git a/build/org.eclipse.cdt.autotools.ui/.settings/org.eclipse.jdt.ui.prefs b/build/org.eclipse.cdt.autotools.ui/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..1fd57ea9d0e --- /dev/null +++ b/build/org.eclipse.cdt.autotools.ui/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,60 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +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=true +sp_cleanup.format_source_code_changes_only=true +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +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=true +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 +sp_cleanup.use_type_arguments=false diff --git a/build/org.eclipse.cdt.autotools.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.autotools.ui/META-INF/MANIFEST.MF index 6592f323a6d..6eece64ff17 100644 --- a/build/org.eclipse.cdt.autotools.ui/META-INF/MANIFEST.MF +++ b/build/org.eclipse.cdt.autotools.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name.0 Bundle-SymbolicName: org.eclipse.cdt.autotools.ui;singleton:=true -Bundle-Version: 1.0.1.qualifier +Bundle-Version: 2.0.0.qualifier Bundle-Activator: org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin Bundle-Localization: plugin Bundle-Vendor: %provider diff --git a/build/org.eclipse.cdt.autotools.ui/pom.xml b/build/org.eclipse.cdt.autotools.ui/pom.xml index 4fcb6539a4b..c8cdd68ccdf 100644 --- a/build/org.eclipse.cdt.autotools.ui/pom.xml +++ b/build/org.eclipse.cdt.autotools.ui/pom.xml @@ -11,7 +11,7 @@ ../../pom.xml - 1.0.1-SNAPSHOT + 2.0.0-SNAPSHOT org.eclipse.cdt.autotools.ui eclipse-plugin \ No newline at end of file diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/AutotoolsUIPlugin.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/AutotoolsUIPlugin.java index d542037ec74..011b6e31321 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/AutotoolsUIPlugin.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/AutotoolsUIPlugin.java @@ -74,6 +74,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin { /** * This method is called upon plug-in activation */ + @Override public void start(BundleContext context) throws Exception { super.start(context); } @@ -81,6 +82,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin { /** * This method is called when the plug-in is stopped */ + @Override public void stop(BundleContext context) throws Exception { super.stop(context); plugin = null; @@ -179,6 +181,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin { display = Display.getDefault(); final IStatus fstatus = status; display.asyncExec(new Runnable() { + @Override public void run() { ErrorDialog.openError(null, title, null, fstatus); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfAnnotationHover.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfAnnotationHover.java index 1bdcf243ed7..03a3ac06ea3 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfAnnotationHover.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfAnnotationHover.java @@ -72,8 +72,8 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov if (model == null) return null; - List exact= new ArrayList(); - List including= new ArrayList(); + List exact= new ArrayList<>(); + List including= new ArrayList<>(); @SuppressWarnings("rawtypes") Iterator e= model.getAnnotationIterator(); @@ -95,9 +95,7 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov return select(exact, including); } - /* - * @see IVerticalRulerHover#getHoverInfo(ISourceViewer, int) - */ + @Override public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) { List annotations = getAnnotationsForLine(sourceViewer, lineNumber); if (annotations != null && annotations.size() > 0) { @@ -105,25 +103,25 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov if (annotations.size() == 1) { // optimization - Annotation annotation = (Annotation) annotations.get(0); + Annotation annotation = annotations.get(0); String message= annotation.getText(); if (message != null && message.trim().length() > 0) return formatSingleMessage(message); } else { - List messages= new ArrayList(); + List messages= new ArrayList<>(); Iterator e= annotations.iterator(); while (e.hasNext()) { - Annotation annotation = (Annotation) e.next(); + Annotation annotation = e.next(); String message= annotation.getText(); if (message != null && message.trim().length() > 0) messages.add(message.trim()); } if (messages.size() == 1) - return formatSingleMessage((String) messages.get(0)); + return formatSingleMessage(messages.get(0)); if (messages.size() > 1) return formatMultipleMessages(messages); @@ -134,16 +132,6 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov } -// private int getHoverWidth(Display display) { -// Rectangle displayBounds= display.getBounds(); -// int hoverWidth= displayBounds.width - (display.getCursorLocation().x - displayBounds.x); -// hoverWidth-= 12; // XXX: Add some space to the border, Revisit -// if (hoverWidth < 200) { -// hoverWidth= 200; -// } -// return hoverWidth; -// } - /* * Formats a message as HTML text. */ @@ -166,7 +154,7 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov HTMLPrinter.startBulletList(buffer); Iterator e= messages.iterator(); while (e.hasNext()) - HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent((String) e.next())); + HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent(e.next())); HTMLPrinter.endBulletList(buffer); HTMLPrinter.addPageEpilog(buffer); @@ -178,22 +166,27 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov // handles html. + @Override public IInformationControlCreator getHoverControlCreator() { return new IInformationControlCreator() { + @Override public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent, false); } }; } + @Override public boolean canHandleMouseCursor() { return false; } + @Override public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) { return new LineRange(lineNumber, 1); } + @Override public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleNumberOfLines) { return getHoverInfo(sourceViewer, lineRange.getStartLine()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfCodeScanner.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfCodeScanner.java index 728c3d9ba81..c27e201105d 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfCodeScanner.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfCodeScanner.java @@ -38,7 +38,7 @@ import org.eclipse.swt.graphics.RGB; public class AutoconfCodeScanner extends RuleBasedScanner { - private Map fTokenMap= new HashMap(); + private Map fTokenMap= new HashMap<>(); private String[] fPropertyNamesColor; /** @@ -82,7 +82,7 @@ public class AutoconfCodeScanner extends RuleBasedScanner { IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR); IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR); - List rules= new ArrayList(); + List rules= new ArrayList<>(); // Add rule for single line comments. rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$ @@ -159,9 +159,7 @@ public class AutoconfCodeScanner extends RuleBasedScanner { return -1; } - /* - * @see ITokenScanner#nextToken() - */ + @Override public IToken nextToken() { return super.nextToken(); } @@ -246,9 +244,7 @@ public class AutoconfCodeScanner extends RuleBasedScanner { } } - /* - * @see ICharacterScanner#unread() - */ + @Override public void unread() { --fOffset; fColumn = UNDEFINED; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentProvider.java index 1b89602b967..d3f07e3c65e 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentProvider.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentProvider.java @@ -25,6 +25,7 @@ public class AutoconfDocumentProvider extends TextFileDocumentProvider { disconnect(e.next()); } + @Override public void connect(Object element) throws CoreException { super.connect(element); // Remove all error markers for file as we will parse @@ -33,8 +34,9 @@ public class AutoconfDocumentProvider extends TextFileDocumentProvider { // h.removeAllExistingMarkers(); } + @Override public IDocument getDocument(Object element) { - FileInfo info= (FileInfo) getFileInfo(element); + FileInfo info= getFileInfo(element); if (info != null) return info.fTextFileBuffer.getDocument(); return getParentProvider().getDocument(element); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentSetupParticipant.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentSetupParticipant.java index 1c7dda224ce..875254b424a 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentSetupParticipant.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentSetupParticipant.java @@ -19,6 +19,7 @@ import org.eclipse.jface.text.IDocumentListener; public class AutoconfDocumentSetupParticipant implements IDocumentSetupParticipant, IDocumentListener { + @Override public void setup(IDocument document) { AutoconfPartitioner partitioner = new AutoconfPartitioner( @@ -34,17 +35,12 @@ public class AutoconfDocumentSetupParticipant implements // document.addDocumentListener(this); } - /* - * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent) - */ - + @Override public void documentAboutToBeChanged(DocumentEvent e) { // do nothing } - /* - * @see IDocumentListener#documentChanged(DocumentEvent) - */ + @Override public void documentChanged(DocumentEvent e) { // do nothing } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditor.java index 4347a371f58..aab53eac310 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditor.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditor.java @@ -118,7 +118,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro super(); } - protected void initializeEditor() { + @Override + protected void initializeEditor() { super.initializeEditor(); setDocumentProvider(getAutoconfDocumentProvider()); IPreferenceStore[] stores = new IPreferenceStore[2]; @@ -155,7 +156,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro return document; } - protected void doSetInput(IEditorInput newInput) throws CoreException + @Override + protected void doSetInput(IEditorInput newInput) throws CoreException { // If this editor is for a project file, remove this editor as a property // change listener. @@ -177,7 +179,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro { IDocument document = getInputDocument(); - setRootElement(reparseDocument(document, newInput)); + setRootElement(reparseDocument(document)); } catch (Exception e) { @@ -185,7 +187,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro } } - @SuppressWarnings({ "rawtypes" }) + @Override + @SuppressWarnings({ "rawtypes" }) public Object getAdapter(Class required) { if (ProjectionAnnotationModel.class.equals(required)) { if (fProjectionSupport != null) { @@ -264,6 +267,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro return ColorManager.getDefault().getColor(PreferenceConverter.getColor(AutotoolsPlugin.getDefault().getPreferenceStore(), key)); } + @Override public void handleProjectPropertyChanged(IProject project, String property) { if (property.equals(AutotoolsPropertyConstants.AUTOCONF_MACRO_VERSIONING)) { ISourceViewer sourceViewer= getSourceViewer(); @@ -285,24 +289,21 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro try { IDocument document = getInputDocument(); - setRootElement(reparseDocument(document, getEditorInput())); + setRootElement(reparseDocument(document)); } catch (Exception e) { e.printStackTrace(); } } - private AutoconfElement reparseDocument(IDocument document, - IEditorInput editorInput) { + private AutoconfElement reparseDocument(IDocument document) { AutoconfParser parser = getAutoconfParser(); ((AutoconfErrorHandler)parser.getErrorHandler()).removeAllExistingMarkers(); return parser.parse(document); } - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.AbstractTextEditor#handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent) - */ + @Override protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) @@ -354,16 +355,12 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro fHoverInfo= hoverInfo; fControlCreator= controlCreator; } - /* - * @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer, int) - */ - public IRegion getSubject(ITextViewer textViewer, int invocationOffset) { + @Override + public IRegion getSubject(ITextViewer textViewer, int invocationOffset) { return fHoverRegion; } - /* - * @see org.eclipse.jface.text.information.IInformationProvider#getInformation(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) - */ - public String getInformation(ITextViewer textViewer, IRegion subject) { + @Override + public String getInformation(ITextViewer textViewer, IRegion subject) { return fHoverInfo.toString(); } @@ -371,13 +368,12 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro * @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) * @since 3.2 */ - public Object getInformation2(ITextViewer textViewer, IRegion subject) { + @Override + public Object getInformation2(ITextViewer textViewer, IRegion subject) { return fHoverInfo; } - /* - * @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator() - */ - public IInformationControlCreator getInformationPresenterControlCreator() { + @Override + public IInformationControlCreator getInformationPresenterControlCreator() { return fControlCreator; } } @@ -408,10 +404,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro fTextOperationAction= textOperationAction; } - /* - * @see org.eclipse.jface.action.IAction#run() - */ - public void run() { + @Override + public void run() { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) { @@ -589,6 +583,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro * * @param listener The reconcile listener to be added */ + @Override public final void addReconcilingParticipant(IReconcilingParticipant listener) { synchronized (fReconcilingListeners) { fReconcilingListeners.add(listener); @@ -625,18 +620,14 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro return AutotoolsPlugin.getDefault().getPreferenceStore().getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED); } - /* (non-Javadoc) - * @see org.eclipse.ui.editors.text.TextEditor#initializeKeyBindingScopes() - */ + @Override protected void initializeKeyBindingScopes() { setKeyBindingScopes(new String [] { AutotoolsUIPlugin.getUniqueIdentifier() + ".editor.scope" } ); //$NON-NLS-1$ } - /** - * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions() - */ - protected void createActions() { + @Override + protected void createActions() { super.createActions(); // TODO: Figure out how to do this later. // fFoldingGroup= new FoldingActionGroup(this, getSourceViewer()); @@ -667,12 +658,14 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro * @param parent Parent composite of the control. */ - public void createPartControl(Composite parent) { + @Override + public void createPartControl(Composite parent) { super.createPartControl(parent); // Sticky hover support IInformationControlCreator informationControlCreator= new IInformationControlCreator() { - public IInformationControl createInformationControl(Shell shell) { + @Override + public IInformationControl createInformationControl(Shell shell) { return new DefaultInformationControl(shell, true); } }; @@ -705,7 +698,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro // fEditorSelectionChangedListener.install(getSelectionProvider()); } - protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { + @Override + protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); // ensure decoration support has been created and configured. @@ -715,9 +709,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro } - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ + @Override public void dispose() { if (fProjectionFileUpdater != null) { fProjectionFileUpdater.uninstall(); @@ -729,9 +721,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro super.dispose(); } - /* - * @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert() - */ + @Override protected void performRevert() { ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer(); projectionViewer.setRedraw(false); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMacroValidator.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMacroValidator.java index efb7f5b1428..2047378d4fb 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMacroValidator.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMacroValidator.java @@ -40,9 +40,7 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator { fEditor = autoconfEditor; } - /* (non-Javadoc) - * @see org.eclipse.cdt.autotools.ui.editors.parser.IAutoconfMacroValidator#validateMacroCall(org.eclipse.cdt.autotools.core.ui.editors.parser.AutoconfMacroElement) - */ + @Override public void validateMacroCall(AutoconfMacroElement macro) throws ParseException, InvalidMacroException { AutoconfPrototype p = AutoconfTextHover.getPrototype(macro.getName(), fEditor); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfErrorHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfErrorHandler.java index 55355299ce9..cdc416cfcba 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfErrorHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfErrorHandler.java @@ -33,7 +33,7 @@ public class AutoconfErrorHandler implements IAutoconfErrorHandler { private int CDT_WARNING = 1; private int CDT_ERROR = 2; - private Map annotations = new HashMap(); + private Map annotations = new HashMap<>(); private AnnotationModel fAnnotationModel; public AutoconfErrorHandler(IEditorInput input) { @@ -46,23 +46,24 @@ public class AutoconfErrorHandler implements IAutoconfErrorHandler { super(annotationType, persist, message); } + @Override public void setQuickFixable(boolean state) { // do nothing } + @Override public boolean isQuickFixableStateSet() { return true; } + @Override public boolean isQuickFixable() throws AssertionFailedException { return false; } } - /* (non-Javadoc) - * @see org.eclipse.cdt.autotools.ui.editors.IAutoconfErrorHandler#handleError(org.eclipse.cdt.autotools.core.ui.editors.parser.ParseException) - */ + @Override public void handleError(ParseException e) { Integer charStart = Integer.valueOf(e.getStartOffset()); Integer charEnd = Integer.valueOf(e.getEndOffset()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfIdentifierRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfIdentifierRule.java index 3a1bfbe6669..fec9b74e150 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfIdentifierRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfIdentifierRule.java @@ -26,20 +26,17 @@ public class AutoconfIdentifierRule implements IPredicateRule { fToken = token; } + @Override public IToken getSuccessToken() { return fToken; } - /* - * @see IRule#evaluate(ICharacterScanner) - */ + @Override public IToken evaluate(ICharacterScanner scanner) { return evaluate(scanner, false); } - /* - * @see IPredicateRule#evaluate(ICharacterScanner, resume) - */ + @Override public IToken evaluate(ICharacterScanner scanner, boolean resume) { int c = scanner.read(); if (Character.isLetterOrDigit((char)c) || fExtraChars.indexOf((char)c) >= 0) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfKeywordDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfKeywordDetector.java index d82f01092ab..ecca9c5b697 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfKeywordDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfKeywordDetector.java @@ -14,16 +14,12 @@ import org.eclipse.jface.text.rules.IWordDetector; public class AutoconfKeywordDetector implements IWordDetector { - /** - * @see IWordDetector#isWordPart(character) - */ + @Override public boolean isWordPart(char character) { return (Character.isLetter(character) && Character.isLowerCase(character)); } - /** - * @see IWordDetector#isWordStart(char) - */ + @Override public boolean isWordStart(char character) { return (Character.isLetter(character) && Character.isLowerCase(character)); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfM4WordDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfM4WordDetector.java index 86569e164f6..9dc56b30bf1 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfM4WordDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfM4WordDetector.java @@ -14,14 +14,13 @@ import org.eclipse.jface.text.rules.IWordDetector; public class AutoconfM4WordDetector implements IWordDetector { + @Override public boolean isWordPart(char c) { - // TODO Auto-generated method stub - return (Character.isLetter(c) || - Character.isDigit(c) || c == '_'); + return (Character.isLetter(c) || Character.isDigit(c) || c == '_'); } + @Override public boolean isWordStart(char c) { - // TODO Auto-generated method stub return (c == 'm'); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacro.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacro.java index e4875abef52..3d5b3dbe9c7 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacro.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacro.java @@ -36,11 +36,13 @@ public class AutoconfMacro implements Comparable { return (parms.length() > 0); } + @Override public int compareTo(Object x) { AutoconfMacro y = (AutoconfMacro) x; return getName().compareTo(y.getName()); } + @Override public boolean equals(Object x) { if (x == null) return false; @@ -48,6 +50,7 @@ public class AutoconfMacro implements Comparable { return getName().equals(y.getName()); } + @Override public int hashCode() { return getName().hashCode(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroCodeScanner.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroCodeScanner.java index 6f2a07da536..97f697184e5 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroCodeScanner.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroCodeScanner.java @@ -36,7 +36,7 @@ import org.eclipse.swt.graphics.RGB; public class AutoconfMacroCodeScanner extends RuleBasedScanner { - private Map fTokenMap= new HashMap(); + private Map fTokenMap= new HashMap<>(); private String[] fPropertyNamesColor; private int quoteLevel; @@ -82,7 +82,7 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner { IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR); IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR); - List rules= new ArrayList(); + List rules= new ArrayList<>(); // Add rule for single line comments. rules.add(new RestrictedEndOfLineRule("dnl", "[]", comment)); //$NON-NLS-1$ @@ -131,9 +131,7 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner { setRules(result); } - /* - * @see ITokenScanner#nextToken() - */ + @Override public IToken nextToken() { int ch = read(); if (ch == '[') { @@ -267,9 +265,7 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner { } } - /* - * @see ICharacterScanner#unread() - */ + @Override public void unread() { --fOffset; fColumn = UNDEFINED; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroContentAssistProcessor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroContentAssistProcessor.java index 83fb60ce555..499c34cb822 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroContentAssistProcessor.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroContentAssistProcessor.java @@ -46,6 +46,7 @@ public class AutoconfMacroContentAssistProcessor implements return offset; } + @Override public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { @@ -62,7 +63,7 @@ public class AutoconfMacroContentAssistProcessor implements } ICompletionProposal[] result = null; if (macros != null) { - ArrayList validList = new ArrayList(); + ArrayList validList = new ArrayList<>(); for (int i = 0; i < macros.length; ++i) { String name = macros[i].getName(); if (name.length() >= prefix.length()) { @@ -86,32 +87,37 @@ public class AutoconfMacroContentAssistProcessor implements } } result = new ICompletionProposal[validList.size()]; - result = (ICompletionProposal[])validList.toArray(result); + result = validList.toArray(result); } return result; } + @Override public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { // TODO Auto-generated method stub return null; } + @Override public char[] getCompletionProposalAutoActivationCharacters() { // TODO Auto-generated method stub return null; } + @Override public char[] getContextInformationAutoActivationCharacters() { // TODO Auto-generated method stub return null; } + @Override public IContextInformationValidator getContextInformationValidator() { // TODO Auto-generated method stub return new AutoconfMacroParameterListValidator(); } + @Override public String getErrorMessage() { // TODO Auto-generated method stub return null; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroDamagerRepairer.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroDamagerRepairer.java index e86c6e27b29..bd09d87dea6 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroDamagerRepairer.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroDamagerRepairer.java @@ -34,9 +34,7 @@ public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer { super(scanner); } - /* - * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean) - */ + @Override public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) { // In the case of a partition with multiline rules, we will punt to // reparse the entire partition because we don't know if the line being @@ -46,9 +44,7 @@ public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer { return partition; } - /* - * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion) - */ + @Override public void createPresentation(TextPresentation presentation, ITypedRegion region) { // int offset = region.getOffset(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroParameterListValidator.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroParameterListValidator.java index 42f412e407b..906fa5e771a 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroParameterListValidator.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroParameterListValidator.java @@ -39,10 +39,7 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV public AutoconfMacroParameterListValidator() { } - /** - * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int) - * @see IContextInformationPresenter#install(IContextInformation, ITextViewer, int) - */ + @Override public void install(IContextInformation info, ITextViewer viewer, int documentPosition) { fPosition= documentPosition; @@ -130,9 +127,7 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV return charCount; } - /** - * @see IContextInformationValidator#isContextInformationValid(int) - */ + @Override public boolean isContextInformationValid(int position) { try { @@ -152,9 +147,7 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV } } - /** - * @see IContextInformationPresenter#updatePresentation(int, TextPresentation) - */ + @Override public boolean updatePresentation(int position, TextPresentation presentation) { int currentParameter= -1; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroPartitionRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroPartitionRule.java index fb47b158ed2..8886b77b243 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroPartitionRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroPartitionRule.java @@ -45,6 +45,7 @@ public class AutoconfMacroPartitionRule implements IPredicateRule { m4MacroWordDetector = new AutoconfM4WordDetector(); } + @Override public IToken getSuccessToken() { return token; } @@ -77,12 +78,14 @@ public class AutoconfMacroPartitionRule implements IPredicateRule { } } + @Override public IToken evaluate(ICharacterScanner scanner, boolean resume) { // if (resume) // return Token.UNDEFINED; return evaluate(scanner); } + @Override public IToken evaluate(ICharacterScanner scanner) { int c = scanner.read(); fBuffer.setLength(0); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroProposalContextInformation.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroProposalContextInformation.java index 01cec3d4140..cf603e17b78 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroProposalContextInformation.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroProposalContextInformation.java @@ -55,9 +55,7 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat fInformationDisplayString= informationDisplayString; } - /* - * @see IContextInformation#equals(Object) - */ + @Override public boolean equals(Object object) { if (object instanceof IContextInformation) { IContextInformation contextInformation= (IContextInformation) object; @@ -69,36 +67,30 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat return false; } + @Override public int hashCode() { String combined = fInformationDisplayString.toLowerCase().concat(fContextDisplayString.toLowerCase()); return combined.hashCode(); } - /* - * @see IContextInformation#getInformationDisplayString() - */ + @Override public String getInformationDisplayString() { return fInformationDisplayString; } - /* - * @see IContextInformation#getImage() - */ + @Override public Image getImage() { return fImage; } - /* - * @see IContextInformation#getContextDisplayString() - */ + @Override public String getContextDisplayString() { if (fContextDisplayString != null) return fContextDisplayString; return fInformationDisplayString; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContextInformationExtension#getContextInformationPosition() - */ + + @Override public int getContextInformationPosition() { return fInformationPosition; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroRule.java index 66f3b361d43..045f0a3d3c4 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroRule.java @@ -45,6 +45,7 @@ public class AutoconfMacroRule implements IRule { fStartingSequence = startingSequence; } + @Override public IToken evaluate(ICharacterScanner scanner) { int c = scanner.read(); fBuffer.setLength(0); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroWordDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroWordDetector.java index 4ec3b2c95a4..46a9c6d86aa 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroWordDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroWordDetector.java @@ -14,11 +14,13 @@ import org.eclipse.jface.text.rules.IWordDetector; public class AutoconfMacroWordDetector implements IWordDetector { + @Override public boolean isWordPart(char c) { return ((Character.isLetter(c) && Character.isUpperCase(c)) || Character.isDigit(c) || c == '_'); } + @Override public boolean isWordStart(char c) { return (c == 'A'); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPKGWordDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPKGWordDetector.java index 2d5145a802e..bbcd9827266 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPKGWordDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPKGWordDetector.java @@ -14,11 +14,13 @@ import org.eclipse.jface.text.rules.IWordDetector; public class AutoconfPKGWordDetector implements IWordDetector { + @Override public boolean isWordPart(char c) { return ((Character.isLetter(c) && Character.isUpperCase(c)) || Character.isDigit(c) || c == '_'); } + @Override public boolean isWordStart(char c) { return (c == 'P'); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitionScanner.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitionScanner.java index 2082170eff4..e4cf7649ed3 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitionScanner.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitionScanner.java @@ -33,7 +33,7 @@ public class AutoconfPartitionScanner extends RuleBasedPartitionScanner { public AutoconfPartitionScanner() { super(); - List rules= new ArrayList(); + List rules= new ArrayList<>(); Token macro = new Token(AUTOCONF_MACRO); Token comment = new Token(AUTOCONF_COMMENT); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitioner.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitioner.java index f1b64c70505..24f4e21cac9 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitioner.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitioner.java @@ -30,6 +30,7 @@ public class AutoconfPartitioner extends FastPartitioner { // To optionally show partitions, we must do so by overriding the computePartitioning // method. We cannot do it at connect time because the document may be zero length // at the time and we will end up getting default partitioning from then on. + @Override public ITypedRegion[] computePartitioning(int offset, int length, boolean includeZeroLength) { ITypedRegion[] regions = super.computePartitioning(offset, length, includeZeroLength); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfReconcilingStrategy.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfReconcilingStrategy.java index 118c19dcd18..66ac18b8bf9 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfReconcilingStrategy.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfReconcilingStrategy.java @@ -33,6 +33,7 @@ public class AutoconfReconcilingStrategy implements IReconcilingStrategy { documentProvider = editor.getDocumentProvider(); } + @Override public void reconcile(IRegion partition) { try { AutoconfParser parser = editor.getAutoconfParser(); @@ -45,11 +46,13 @@ public class AutoconfReconcilingStrategy implements IReconcilingStrategy { } } + @Override public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { // TODO Auto-generated method stub } + @Override public void setDocument(IDocument document) { // TODO Auto-generated method stub diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfSourceViewerConfiguration.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfSourceViewerConfiguration.java index 97ac3e234a7..1b734928a12 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfSourceViewerConfiguration.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfSourceViewerConfiguration.java @@ -40,16 +40,12 @@ public class AutoconfSourceViewerConfiguration extends fEditor = editor; } - /* - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer) - */ + @Override public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) { return AutoconfEditor.AUTOCONF_PARTITIONING; } - /* - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer) - */ + @Override public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ContentAssistant assistant = new ContentAssistant(); @@ -66,39 +62,35 @@ public class AutoconfSourceViewerConfiguration extends return assistant; } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration - */ + @Override public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) { return new String[] { IDocument.DEFAULT_CONTENT_TYPE, AutoconfPartitionScanner.AUTOCONF_MACRO, AutoconfPartitionScanner.AUTOCONF_COMMENT}; } + @Override public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { if (acHover == null) acHover = new AutoconfTextHover(fEditor); return acHover; } + @Override public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { if (aaHover == null) aaHover = new AutoconfAnnotationHover(); return aaHover; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer) - */ + @Override public IReconciler getReconciler(ISourceViewer sourceViewer) { MonoReconciler reconciler= new MonoReconciler(new AutoconfReconcilingStrategy(fEditor), false); reconciler.setDelay(1000); reconciler.setProgressMonitor(new NullProgressMonitor()); return reconciler; } - /* (non-Javadoc) - * Method declared on SourceViewerConfiguration - */ + @Override public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { PresentationReconciler reconciler = new PresentationReconciler(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfWhitespaceDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfWhitespaceDetector.java index d89807999e4..f2a95700590 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfWhitespaceDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfWhitespaceDetector.java @@ -14,6 +14,7 @@ import org.eclipse.jface.text.rules.IWhitespaceDetector; public class AutoconfWhitespaceDetector implements IWhitespaceDetector { + @Override public boolean isWhitespace(char c) { return (c == ' ' || c == '\t' || c == '\n' || c == '\r'); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfWordDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfWordDetector.java index 1ae4a70f1be..9cc6fb6ca25 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfWordDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfWordDetector.java @@ -17,16 +17,12 @@ public class AutoconfWordDetector implements IWordDetector { private static final String correctStartSpecChars = "%*().><"; //$NON-NLS-1$ private static final String correctSpecChars = "@$/\\><"; //$NON-NLS-1$ - /** - * @see IWordDetector#isWordPart(character) - */ + @Override public boolean isWordPart(char character) { return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0); } - /** - * @see IWordDetector#isWordStart(char) - */ + @Override public boolean isWordStart(char character) { return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/InlineDataRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/InlineDataRule.java index 449a611a447..bd1c7d430eb 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/InlineDataRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/InlineDataRule.java @@ -60,6 +60,7 @@ public class InlineDataRule implements IRule { scanner.unread(); return true; } + @Override public IToken evaluate(ICharacterScanner scanner) { int c = scanner.read(); fBuffer.setLength(0); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/MultilineRuleDamagerRepairer.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/MultilineRuleDamagerRepairer.java index ba68d044bf7..ef333ad8a86 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/MultilineRuleDamagerRepairer.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/MultilineRuleDamagerRepairer.java @@ -29,9 +29,7 @@ public class MultilineRuleDamagerRepairer extends DefaultDamagerRepairer { super(scanner); } - /* - * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean) - */ + @Override public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) { // In the case of a partition with multiline rules, we will punt to // reparse the entire partition because we don't know if the line being diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/ParseException.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/ParseException.java index 5cd632099c1..8ebe4cf59e4 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/ParseException.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/ParseException.java @@ -30,6 +30,7 @@ public class ParseException extends Exception { public void setLineNumber(int lineNumber) { this.lineNumber = lineNumber; } + @Override public String getMessage() { return message; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RecursiveSingleLineRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RecursiveSingleLineRule.java index 356972c058b..5583b96d557 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RecursiveSingleLineRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RecursiveSingleLineRule.java @@ -72,7 +72,7 @@ public class RecursiveSingleLineRule extends SingleLineRule { super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF); this.startSequence = startSequence; this.endSequence = endSequence; - rules = new ArrayList(); + rules = new ArrayList<>(); startIndex = 0; endIndex = 0; } @@ -99,7 +99,7 @@ public class RecursiveSingleLineRule extends SingleLineRule { super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF, escapeContinuesLine); this.startSequence = startSequence; this.endSequence = endSequence; - rules = new ArrayList(); + rules = new ArrayList<>(); startIndex = 0; endIndex = 0; } @@ -108,6 +108,7 @@ public class RecursiveSingleLineRule extends SingleLineRule { rules.add(rule); } + @Override public IToken getSuccessToken() { // We need to be aware of what success token we are referring to. // The current internal rule index will help us determine which @@ -125,6 +126,7 @@ public class RecursiveSingleLineRule extends SingleLineRule { scanner.unread(); } + @Override public IToken evaluate(ICharacterScanner scanner, boolean resume) { int column = scanner.getColumn(); // Check if we are at EOF, in which case rules don't hold diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RestrictedEndOfLineRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RestrictedEndOfLineRule.java index 826b89afeab..6e2b39aa87b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RestrictedEndOfLineRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RestrictedEndOfLineRule.java @@ -71,7 +71,7 @@ public class RestrictedEndOfLineRule extends EndOfLineRule { super(startSequence, token, escapeCharacter, breaksOnEOF); this.startSequence = startSequence; this.restrictedChars = restrictedChars; - rules = new ArrayList(); + rules = new ArrayList<>(); startIndex = 0; endIndex = 0; } @@ -88,6 +88,7 @@ public class RestrictedEndOfLineRule extends EndOfLineRule { scanner.unread(); } + @Override public IToken evaluate(ICharacterScanner scanner, boolean resume) { int column = scanner.getColumn(); // Check if we are at EOF, in which case rules don't hold diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentOutlinePage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentOutlinePage.java index 951dc7b3878..db3f2adccc3 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentOutlinePage.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentOutlinePage.java @@ -43,7 +43,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage { } protected ISelection updateSelection(ISelection sel) { - ArrayList newSelection= new ArrayList(); + ArrayList newSelection= new ArrayList<>(); if (sel instanceof IStructuredSelection) { @SuppressWarnings("rawtypes") Iterator iter= ((IStructuredSelection)sel).iterator(); @@ -69,6 +69,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage { if (control != null && !control.isDisposed()) { control.getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (!control.isDisposed()) { // control.setRedraw(false); @@ -86,6 +87,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage { } } + @Override public void createControl(Composite parent) { super.createControl(parent); @@ -102,6 +104,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage { /* * Change in selection */ + @Override public void selectionChanged(SelectionChangedEvent event) { super.selectionChanged(event); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentProvider.java index 5e898545d94..ac4fb706f43 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentProvider.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentProvider.java @@ -36,11 +36,13 @@ public class AutoconfContentProvider implements ITreeContentProvider { this.documentProvider = editor.getDocumentProvider(); } + @Override public void dispose() { // TODO Auto-generated method stub } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (oldInput != null) { @@ -69,6 +71,7 @@ public class AutoconfContentProvider implements ITreeContentProvider { } } + @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof AutoconfElement) { AutoconfElement element = (AutoconfElement)parentElement; @@ -77,10 +80,12 @@ public class AutoconfContentProvider implements ITreeContentProvider { return new Object[0]; } + @Override public Object getParent(Object element) { return null; } + @Override public boolean hasChildren(Object element) { if (element instanceof AutoconfElement) { return ((AutoconfElement)element).hasChildren(); @@ -88,6 +93,7 @@ public class AutoconfContentProvider implements ITreeContentProvider { return false; } + @Override public Object[] getElements(Object inputElement) { return this.getChildren(editor.getRootElement()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfLabelProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfLabelProvider.java index 8795ad929cd..90a57ac32d5 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfLabelProvider.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfLabelProvider.java @@ -35,19 +35,24 @@ public class AutoconfLabelProvider implements ILabelProvider { super(); } + @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 Image getImage(Object element) { if (element instanceof AutoconfIfElement) return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_IF); @@ -74,6 +79,7 @@ public class AutoconfLabelProvider implements ILabelProvider { return null; } + @Override public String getText(Object element) { if (element instanceof AutoconfElement) { AutoconfElement e = (AutoconfElement)element; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElement.java index 8976969d6e8..8c629505de5 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElement.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElement.java @@ -34,16 +34,17 @@ public class AutoconfElement { this.name = name; this.var = var; this.startOffset = 0; - this.children = new ArrayList(); + this.children = new ArrayList<>(); } + @Override public String toString() { String source = getSource(); if (source == null) { StringBuffer kids = new StringBuffer(); for (Iterator iterator = children.iterator(); iterator.hasNext();) { - AutoconfElement kid = (AutoconfElement) iterator.next(); + AutoconfElement kid = iterator.next(); kids.append(kid.toString()); kids.append(","); //$NON-NLS-1$ } @@ -64,7 +65,7 @@ public class AutoconfElement { public AutoconfElement getLastChild() { if (hasChildren()) - return (AutoconfElement)children.get(children.size() - 1); + return children.get(children.size() - 1); return null; } @@ -77,7 +78,7 @@ public class AutoconfElement { } public AutoconfElement[] getChildren() { - return (AutoconfElement[]) children.toArray(new AutoconfElement[children.size()]); + return children.toArray(new AutoconfElement[children.size()]); } public boolean hasChildren() { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroArgumentElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroArgumentElement.java index 73718984bc2..ac874181712 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroArgumentElement.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroArgumentElement.java @@ -26,6 +26,7 @@ public class AutoconfMacroArgumentElement extends AutoconfElement { public AutoconfMacroArgumentElement(String name) { super(name); } + @Override public String getVar() { return super.getVar(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroDetector.java index 598e57db8da..3bd57ef5366 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroDetector.java @@ -14,16 +14,11 @@ package org.eclipse.cdt.autotools.ui.editors.parser; import java.util.regex.Pattern; -/** - * - */ public class AutoconfMacroDetector implements IAutoconfMacroDetector { private static final Pattern AUTOCONF_MACRO_PATTERN = Pattern.compile("PKG_.*|AC_.*|AM_.*|m4.*"); //$NON-NLS-1$ - /* (non-Javadoc) - * @see org.eclipse.cdt.autotools.core.ui.editors.parser.IAutoconfMacroDetector#isMacroIdentifier(java.lang.String) - */ + @Override public boolean isMacroIdentifier(String name) { return AUTOCONF_MACRO_PATTERN.matcher(name).matches(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroElement.java index a2edefc368e..3e030de9591 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroElement.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroElement.java @@ -22,6 +22,7 @@ public class AutoconfMacroElement extends AutoconfElement { super(name); } + @Override public String getVar() { if (children.size() > 0) return getParameter(0); @@ -33,7 +34,7 @@ public class AutoconfMacroElement extends AutoconfElement { } public String getParameter(int num) { - return ((AutoconfElement) children.get(num)).getName(); + return children.get(num).getName(); } /** diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfOutlineErrorHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfOutlineErrorHandler.java index e3ca4d234f3..29f0e46545f 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfOutlineErrorHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfOutlineErrorHandler.java @@ -68,7 +68,7 @@ public class AutoconfOutlineErrorHandler { int lineNumber = e.getLineNumber(); - Map map = new HashMap(); + Map map = new HashMap<>(); MarkerUtilities.setLineNumber(map, lineNumber); MarkerUtilities.setMessage(map, e.getMessage()); map.put(IMarker.MESSAGE, e.getMessage()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfParser.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfParser.java index 36d43815245..f32da17bdbe 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfParser.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfParser.java @@ -62,7 +62,7 @@ public class AutoconfParser { "format incr decr eval syscmd esyscmd sysval mkstemp maketemp errprint m4exit " + //$NON-NLS-1$ "__file__ __line__ __program__ "; //$NON-NLS-1$ - private static List m4builtins = new ArrayList(); + private static List m4builtins = new ArrayList<>(); static { m4builtins.addAll(Arrays.asList(M4_BUILTINS.split(" "))); //$NON-NLS-1$ } @@ -252,7 +252,7 @@ public class AutoconfParser { else exp = "do"; - handleError(block, token, AutoconfEditorMessages.getFormattedString(MISSING_SPECIFIER, exp)); + handleError(token, AutoconfEditorMessages.getFormattedString(MISSING_SPECIFIER, exp)); // assume we're still in the block... tokenizer.unreadToken(token); @@ -332,7 +332,7 @@ public class AutoconfParser { setSourceEnd(block, token); if (token.getType() != ITokenConstants.SH_ESAC) { - handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, block.getName())); + handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, block.getName())); } } @@ -410,7 +410,7 @@ public class AutoconfParser { case ITokenConstants.EOF: AutoconfElement element = parent; while (element != null && !(element instanceof AutoconfRootElement)) { - handleError(element, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, element.getName())); + handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, element.getName())); element = element.getParent(); } throw new BlockEndCondition(token); @@ -443,12 +443,12 @@ public class AutoconfParser { // being tolerant of nesting problems by allowing // stranded else/elif nodes but reporting errors. case ITokenConstants.SH_IF: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); parseBlock(parent, token, new AutoconfIfElement()); break; case ITokenConstants.SH_ELIF: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); checkBlockValidity( parent, token, new Class[] { AutoconfIfElement.class, AutoconfElifElement.class }, @@ -458,7 +458,7 @@ public class AutoconfParser { throw new BlockEndCondition(token); case ITokenConstants.SH_ELSE: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); checkBlockValidity( parent, token, new Class[] { AutoconfIfElement.class, AutoconfElifElement.class }, @@ -468,7 +468,7 @@ public class AutoconfParser { throw new BlockEndCondition(token); case ITokenConstants.SH_FI: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); checkBlockValidity( parent, token, new Class[] { AutoconfIfElement.class, AutoconfElifElement.class, AutoconfElseElement.class }, @@ -478,27 +478,27 @@ public class AutoconfParser { // 4. Look for for/while loops case ITokenConstants.SH_FOR: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); parseBlock(parent, token, new AutoconfForElement()); break; case ITokenConstants.SH_WHILE: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); parseBlock(parent, token, new AutoconfWhileElement()); break; case ITokenConstants.SH_UNTIL: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); parseBlock(parent, token, new AutoconfUntilElement()); break; case ITokenConstants.SH_SELECT: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); parseBlock(parent, token, new AutoconfSelectElement()); break; case ITokenConstants.SH_DONE: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); checkBlockValidity( parent, token, new Class[] { AutoconfForElement.class, AutoconfWhileElement.class, @@ -508,7 +508,7 @@ public class AutoconfParser { // 5. Look for case statements case ITokenConstants.SH_CASE: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); parseCaseBlock(parent, token, new AutoconfCaseElement()); break; @@ -520,7 +520,7 @@ public class AutoconfParser { throw new BlockEndCondition(token); case ITokenConstants.SH_ESAC: - checkLineStart(parent, token, atStart); + checkLineStart(token, atStart); checkBlockValidity( parent, token, // note: we don't strictly recurse here, so accept either parent @@ -539,9 +539,9 @@ public class AutoconfParser { } } - private void checkLineStart(AutoconfElement parent, Token token, boolean atStart) { + private void checkLineStart(Token token, boolean atStart) { if (!atStart) { - handleError(parent, token, AutoconfEditorMessages.getFormattedString(INVALID_TERMINATION, token.getText())); + handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_TERMINATION, token.getText())); } } @@ -554,8 +554,7 @@ public class AutoconfParser { private void parseHERE(AutoconfElement parent, Token controlToken) { Token token = tokenizer.readToken(); if (token.getType() == ITokenConstants.EOL || token.getType() == ITokenConstants.EOF) { - handleError(parent, token, - AutoconfEditorMessages.getString(INCOMPLETE_INLINE_MARKER)); + handleError(token, AutoconfEditorMessages.getString(INCOMPLETE_INLINE_MARKER)); } else { String hereTag = token.getText(); @@ -564,7 +563,7 @@ public class AutoconfParser { while (true) { token = tokenizer.readToken(); if (token.getType() == ITokenConstants.EOF) { - handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName())); + handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName())); break; } else if (token.getType() == ITokenConstants.EOL) { atEOL = true; @@ -630,7 +629,7 @@ public class AutoconfParser { // 5. Abort on unexpected tokens case ITokenConstants.SH_DO: case ITokenConstants.SH_THEN: - handleError(parent, token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText())); + handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText())); tokenizer.unreadToken(token); // close enough... return token; @@ -644,7 +643,7 @@ public class AutoconfParser { case ITokenConstants.SH_ELSE: case ITokenConstants.SH_FI: case ITokenConstants.SH_DONE: - handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName())); + handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName())); tokenizer.unreadToken(token); throw new BlockEndCondition(token); } @@ -684,7 +683,7 @@ public class AutoconfParser { // 4. Abort on unexpected tokens else switch (token.getType()) { case ITokenConstants.SH_THEN: - handleError(parent, token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText())); + handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText())); tokenizer.unreadToken(token); // close enough... //throw new ExprEndCondition(token); @@ -699,7 +698,7 @@ public class AutoconfParser { case ITokenConstants.SH_ELSE: case ITokenConstants.SH_FI: case ITokenConstants.SH_DONE: - handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName())); + handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName())); tokenizer.unreadToken(token); throw new BlockEndCondition(token); } @@ -746,9 +745,9 @@ public class AutoconfParser { case ITokenConstants.SH_DO: case ITokenConstants.SH_THEN: if (parent instanceof AutoconfCaseElement) - handleError(parent, token, AutoconfEditorMessages.getString(INVALID_IN)); + handleError(token, AutoconfEditorMessages.getString(INVALID_IN)); else - handleError(parent, token, AutoconfEditorMessages.getString(IMPROPER_CASE_CONDITION)); + handleError(token, AutoconfEditorMessages.getString(IMPROPER_CASE_CONDITION)); // close enough... return token; @@ -761,7 +760,7 @@ public class AutoconfParser { case ITokenConstants.SH_ELSE: case ITokenConstants.SH_FI: case ITokenConstants.SH_DONE: - handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName())); + handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName())); tokenizer.unreadToken(token); throw new BlockEndCondition(token); } @@ -789,8 +788,7 @@ public class AutoconfParser { } // not a match - handleError(parent, token, - AutoconfEditorMessages.getFormattedString(errorMessage, parent.getName(), token.getText())); + handleError(token, AutoconfEditorMessages.getFormattedString(errorMessage, parent.getName(), token.getText())); } /** @@ -879,7 +877,7 @@ public class AutoconfParser { && !(parent instanceof AutoconfForElement)) { Token peek = tokenizer.peekToken(); if (peek.getType() == ITokenConstants.RPAREN) { - handleError(macro, peek, AutoconfEditorMessages.getString(UNMATCHED_RIGHT_PARENTHESIS)); + handleError(peek, AutoconfEditorMessages.getString(UNMATCHED_RIGHT_PARENTHESIS)); } } @@ -888,10 +886,10 @@ public class AutoconfParser { private void validateMacroParameterCount(AutoconfMacroElement macro, Token token, int count) { if (macro.getParameterCount() < count) { - handleError(macro, token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooFew", + handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooFew", macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$ } else if (macro.getParameterCount() > count) { - handleError(macro, token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooMany", + handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooMany", macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$ } } @@ -911,7 +909,7 @@ public class AutoconfParser { Token token = tokenizer.readToken(); if (token.getType() == ITokenConstants.LPAREN) { - token = parseMacroArguments(macro, token); + token = parseMacroArguments(macro); setSourceEnd(macro, token); } else { tokenizer.unreadToken(token); @@ -940,7 +938,7 @@ public class AutoconfParser { * @param macro * @return final token (')') */ - protected Token parseMacroArguments(AutoconfMacroElement macro, Token lparen) { + protected Token parseMacroArguments(AutoconfMacroElement macro) { Token argStart = null; Token argEnd = null; Token token; @@ -1009,7 +1007,7 @@ public class AutoconfParser { } if (token.getType() != ITokenConstants.RPAREN) { - handleError(macro, token, AutoconfEditorMessages.getString(UNMATCHED_LEFT_PARENTHESIS)); + handleError(token, AutoconfEditorMessages.getString(UNMATCHED_LEFT_PARENTHESIS)); } // note: moved 15-char truncation to AutoconfLabelProvider @@ -1022,13 +1020,13 @@ public class AutoconfParser { - protected void handleError(AutoconfElement element, Token token, String message) { - handleMessage(element, token, message, IMarker.SEVERITY_ERROR); + protected void handleError(Token token, String message) { + handleMessage(token, message, IMarker.SEVERITY_ERROR); } - protected void handleWarning(AutoconfElement element, Token token, String message) { - handleMessage(element, token, message, IMarker.SEVERITY_WARNING); + protected void handleWarning(Token token, String message) { + handleMessage(token, message, IMarker.SEVERITY_WARNING); } - protected void handleMessage(AutoconfElement element, Token token, String message, int severity) { + protected void handleMessage(Token token, String message, int severity) { if (errorHandler != null) { int lineNumber = 0; int startColumn = 0; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ParseException.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ParseException.java index 5e0342c6799..3874ecedb29 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ParseException.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ParseException.java @@ -32,6 +32,7 @@ public class ParseException extends Exception { public void setLineNumber(int lineNumber) { this.lineNumber = lineNumber; } + @Override public String getMessage() { return message; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/Token.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/Token.java index a1fede4ded9..411f513cbe5 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/Token.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/Token.java @@ -50,6 +50,7 @@ public class Token implements ITokenConstants { this.length = length; } + @Override public String toString() { return text; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AbstractAutotoolsCPropertyTab.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AbstractAutotoolsCPropertyTab.java index 364ea5e67e3..f424f9b9f04 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AbstractAutotoolsCPropertyTab.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AbstractAutotoolsCPropertyTab.java @@ -15,6 +15,7 @@ import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab; public abstract class AbstractAutotoolsCPropertyTab extends AbstractCBuildPropertyTab { + @Override public boolean isIndexerAffected() { return false; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/Console.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/Console.java index da7401aed35..ec363d5004a 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/Console.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/Console.java @@ -34,6 +34,7 @@ public class Console implements IConsole { // } // + @Override public void start(IProject project ) { this.project = project; fConsoleManager.getConsole(project).start(project); @@ -43,14 +44,17 @@ public class Console implements IConsole { * @throws CoreException * @see org.eclipse.cdt.core.resources.IConsole#getOutputStream() */ + @Override public ConsoleOutputStream getOutputStream() throws CoreException { return fConsoleManager.getConsole(project).getOutputStream(); } + @Override public ConsoleOutputStream getInfoStream() throws CoreException { return fConsoleManager.getConsole(project).getInfoStream(); } + @Override public ConsoleOutputStream getErrorStream() throws CoreException { return fConsoleManager.getConsole(project).getErrorStream(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ErrorParserBlock.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ErrorParserBlock.java index cbd054b0cdb..1ecec7bbeb2 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ErrorParserBlock.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ErrorParserBlock.java @@ -34,11 +34,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock { fPrefs = preferences; } - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(Composite parent) { if (useBuildInfo == true && fBuildInfo == null) { @@ -51,11 +47,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock { super.createControl(parent); } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#getErrorParserIDs(org.eclipse.core.resources.IProject) - */ + @Override protected String[] getErrorParserIDs(IProject project) { if (getContainer().getProject() != null && fBuildInfo == null) { try { @@ -69,12 +61,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock { return new String[0]; } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#saveErrorParsers(org.eclipse.core.resources.IProject, - * java.lang.String[]) - */ + @Override public void saveErrorParsers(IProject project, String[] parserIDs) throws CoreException { if (getContainer().getProject() != null) { try { @@ -88,22 +75,19 @@ public class ErrorParserBlock extends AbstractErrorParserBlock { } - /* (non-Javadoc) - * @see org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock#saveErrorParsers(java.lang.String[]) - */ + @Override protected void saveErrorParsers(String[] parserIDs) throws CoreException { fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, MakeBuilder.BUILDER_ID, false); fBuildInfo.setErrorParsers(parserIDs); } - /* (non-Javadoc) - * @see org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock#getErrorParserIDs(boolean) - */ + @Override protected String[] getErrorParserIDs(boolean defaults) { fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, MakeBuilder.BUILDER_ID, defaults); return fBuildInfo.getErrorParsers(); } + @Override public void setContainer(ICOptionContainer container) { super.setContainer(container); if (getContainer().getProject() != null) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTML2TextReader.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTML2TextReader.java index b1a507309c9..3f889551957 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTML2TextReader.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTML2TextReader.java @@ -38,7 +38,7 @@ public class HTML2TextReader extends SubstitutionTextReader { static { - fgTags= new HashSet(); + fgTags= new HashSet<>(); fgTags.add("b"); //$NON-NLS-1$ fgTags.add("br"); //$NON-NLS-1$ fgTags.add("h5"); //$NON-NLS-1$ @@ -49,7 +49,7 @@ public class HTML2TextReader extends SubstitutionTextReader { fgTags.add("li"); //$NON-NLS-1$ fgTags.add("ul"); //$NON-NLS-1$ - fgEntityLookup= new HashMap(7); + fgEntityLookup= new HashMap<>(7); fgEntityLookup.put("lt", "<"); //$NON-NLS-1$ //$NON-NLS-2$ fgEntityLookup.put("gt", ">"); //$NON-NLS-1$ //$NON-NLS-2$ fgEntityLookup.put("nbsp", " "); //$NON-NLS-1$ //$NON-NLS-2$ @@ -75,6 +75,7 @@ public class HTML2TextReader extends SubstitutionTextReader { fTextPresentation= presentation; } + @Override public int read() throws IOException { int c= super.read(); if (c != -1) @@ -98,9 +99,7 @@ public class HTML2TextReader extends SubstitutionTextReader { } } - /** - * @see SubstitutionTextReader#computeSubstitution(char) - */ + @Override protected String computeSubstitution(int c) throws IOException { if (c == '<') return processHTMLTag(); @@ -230,7 +229,7 @@ public class HTML2TextReader extends SubstitutionTextReader { } catch (NumberFormatException e) { } } else { - String str= (String) fgEntityLookup.get(symbol); + String str= fgEntityLookup.get(symbol); if (str != null) { return str; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLTextPresenter.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLTextPresenter.java index 876e2c183fb..1080351ead9 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLTextPresenter.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLTextPresenter.java @@ -89,9 +89,7 @@ public class HTMLTextPresenter implements DefaultInformationControl.IInformation return (i == length ? line : line.substring(0, i)) + " "; //$NON-NLS-1$ } - /* - * @see IHoverInformationPresenter#updatePresentation(Display display, String, TextPresentation, int, int) - */ + @Override public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight) { if (hoverInfo == null) diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java index 2583f5f06ae..628e374eb78 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java @@ -124,6 +124,7 @@ public class ResourceLookup { */ public static void sortFilesByRelevance(IFile[] filesToSort, final IProject preferredProject) { Collections.sort(Arrays.asList(filesToSort), new Comparator() { + @Override public int compare(IFile f1, IFile f2) { int r1= FileRelevance.getRelevance(f1, preferredProject); int r2= FileRelevance.getRelevance(f2, preferredProject); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookupTree.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookupTree.java index 55e75c5df14..4150d123a93 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookupTree.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookupTree.java @@ -124,7 +124,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit public ResourceLookupTree() { fRootNode= new Node(null, CharArrayUtils.EMPTY, false, false) {}; - fFileExtensions= new HashMap(); + fFileExtensions= new HashMap<>(); fUnrefJob= new Job("Timer") { //$NON-NLS-1$ @Override protected IStatus run(IProgressMonitor monitor) { @@ -152,6 +152,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit /** * Handle resource change notifications. */ + @Override public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta= event.getDelta(); synchronized (fLock) { @@ -182,7 +183,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit /** * Handles resource change notifications by visiting the delta. */ - public boolean visit(IResourceDelta delta) throws CoreException { + @Override + public boolean visit(IResourceDelta delta) { assert Thread.holdsLock(fLock); final IResource res= delta.getResource(); @@ -274,7 +276,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit /** * Add a resource tree by using a resource proxy visitor. */ - public boolean visit(IResourceProxy proxy) throws CoreException { + @Override + public boolean visit(IResourceProxy proxy) { if (proxy.getType() == IResource.FILE) { if (fCurrentExtensions.isRelevant(proxy.getName())) { if (proxy.isLinked()) { @@ -300,7 +303,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit public void simulateNodeMapCollection() { synchronized (fLock) { fNodeMap= null; - fNodeMapRef= new SoftReference>(null); + fNodeMapRef= new SoftReference<>(null); } } @@ -317,8 +320,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit if (fNodeMap == null) { fFileExtensions.clear(); - fNodeMap= new HashMap(); - fNodeMapRef= new SoftReference>(fNodeMap); + fNodeMap= new HashMap<>(); + fNodeMapRef= new SoftReference<>(fNodeMap); } } fUnrefJob.cancel(); @@ -349,13 +352,13 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit private void initFileExtensions() { if (fDefaultExtensions == null) { - HashSet cdtContentTypes= new HashSet(); + HashSet cdtContentTypes= new HashSet<>(); String[] registeredContentTypes= CoreModel.getRegistedContentTypeIds(); cdtContentTypes.addAll(Arrays.asList(registeredContentTypes)); final IContentTypeManager ctm= Platform.getContentTypeManager(); final IContentType[] ctts= ctm.getAllContentTypes(); - Set result= new HashSet(); + Set result= new HashSet<>(); outer: for (IContentType ctt : ctts) { IContentType basedOn= ctt; while (basedOn != null) { @@ -368,7 +371,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit } fCDTProjectExtensions= new Extensions(result, true); - result= new HashSet(); + result= new HashSet<>(); for (IContentType ctt : ctts) { IContentType basedOn= ctt; while (basedOn != null) { @@ -700,7 +703,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit while(suffix.startsWith("../")) { //$NON-NLS-1$ suffix= suffix.substring(3); } - Set prjset= new HashSet(); + Set prjset= new HashSet<>(); for (IProject prj : projects) { prjset.add(prj.getName()); } @@ -829,7 +832,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit @SuppressWarnings("nls") public void dump() { - List lines= new ArrayList(); + List lines= new ArrayList<>(); synchronized (fLock) { for (Iterator iterator = fNodeMap.values().iterator(); iterator.hasNext();) { Node[] nodes= convert(iterator.next()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SingleCharReader.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SingleCharReader.java index b58f8288bab..4b2a94f22c9 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SingleCharReader.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SingleCharReader.java @@ -20,12 +20,14 @@ public abstract class SingleCharReader extends Reader { /** * @see Reader#read(char) */ + @Override public abstract int read() throws IOException; /** * @see Reader#read(char[],int,int) */ + @Override public int read(char cbuf[], int off, int len) throws IOException { int end= off + len; for (int i= off; i < end; i++) { @@ -44,7 +46,8 @@ public abstract class SingleCharReader extends Reader { /** * @see Reader#ready() */ - public boolean ready() throws IOException { + @Override + public boolean ready() throws IOException { return true; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SubstitutionTextReader.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SubstitutionTextReader.java index 797b903ce12..a49a9eff937 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SubstitutionTextReader.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SubstitutionTextReader.java @@ -88,9 +88,7 @@ public abstract class SubstitutionTextReader extends SingleCharReader { return ch; } - /** - * @see Reader#read() - */ + @Override public int read() throws IOException { int c; do { @@ -111,23 +109,17 @@ public abstract class SubstitutionTextReader extends SingleCharReader { return c; } - /** - * @see Reader#ready() - */ - public boolean ready() throws IOException { + @Override + public boolean ready() throws IOException { return fReader.ready(); } - /** - * @see Reader#close() - */ + @Override public void close() throws IOException { fReader.close(); } - /** - * @see Reader#reset() - */ + @Override public void reset() throws IOException { fReader.reset(); fWasWhiteSpace= true; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java index de7ceb1b3e5..bfb3d37df5e 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java @@ -17,7 +17,6 @@ import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.jface.viewers.ISelection; @@ -26,7 +25,7 @@ import org.eclipse.ui.handlers.HandlerUtil; public abstract class AbstractAutotoolsHandler extends AbstractHandler { - protected Object execute(ExecutionEvent event, InvokeAction a) throws ExecutionException { + protected Object execute(ExecutionEvent event, InvokeAction a) { ISelection k = HandlerUtil.getCurrentSelection(event); if (!k.isEmpty() && k instanceof IStructuredSelection) { Object obj = ((IStructuredSelection)k).getFirstElement(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractTargetAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractTargetAction.java index 5b7f53e132b..52fc842a997 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractTargetAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractTargetAction.java @@ -51,14 +51,17 @@ public abstract class AbstractTargetAction fContainer = container; } + @Override public void setActivePart(IAction action, IWorkbenchPart targetPart) { fPart = targetPart; } + @Override public void init(IWorkbenchWindow window) { fWindow = window; } + @Override public void selectionChanged(IAction action, ISelection selection) { boolean enabled = false; if (selection instanceof IStructuredSelection) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AclocalHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AclocalHandler.java index 9ef6e1140ef..d10880ba560 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AclocalHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AclocalHandler.java @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.autotools.ui.actions; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; /** * @author Jeff Johnston @@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException; */ public class AclocalHandler extends AbstractAutotoolsHandler { - public Object execute(ExecutionEvent event) throws ExecutionException { + @Override + public Object execute(ExecutionEvent event) { return execute(event, new InvokeAclocalAction()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoconfHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoconfHandler.java index 7ad41ebca2c..331161140f1 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoconfHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoconfHandler.java @@ -11,11 +11,11 @@ package org.eclipse.cdt.internal.autotools.ui.actions; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; public class AutoconfHandler extends AbstractAutotoolsHandler { - public Object execute(ExecutionEvent event) throws ExecutionException { + @Override + public Object execute(ExecutionEvent event) { return execute(event, new InvokeAutoconfAction()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoheaderHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoheaderHandler.java index e0f93c782b4..fe97a1cf1c5 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoheaderHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoheaderHandler.java @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.autotools.ui.actions; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; /** * @author Jeff Johnston @@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException; */ public class AutoheaderHandler extends AbstractAutotoolsHandler { - public Object execute(ExecutionEvent event) throws ExecutionException { + @Override + public Object execute(ExecutionEvent event) { return execute(event, new InvokeAutoheaderAction()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutomakeHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutomakeHandler.java index 24776f9b6c7..2676f554f1b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutomakeHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutomakeHandler.java @@ -11,11 +11,11 @@ package org.eclipse.cdt.internal.autotools.ui.actions; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; public class AutomakeHandler extends AbstractAutotoolsHandler { - public Object execute(ExecutionEvent event) throws ExecutionException { + @Override + public Object execute(ExecutionEvent event) { return execute(event, new InvokeAutomakeAction()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoreconfHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoreconfHandler.java index 867bef3071a..add8b89222d 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoreconfHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutoreconfHandler.java @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.autotools.ui.actions; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; /** * @author Jeff Johnston @@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException; */ public class AutoreconfHandler extends AbstractAutotoolsHandler { - public Object execute(ExecutionEvent event) throws ExecutionException { + @Override + public Object execute(ExecutionEvent event) { return execute(event, new InvokeAutoreconfAction()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAclocalAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAclocalAction.java index 24de790370f..41b05b11407 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAclocalAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAclocalAction.java @@ -24,6 +24,7 @@ public class InvokeAclocalAction extends InvokeAction { private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$ private static final String DEFAULT_COMMAND = "aclocal"; //$NON-NLS-1$ + @Override public void run(IAction action) { IContainer container = getSelectedContainer(); @@ -97,6 +98,7 @@ public class InvokeAclocalAction extends InvokeAction { } } + @Override public void dispose() { } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAction.java index af78197ff8c..b02b73811f8 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAction.java @@ -90,7 +90,7 @@ public abstract class InvokeAction extends AbstractTargetAction { protected String[] separateTargets(String rawArgList) { StringTokenizer st = new StringTokenizer(rawArgList, " "); //$NON-NLS-1$ - ArrayList targetList = new ArrayList(); + ArrayList targetList = new ArrayList<>(); while (st.hasMoreTokens()) { String currentWord = st.nextToken().trim(); @@ -136,7 +136,7 @@ public abstract class InvokeAction extends AbstractTargetAction { } protected String[] separateOptions(String rawArgList) { - ArrayList argList = new ArrayList(); + ArrayList argList = new ArrayList<>(); // May be multiple user-specified options in which case we // need to split them up into individual options rawArgList = rawArgList.trim(); @@ -162,7 +162,7 @@ public abstract class InvokeAction extends AbstractTargetAction { } protected String[] simpleParseOptions(String rawArgList) { - ArrayList argList = new ArrayList(); + ArrayList argList = new ArrayList<>(); int lastArgIndex = -1; int i = 0; while (i < rawArgList.length()) { @@ -208,7 +208,7 @@ public abstract class InvokeAction extends AbstractTargetAction { protected IPath getExecDir(IContainer container) { int type = container.getType(); IPath execDir = null; - if (type == IContainer.FILE) { + if (type == IResource.FILE) { execDir = container.getLocation().removeLastSegments(1); } else { execDir = container.getLocation(); @@ -219,7 +219,7 @@ public abstract class InvokeAction extends AbstractTargetAction { protected IPath getCWD(IContainer container) { int type = container.getType(); IPath cwd = null; - if (type == IContainer.FILE) { + if (type == IResource.FILE) { cwd = container.getFullPath().removeLastSegments(1); } else { cwd = container.getFullPath(); @@ -244,21 +244,18 @@ public abstract class InvokeAction extends AbstractTargetAction { } @Override - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - ByteArrayOutputStream stdout = new ByteArrayOutputStream(); - ByteArrayOutputStream stderr = new ByteArrayOutputStream(); + public void run(IProgressMonitor monitor) throws InvocationTargetException { + RemoteCommandLauncher cmdL = new RemoteCommandLauncher(); - outputs = null; + outputs = new HashMap<>(); // invoke command - try { - monitor.beginTask( - InvokeMessages.getFormattedString("InvokeAction.progress.message", // $NON-NLS-1$ - new String[]{command.toOSString()}), IProgressMonitor.UNKNOWN); + try (ByteArrayOutputStream stdout = new ByteArrayOutputStream(); + ByteArrayOutputStream stderr = new ByteArrayOutputStream()) { + monitor.beginTask(InvokeMessages.getFormattedString("InvokeAction.progress.message", // $NON-NLS-1$ + new String[] { command.toOSString() }), IProgressMonitor.UNKNOWN); monitor.worked(1); - Process process = cmdL.execute(command, argumentList, envList, - execDir, new NullProgressMonitor()); + Process process = cmdL.execute(command, argumentList, envList, execDir, new NullProgressMonitor()); if (cmdL.waitAndRead(stdout, stderr, new NullProgressMonitor()) == ICommandLauncher.OK) { try { @@ -274,24 +271,15 @@ public abstract class InvokeAction extends AbstractTargetAction { monitor.done(); return; } - } catch (CoreException e) { + + outputs.put("stdout", stdout.toString()); //$NON-NLS-1$ + outputs.put("stderr", stderr.toString()); //$NON-NLS-1$ + } catch (CoreException | IOException e) { monitor.done(); throw new InvocationTargetException(e); } - - outputs = new HashMap(); - - outputs.put("stdout", stdout.toString()); //$NON-NLS-1$ - outputs.put("stderr", stderr.toString()); //$NON-NLS-1$ - - try { - stdout.close(); - stderr.close(); - } catch (IOException e) { - // ignore - } } - + public HashMap getOutputs() { return outputs; } @@ -333,9 +321,6 @@ public abstract class InvokeAction extends AbstractTargetAction { final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot(); Job backgroundJob = new Job(actionName) { - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ @Override protected IStatus run(IProgressMonitor monitor) { try { @@ -371,7 +356,7 @@ public abstract class InvokeAction extends AbstractTargetAction { consoleOutStream.write(buf.toString().getBytes()); consoleOutStream.flush(); - ArrayList additionalEnvs = new ArrayList(); + ArrayList additionalEnvs = new ArrayList<>(); String strippedCommand = AutotoolsNewMakeGenerator.stripEnvVars(command, additionalEnvs); // Get a launcher for the config command RemoteCommandLauncher launcher = new RemoteCommandLauncher(); @@ -380,7 +365,7 @@ public abstract class InvokeAction extends AbstractTargetAction { IEnvironmentVariable variables[] = ManagedBuildManager .getEnvironmentVariableProvider().getVariables(cfg, true); String[] env = null; - ArrayList envList = new ArrayList(); + ArrayList envList = new ArrayList<>(); if (variables != null) { for (int i = 0; i < variables.length; i++) { envList.add(variables[i].getName() @@ -454,8 +439,7 @@ public abstract class InvokeAction extends AbstractTargetAction { } catch (CoreException e) { return e.getStatus(); } - IStatus returnStatus = Status.OK_STATUS; - return returnStatus; + return Status.OK_STATUS; } }; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoconfAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoconfAction.java index d679055eb78..5a6b692cf6b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoconfAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoconfAction.java @@ -27,6 +27,7 @@ import org.eclipse.jface.action.IAction; public class InvokeAutoconfAction extends InvokeAction { private final static String DEFAULT_COMMAND = "autoconf"; //$NON-NLS-1$ + @Override public void run(IAction action) { IContainer container = getSelectedContainer(); if (container == null) @@ -52,6 +53,7 @@ public class InvokeAutoconfAction extends InvokeAction { } + @Override public void dispose() { } } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoheaderAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoheaderAction.java index 21ef02258a9..7234aeef6e0 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoheaderAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoheaderAction.java @@ -25,6 +25,7 @@ public class InvokeAutoheaderAction extends InvokeAction { private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$ private static final String DEFAULT_COMMAND = "autoheader"; //$NON-NLS-1$ + @Override public void run(IAction action) { IContainer container = getSelectedContainer(); @@ -72,6 +73,7 @@ public class InvokeAutoheaderAction extends InvokeAction { } + @Override public void dispose() { } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutomakeAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutomakeAction.java index 5e643261aa6..e924fd9d856 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutomakeAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutomakeAction.java @@ -30,6 +30,7 @@ public class InvokeAutomakeAction extends InvokeAction { private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$ private static final String DEFAULT_COMMAND = "automake"; //$NON-NLS-1$ + @Override public void run(IAction action) { IContainer container = getSelectedContainer(); @@ -91,6 +92,7 @@ InvokeMessages } } + @Override public void dispose() { } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoreconfAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoreconfAction.java index 0d61a9c8a07..f9ceb354d5e 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoreconfAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAutoreconfAction.java @@ -25,6 +25,7 @@ public class InvokeAutoreconfAction extends InvokeAction { private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$ private static final String DEFAULT_COMMAND = "autoreconf"; //$NON-NLS-1$ + @Override public void run(IAction action) { IContainer container = getSelectedContainer(); @@ -71,6 +72,7 @@ public class InvokeAutoreconfAction extends InvokeAction { } } + @Override public void dispose() { } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeLibtoolizeAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeLibtoolizeAction.java index 6d6c6721624..03d729a31e9 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeLibtoolizeAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeLibtoolizeAction.java @@ -25,6 +25,7 @@ public class InvokeLibtoolizeAction extends InvokeAction { private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$ private static final String DEFAULT_COMMAND = "libtoolize"; //$NON-NLS-1$ + @Override public void run(IAction action) { IContainer container = getSelectedContainer(); @@ -71,6 +72,7 @@ public class InvokeLibtoolizeAction extends InvokeAction { } } + @Override public void dispose() { } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/LibtoolizeHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/LibtoolizeHandler.java index cb665f6c72b..20e800281fb 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/LibtoolizeHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/LibtoolizeHandler.java @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.autotools.ui.actions; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; /** * @author Jeff Johnston @@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException; */ public class LibtoolizeHandler extends AbstractAutotoolsHandler { - public Object execute(ExecutionEvent event) throws ExecutionException { + @Override + public Object execute(ExecutionEvent event) { return execute(event, new InvokeLibtoolizeAction()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/ReconfigureAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/ReconfigureAction.java index 4dbbf0d397f..e7f3f103b17 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/ReconfigureAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/ReconfigureAction.java @@ -30,6 +30,7 @@ import org.eclipse.jface.action.IAction; public class ReconfigureAction extends InvokeAction { + @Override public void run(IAction action) { IContainer container = getSelectedContainer(); if (container == null) @@ -40,14 +41,13 @@ public class ReconfigureAction extends InvokeAction { final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot(); Job backgroundJob = new Job("Reconfigure Action"){ //$NON-NLS-1$ - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ + @Override protected IStatus run(IProgressMonitor monitor) { try { ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { + @Override + public void run(IProgressMonitor monitor) { IProject project = getSelectedContainer().getProject(); AutotoolsNewMakeGenerator m = new AutotoolsNewMakeGenerator(); IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); @@ -72,6 +72,7 @@ public class ReconfigureAction extends InvokeAction { backgroundJob.schedule(); } + @Override public void dispose() { } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/ReconfigureHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/ReconfigureHandler.java index d83d02be425..d452352dd13 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/ReconfigureHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/ReconfigureHandler.java @@ -11,7 +11,6 @@ package org.eclipse.cdt.internal.autotools.ui.actions; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; /** * @author Jeff Johnston @@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException; */ public class ReconfigureHandler extends AbstractAutotoolsHandler { - public Object execute(ExecutionEvent event) throws ExecutionException { + @Override + public Object execute(ExecutionEvent event) { return execute(event, new ReconfigureAction()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/SingleInputDialog.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/SingleInputDialog.java index 6161630f142..e5ae481e127 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/SingleInputDialog.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/SingleInputDialog.java @@ -32,13 +32,12 @@ public class SingleInputDialog extends InputDialog { this.firstMessage = firstMessage; } - /* - * (non-Javadoc) Method declared on Dialog. - */ + @Override protected void buttonPressed(int buttonId) { super.buttonPressed(buttonId); } + @Override protected Control createDialogArea(Composite parent) { // create composite diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/TwoInputDialog.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/TwoInputDialog.java index 82610b84258..d6b2ee52a3b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/TwoInputDialog.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/TwoInputDialog.java @@ -43,9 +43,7 @@ public class TwoInputDialog extends InputDialog { this.secondMessage = secondMessage; } - /* - * (non-Javadoc) Method declared on Dialog. - */ + @Override protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { secondValue = secondText.getText(); @@ -55,6 +53,7 @@ public class TwoInputDialog extends InputDialog { super.buttonPressed(buttonId); } + @Override protected Control createDialogArea(Composite parent) { // create composite @@ -78,6 +77,7 @@ public class TwoInputDialog extends InputDialog { secondText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); secondText.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { validateInput(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/autoconf/ProjectionFileUpdater.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/autoconf/ProjectionFileUpdater.java index 6ccb0259c78..b04aabb6664 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/autoconf/ProjectionFileUpdater.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/autoconf/ProjectionFileUpdater.java @@ -100,9 +100,7 @@ public class ProjectionFileUpdater implements IProjectionListener { private class ReconcilerParticipant implements IReconcilingParticipant { - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IReconcilingParticipant#reconciled() - */ + @Override public void reconciled() { processReconcile(); } @@ -119,9 +117,7 @@ public class ProjectionFileUpdater implements IProjectionListener { private boolean fCollapseConditional = false; private boolean fCollapseLoop = false; - /* - * @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionEnabled() - */ + @Override public void projectionEnabled() { // http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html // projectionEnabled messages are not always paired with projectionDisabled @@ -135,9 +131,7 @@ public class ProjectionFileUpdater implements IProjectionListener { fEditor.addReconcilingParticipant(fParticipant); } - /* - * @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionDisabled() - */ + @Override public void projectionDisabled() { fCachedDocument= null; if (fParticipant != null) { @@ -187,7 +181,7 @@ public class ProjectionFileUpdater implements IProjectionListener { } private Map computeAdditions(AutoconfElement root) { - Map map= new HashMap(); + Map map= new HashMap<>(); if (root instanceof AutoconfRootElement) computeAdditions(root.getChildren(), map); return map; @@ -277,9 +271,9 @@ public class ProjectionFileUpdater implements IProjectionListener { fCachedDocument= provider.getDocument(fEditor.getEditorInput()); fAllowCollapsing= false; - Map additions= new HashMap(); - List deletions= new ArrayList(); - List updates = new ArrayList(); + Map additions= new HashMap<>(); + List deletions= new ArrayList<>(); + List updates = new ArrayList<>(); Map updated= computeAdditions(fEditor.getRootElement()); @@ -288,9 +282,9 @@ public class ProjectionFileUpdater implements IProjectionListener { Iterator e= updated.keySet().iterator(); while (e.hasNext()) { - AutoconfProjectionAnnotation annotation= (AutoconfProjectionAnnotation) e.next(); + AutoconfProjectionAnnotation annotation= e.next(); AutoconfElement element= annotation.getElement(); - Position position= (Position) updated.get(annotation); + Position position= updated.get(annotation); List annotations= previous.get(element); if (annotations == null) { @@ -298,7 +292,7 @@ public class ProjectionFileUpdater implements IProjectionListener { } else { Iterator x= annotations.iterator(); while (x.hasNext()) { - AutoconfProjectionAnnotation a= (AutoconfProjectionAnnotation) x.next(); + AutoconfProjectionAnnotation a= x.next(); if (annotation.isComment() == a.isComment()) { Position p= model.getPosition(a); if (p != null && !position.equals(p)) { @@ -342,19 +336,19 @@ public class ProjectionFileUpdater implements IProjectionListener { if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty())) return; - List newDeletions= new ArrayList(); - List newChanges= new ArrayList(); + List newDeletions= new ArrayList<>(); + List newChanges= new ArrayList<>(); Iterator deletionIterator= deletions.iterator(); outer: while (deletionIterator.hasNext()) { - AutoconfProjectionAnnotation deleted= (AutoconfProjectionAnnotation) deletionIterator.next(); + AutoconfProjectionAnnotation deleted= deletionIterator.next(); Position deletedPosition= model.getPosition(deleted); if (deletedPosition == null) continue; Iterator changesIterator= changes.iterator(); while (changesIterator.hasNext()) { - AutoconfProjectionAnnotation changed= (AutoconfProjectionAnnotation) changesIterator.next(); + AutoconfProjectionAnnotation changed= changesIterator.next(); if (deleted.isComment() == changed.isComment()) { Position changedPosition= model.getPosition(changed); if (changedPosition == null) @@ -378,9 +372,9 @@ public class ProjectionFileUpdater implements IProjectionListener { Iterator additionsIterator= additions.keySet().iterator(); while (additionsIterator.hasNext()) { - AutoconfProjectionAnnotation added= (AutoconfProjectionAnnotation) additionsIterator.next(); + AutoconfProjectionAnnotation added= additionsIterator.next(); if (deleted.isComment() == added.isComment()) { - Position addedPosition= (Position) additions.get(added); + Position addedPosition= additions.get(added); if (deletedPosition.getOffset() == addedPosition.getOffset()) { @@ -403,7 +397,7 @@ public class ProjectionFileUpdater implements IProjectionListener { } private Map> createAnnotationMap(IAnnotationModel model) { - Map> map= new HashMap>(); + Map> map= new HashMap<>(); @SuppressWarnings("rawtypes") Iterator e= model.getAnnotationIterator(); while (e.hasNext()) { @@ -412,7 +406,7 @@ public class ProjectionFileUpdater implements IProjectionListener { AutoconfProjectionAnnotation directive= (AutoconfProjectionAnnotation) annotation; List list= map.get(directive.getElement()); if (list == null) { - list= new ArrayList(2); + list= new ArrayList<>(2); map.put(directive.getElement(), list); } list.add(directive); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractElementListSelectionDialog.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractElementListSelectionDialog.java index b557d224946..1b3b1f65d62 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractElementListSelectionDialog.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractElementListSelectionDialog.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; import java.util.ArrayList; import java.util.List; +import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.events.SelectionEvent; @@ -26,8 +27,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; -import org.eclipse.jface.viewers.ILabelProvider; - /** * A class to select one or more elements out of an indexed property */ @@ -53,10 +52,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus protected void access$superOpen() { super.open(); } - /* - * @private - * @see Dialog#cancelPressed - */ + @Override protected void cancelPressed() { setResult(null); super.cancelPressed(); @@ -64,10 +60,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus protected Point computeInitialSize() { return new Point(convertWidthInCharsToPixels(60), convertHeightInCharsToPixels(18)); } - /* - * @private - * @see Window#createDialogArea(Composite) - */ + @Override protected Control createDialogArea(Composite parent) { Composite contents= (Composite)super.createDialogArea(parent); @@ -78,9 +71,11 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus fRenderer, fIgnoreCase); fSelectionList.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(SelectionEvent e) { handleDoubleClick(); } + @Override public void widgetSelected(SelectionEvent e) { verifyCurrentSelection(); } @@ -116,6 +111,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus * @private * @see Window#create(Shell) */ + @Override public void create() { super.create(); if (isEmptyList()) { @@ -145,7 +141,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus */ protected List getWidgetSelection() { if (fSelectionList == null || fSelectionList.isDisposed()) - return new ArrayList(0); + return new ArrayList<>(0); return fSelectionList.getSelection(); } /** @@ -195,8 +191,10 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus /* * @private */ + @Override public int open() { BusyIndicator.showWhile(null, new Runnable() { + @Override public void run() { access$superOpen(); } @@ -227,6 +225,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus * Sets the message to be shown above the match text field. * Must be set before widget creation */ + @Override public void setMessage(String message) { fMessageText= message; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefile.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefile.java index 6affd8923bc..f0703b3ca91 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefile.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefile.java @@ -39,144 +39,157 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { super(parent); } + @Override public abstract IDirective[] getBuiltins(); + @Override public IRule[] getRules() { IDirective[] stmts = getDirectives(true); - List array = new ArrayList(stmts.length); + List array = new ArrayList<>(stmts.length); for (int i = 0; i < stmts.length; i++) { if (stmts[i] instanceof IRule) { array.add((IRule)stmts[i]); } } - return (IRule[]) array.toArray(new IRule[0]); + return array.toArray(new IRule[0]); } + @Override public IRule[] getRules(String target) { IRule[] rules = getRules(); - List array = new ArrayList(rules.length); + List array = new ArrayList<>(rules.length); for (int i = 0; i < rules.length; i++) { if (rules[i].getTarget().toString().equals(target)) { array.add(rules[i]); } } - return (IRule[]) array.toArray(new IRule[0]); + return array.toArray(new IRule[0]); } + @Override public IInferenceRule[] getInferenceRules() { IRule[] rules = getRules(); - List array = new ArrayList(rules.length); + List array = new ArrayList<>(rules.length); for (int i = 0; i < rules.length; i++) { if (rules[i] instanceof IInferenceRule) { array.add((IInferenceRule)rules[i]); } } - return (IInferenceRule[]) array.toArray(new IInferenceRule[0]); + return array.toArray(new IInferenceRule[0]); } + @Override public IInferenceRule[] getInferenceRules(String target) { IInferenceRule[] irules = getInferenceRules(); - List array = new ArrayList(irules.length); + List array = new ArrayList<>(irules.length); for (int i = 0; i < irules.length; i++) { if (irules[i].getTarget().toString().equals(target)) { array.add(irules[i]); } } - return (IInferenceRule[]) array.toArray(new IInferenceRule[0]); + return array.toArray(new IInferenceRule[0]); } + @Override public ITargetRule[] getTargetRules() { IRule[] trules = getRules(); - List array = new ArrayList(trules.length); + List array = new ArrayList<>(trules.length); for (int i = 0; i < trules.length; i++) { if (trules[i] instanceof ITargetRule) { array.add((ITargetRule)trules[i]); } } - return (ITargetRule[]) array.toArray(new ITargetRule[0]); + return array.toArray(new ITargetRule[0]); } + @Override public ITargetRule[] getTargetRules(String target) { ITargetRule[] trules = getTargetRules(); - List array = new ArrayList(trules.length); + List array = new ArrayList<>(trules.length); for (int i = 0; i < trules.length; i++) { if (trules[i].getTarget().toString().equals(target)) { array.add(trules[i]); } } - return (ITargetRule[]) array.toArray(new ITargetRule[0]); + return array.toArray(new ITargetRule[0]); } + @Override public IMacroDefinition[] getMacroDefinitions() { IDirective[] stmts = getDirectives(true); - List array = new ArrayList(stmts.length); + List array = new ArrayList<>(stmts.length); for (int i = 0; i < stmts.length; i++) { if (stmts[i] instanceof IMacroDefinition) { array.add((IMacroDefinition)stmts[i]); } } - return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]); + return array.toArray(new IMacroDefinition[0]); } + @Override public IMacroDefinition[] getMacroDefinitions(String name) { IMacroDefinition[] variables = getMacroDefinitions(); - List array = new ArrayList(variables.length); + List array = new ArrayList<>(variables.length); for (int i = 0; i < variables.length; i++) { if (variables[i].getName().equals(name)) { array.add(variables[i]); } } - return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]); + return array.toArray(new IMacroDefinition[0]); } + @Override public IMacroDefinition[] getBuiltinMacroDefinitions() { IDirective[] stmts = getBuiltins(); - List array = new ArrayList(stmts.length); + List array = new ArrayList<>(stmts.length); for (int i = 0; i < stmts.length; i++) { if (stmts[i] instanceof IMacroDefinition) { array.add((IMacroDefinition)stmts[i]); } } - return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]); + return array.toArray(new IMacroDefinition[0]); } + @Override public IMacroDefinition[] getBuiltinMacroDefinitions(String name) { IMacroDefinition[] variables = getBuiltinMacroDefinitions(); - List array = new ArrayList(variables.length); + List array = new ArrayList<>(variables.length); for (int i = 0; i < variables.length; i++) { if (variables[i].getName().equals(name)) { array.add(variables[i]); } } - return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]); + return array.toArray(new IMacroDefinition[0]); } public IInferenceRule[] getBuiltinInferenceRules() { IDirective[] stmts = getBuiltins(); - List array = new ArrayList(stmts.length); + List array = new ArrayList<>(stmts.length); for (int i = 0; i < stmts.length; i++) { if (stmts[i] instanceof IInferenceRule) { array.add((IInferenceRule)stmts[i]); } } - return (IInferenceRule[]) array.toArray(new IInferenceRule[0]); + return array.toArray(new IInferenceRule[0]); } public IInferenceRule[] getBuiltinInferenceRules(String target) { IInferenceRule[] irules = getBuiltinInferenceRules(); - List array = new ArrayList(irules.length); + List array = new ArrayList<>(irules.length); for (int i = 0; i < irules.length; i++) { if (irules[i].getTarget().toString().equals(target)) { array.add(irules[i]); } } - return (IInferenceRule[]) array.toArray(new IInferenceRule[0]); + return array.toArray(new IInferenceRule[0]); } + @Override public String expandString(String line) { return expandString(line, false); } + @Override public String expandString(String line, boolean recursive) { int len = line.length(); boolean foundDollar = false; @@ -258,6 +271,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return buffer.toString(); } + @Override public URI getFileURI() { return filename; } @@ -267,17 +281,17 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { } + @Override public IMakefile getMakefile() { return this; } + @Override public IMakefileReaderProvider getMakefileReaderProvider() { return null; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.net.URI, org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider) - */ + @Override public void parse(URI fileURI, IMakefileReaderProvider makefileReaderProvider) throws IOException { // not used diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefileCodeScanner.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefileCodeScanner.java index 7066798f204..1bf5410cd12 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefileCodeScanner.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefileCodeScanner.java @@ -35,7 +35,7 @@ import org.eclipse.swt.graphics.RGB; */ public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner { - private Map fTokenMap= new HashMap(); + private Map fTokenMap= new HashMap<>(); private String[] fPropertyNamesColor; /** * Preference keys for boolean preferences which are true, @@ -89,7 +89,7 @@ public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner { } protected Token getToken(String key) { - return (Token) fTokenMap.get(key); + return fTokenMap.get(key); } private void addToken(String colorKey, String boldKey, String italicKey) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutoconfSubstRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutoconfSubstRule.java index 9af2123a547..d91401ad285 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutoconfSubstRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutoconfSubstRule.java @@ -15,6 +15,7 @@ public class AutoconfSubstRule implements IPredicateRule { private char[][] fSortedLineDelimiters; private static class DecreasingCharArrayLengthComparator implements Comparator { + @Override public int compare(Object o1, Object o2) { return ((char[]) o2).length - ((char[]) o1).length; } @@ -26,6 +27,7 @@ public class AutoconfSubstRule implements IPredicateRule { this.token = token; } + @Override public IToken evaluate(ICharacterScanner scanner, boolean resume) { char[][] originalDelimiters= scanner.getLegalLineDelimiters(); int count= originalDelimiters.length; @@ -81,10 +83,12 @@ public class AutoconfSubstRule implements IPredicateRule { return Token.UNDEFINED; } + @Override public IToken getSuccessToken() { return token; } + @Override public IToken evaluate(ICharacterScanner scanner) { return evaluate(scanner, false); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeCompletionProcessor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeCompletionProcessor.java index cba9d060d11..7745fb3819b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeCompletionProcessor.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeCompletionProcessor.java @@ -41,23 +41,17 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor { protected int fInstallOffset; - /* - * @see IContextInformationValidator#isContextInformationValid(int) - */ + @Override public boolean isContextInformationValid(int offset) { return Math.abs(fInstallOffset - offset) < 5; } - /* - * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int) - */ + @Override public void install(IContextInformation info, ITextViewer viewer, int offset) { fInstallOffset = offset; } - /* - * @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation) - */ + @Override public boolean updatePresentation(int documentPosition, TextPresentation presentation) { return false; } @@ -65,9 +59,7 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor { public static class DirectiveComparator implements Comparator { - /* (non-Javadoc) - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ + @Override public int compare(Object o1, Object o2) { String name1; String name2; @@ -106,9 +98,7 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor { fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager(); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int) - */ + @Override public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) { WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset); boolean macro = WordPartDetector.inMacro(viewer, documentOffset); @@ -124,7 +114,7 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor { statements = makefile.getTargetRules(); } - ArrayList proposalList = new ArrayList(statements.length); + ArrayList proposalList = new ArrayList<>(statements.length); // iterate over all the different categories for (int i = 0; i < statements.length; i++) { @@ -156,19 +146,17 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor { proposalList.add(result); } } - ICompletionProposal[] proposals = (ICompletionProposal[]) proposalList.toArray(new ICompletionProposal[0]); + ICompletionProposal[] proposals = proposalList.toArray(new ICompletionProposal[0]); Arrays.sort(proposals, comparator); return proposals; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int) - */ + @Override public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) { WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset); boolean macro = WordPartDetector.inMacro(viewer, documentOffset); IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput()); - ArrayList contextList = new ArrayList(); + ArrayList contextList = new ArrayList<>(); if (macro) { IDirective[] statements = makefile.getMacroDefinitions(); for (int i = 0; i < statements.length; i++) { @@ -198,37 +186,29 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor { IContextInformation[] result = new IContextInformation[contextList.size()]; for (int i = 0; i < result.length; i++) { - String context = (String)contextList.get(i); + String context = contextList.get(i); result[i] = new ContextInformation(imageMacro, wordPart.toString(), context); } return result; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() - */ + @Override public char[] getCompletionProposalAutoActivationCharacters() { return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters() - */ + @Override public char[] getContextInformationAutoActivationCharacters() { return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage() - */ + @Override public String getErrorMessage() { return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator() - */ + @Override public IContextInformationValidator getContextInformationValidator() { return fValidator; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeConfigMacro.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeConfigMacro.java index bfaf671c9de..18e686676ab 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeConfigMacro.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeConfigMacro.java @@ -25,6 +25,7 @@ public class AutomakeConfigMacro extends Directive { return name; } + @Override public String toString() { return name + "\n"; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeDocumentProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeDocumentProvider.java index d09a123a27e..2e8c6455d69 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeDocumentProvider.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeDocumentProvider.java @@ -32,16 +32,12 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement public IMakefile fCopy; } - /* - * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createEmptyFileInfo() - */ + @Override protected FileInfo createEmptyFileInfo() { return new AutomakefileFileInfo(); } - /* - * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createFileInfo(java.lang.Object) - */ + @Override protected FileInfo createFileInfo(Object element) throws CoreException { IMakefile original = null; if (element instanceof IFileEditorInput) { @@ -81,9 +77,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement return makefile; } - /* - * @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IMakefileDocumentProvider#getWorkingCopy(java.lang.Object) - */ + @Override public IMakefile getWorkingCopy(Object element) { FileInfo fileInfo= getFileInfo(element); if (fileInfo instanceof AutomakefileFileInfo) { @@ -93,9 +87,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement return null; } - /* - * @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IMakefileDocumentProvider#shutdown() - */ + @Override public void shutdown() { @SuppressWarnings("rawtypes") Iterator e= getConnectedElementsIterator(); @@ -103,6 +95,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement disconnect(e.next()); } + @Override public void connect(Object element) throws CoreException { super.connect(element); IMakefile makefile = getWorkingCopy(element); @@ -110,8 +103,9 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement errorHandler.update(makefile); } + @Override public IDocument getDocument(Object element) { - FileInfo info= (FileInfo) getFileInfo(element); + FileInfo info= getFileInfo(element); if (info != null) return info.fTextFileBuffer.getDocument(); return getParentProvider().getDocument(element); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java index 2a88f0678b5..107025392aa 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java @@ -51,7 +51,8 @@ public class AutomakeEditor extends MakefileEditor { return fgInstance; } - protected void doSetInput(IEditorInput newInput) throws CoreException + @Override + protected void doSetInput(IEditorInput newInput) throws CoreException { super.doSetInput(newInput); this.input = newInput; @@ -59,9 +60,7 @@ public class AutomakeEditor extends MakefileEditor { getOutlinePage().setInput(input); } - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor() - */ + @Override protected void initializeEditor() { setRangeIndicator(new DefaultRangeIndicator()); setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$ @@ -93,16 +92,12 @@ public class AutomakeEditor extends MakefileEditor { return ampage; } - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createPartControl(Composite parent) { super.createPartControl(parent); } - /* (non-Javadoc) - * Method declared on IAdaptable - */ + @Override public Object getAdapter(@SuppressWarnings("rawtypes") Class key) { if (key.equals(IContentOutlinePage.class)) { return getAutomakeOutlinePage(); @@ -114,6 +109,7 @@ public class AutomakeEditor extends MakefileEditor { return sourceViewerConfiguration; } + @Override protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { super.handlePreferenceStoreChanged(event); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeErrorHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeErrorHandler.java index e602a957190..97d5f38c43d 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeErrorHandler.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeErrorHandler.java @@ -38,14 +38,17 @@ public class AutomakeErrorHandler { super(annotationType, persist, message); } + @Override public void setQuickFixable(boolean state) { // do nothing } + @Override public boolean isQuickFixableStateSet() { return true; } + @Override public boolean isQuickFixable() throws AssertionFailedException { return false; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeIfElse.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeIfElse.java index 0a2f44dd4d2..61c9552e434 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeIfElse.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeIfElse.java @@ -11,8 +11,6 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; - - public class AutomakeIfElse extends Parent { String condition; String type; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroDefinitionRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroDefinitionRule.java index 61206404b46..6c009bde95e 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroDefinitionRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroDefinitionRule.java @@ -34,10 +34,12 @@ class AutomakeMacroDefinitionRule implements IPredicateRule { this.defaultToken = defaultToken; } + @Override public IToken getSuccessToken() { return token; } + @Override public IToken evaluate(ICharacterScanner scanner, boolean resume) { buffer.setLength(0); int c; @@ -148,6 +150,7 @@ class AutomakeMacroDefinitionRule implements IPredicateRule { return c; } + @Override public IToken evaluate(ICharacterScanner scanner) { return evaluate(scanner, false); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroReferenceRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroReferenceRule.java index 785ffaa64c5..143d4ed7289 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroReferenceRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroReferenceRule.java @@ -35,11 +35,13 @@ public class AutomakeMacroReferenceRule extends PatternRule { } } + @Override protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) { nOfBrackets = 1; return super.doEvaluate(scanner, resume); } + @Override protected boolean endSequenceDetected(ICharacterScanner scanner) { int c; char[][] delimiters = scanner.getLegalLineDelimiters(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeTextHover.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeTextHover.java index 4a8a9ad5265..978b827a093 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeTextHover.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeTextHover.java @@ -29,6 +29,7 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension { this.editor = editor; } + @Override public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { TargetRule target = null; String[] preReqs = null; @@ -98,20 +99,10 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension { } } -// IRule[] rules = makefile.getRules(); -// for (int i = 0; i < rules.length; i++) { -// rule = rules[i]; -// System.out.println("rule: " + rule); -// System.out.println("target: " + rule.getTarget()); -// ICommand[] commands = rule.getCommands(); -// for (int j = 0; j < commands.length; j++) { -// ICommand command = commands[j]; -// System.out.println("command: " + command); -// } -// } return ""; } + @Override public IRegion getHoverRegion(ITextViewer textViewer, int offset) { if (textViewer != null) { @@ -177,6 +168,7 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension { return null; } + @Override public IInformationControlCreator getHoverControlCreator() { // TODO Auto-generated method stub return null; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeWordDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeWordDetector.java index 7836e48621c..1b117b77c80 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeWordDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeWordDetector.java @@ -17,10 +17,12 @@ public class AutomakeWordDetector implements IWordDetector { private static final String correctStartSpecChars = "$%*().><"; //$NON-NLS-1$ private static final String correctSpecChars = "?@$/\\<*%"; //$NON-NLS-1$ + @Override public boolean isWordStart(char character) { return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0); } + @Override public boolean isWordPart(char character) { return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileCodeScanner.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileCodeScanner.java index 7bd06f99170..d22d522c17e 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileCodeScanner.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileCodeScanner.java @@ -67,6 +67,7 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner { initialize(); } + @Override protected List createRules() { IToken keyword = getToken(ColorManager.MAKE_KEYWORD_COLOR); IToken function = getToken(ColorManager.MAKE_FUNCTION_COLOR); @@ -75,13 +76,14 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner { IToken macroDef = getToken(ColorManager.MAKE_MACRO_DEF_COLOR); IToken other = getToken(ColorManager.MAKE_DEFAULT_COLOR); - List rules = new ArrayList(); + List rules = new ArrayList<>(); // Add rule for single line comments. rules.add(new EndOfLineRule("#", comment, '\\', true)); //$NON-NLS-1$ // Add generic whitespace rule. rules.add(new WhitespaceRule(new IWhitespaceDetector() { + @Override public boolean isWhitespace(char character) { return Character.isWhitespace(character); } @@ -136,13 +138,7 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner { return rules; } - public IToken nextToken() { - return super.nextToken(); - } - - /* - * @see AbstractMakefileCodeScanner#getTokenProperties() - */ + @Override protected String[] getTokenProperties() { return fTokenProperties; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileContentOutlinePage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileContentOutlinePage.java index ab39af95b27..4e3887bcd65 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileContentOutlinePage.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileContentOutlinePage.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.cdt.internal.autotools.ui.MakeUIImages; -import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TreeViewer; @@ -43,9 +42,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { protected IMakefile makefile; protected IMakefile nullMakefile = new NullMakefile(); - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) - */ + @Override public Object[] getChildren(Object element) { if (element == fInput) { return getElements(makefile); @@ -55,9 +52,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { return new Object[0]; } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) - */ + @Override public Object getParent(Object element) { if (element instanceof IMakefile) { return fInput; @@ -67,9 +62,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { return fInput; } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) - */ + @Override public boolean hasChildren(Object element) { if (element == fInput) { return true; @@ -83,9 +76,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { return false; } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ + @Override public Object[] getElements(Object inputElement) { IDirective[] directives; if (inputElement == fInput) { @@ -101,7 +92,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { } else { directives = new IDirective[0]; } - List list = new ArrayList(directives.length); + List list = new ArrayList<>(directives.length); for (int i = 0; i < directives.length; i++) { if (showMacroDefinition && directives[i] instanceof IMacroDefinition) { list.add(directives[i]); @@ -123,15 +114,11 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { return list.toArray(); } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ + @Override public void dispose() { } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (oldInput != null) { makefile = nullMakefile; @@ -147,11 +134,9 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { } } - private class AutomakefileLabelProvider extends LabelProvider implements ILabelProvider { + private class AutomakefileLabelProvider extends LabelProvider { - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) - */ + @Override public Image getImage(Object element) { if (element instanceof ITargetRule) { return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE); @@ -175,9 +160,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { return super.getImage(element); } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ + @Override public String getText(Object element) { String name; if (element instanceof IRule) { @@ -234,6 +217,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { final Control control = viewer.getControl(); if (control != null && !control.isDisposed()) { control.getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (!control.isDisposed()) { control.setRedraw(false); @@ -247,9 +231,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { } } - /* (non-Javadoc) - * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(Composite parent) { super.createControl(parent); TreeViewer viewer = getTreeViewer(); @@ -258,39 +240,9 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage { if (fInput != null) { viewer.setInput(fInput); } - -// MenuManager manager= new MenuManager("#MakefileOutlinerContext"); //$NON-NLS-1$ -// manager.setRemoveAllWhenShown(true); -// manager.addMenuListener(new IMenuListener() { -// public void menuAboutToShow(IMenuManager m) { -// contextMenuAboutToShow(m); -// } -// }); -// Control tree = viewer.getControl(); -// Menu menu = manager.createContextMenu(tree); -// tree.setMenu(menu); -// -// viewer.addDoubleClickListener(new IDoubleClickListener() { -// /* (non-Javadoc) -// * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -// */ -// public void doubleClick(DoubleClickEvent event) { -// if (fOpenIncludeAction != null) { -// fOpenIncludeAction.run(); -// } -// } -// }); -// -// IPageSite site= getSite(); -// site.registerContextMenu(MakeUIPlugin.getPluginId() + ".outline", manager, viewer); //$NON-NLS-1$ -// site.setSelectionProvider(viewer); - } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + public void inputChanged(Object oldInput, Object newInput) { if (oldInput != null) { makefile = nullMakefile; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileReconcilingStrategy.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileReconcilingStrategy.java index 58e9a657d18..d01c5692001 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileReconcilingStrategy.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileReconcilingStrategy.java @@ -39,23 +39,19 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy { fOutliner= editor.getAutomakeOutlinePage(); fLastRegionOffset = Integer.MAX_VALUE; fEditor= editor; - input = (IEditorInput) fEditor.getEditorInput(); + input = fEditor.getEditorInput(); fManager= AutomakeEditorFactory.getDefault().getWorkingCopyManager(); fDocumentProvider= AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider(); fErrorHandler= new AutomakeErrorHandler(input); fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor; } - /** - * @see IReconcilingStrategy#reconcile(document) - */ + @Override public void setDocument(IDocument document) { } - /** - * @see IReconcilingStrategy#reconcile(region) - */ + @Override public void reconcile(IRegion region) { // We use a trick to avoid running the reconciler multiple times // on a file when it gets changed. This is because this gets called @@ -67,9 +63,7 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy { fLastRegionOffset = region.getOffset(); } - /** - * @see IReconcilingStrategy#reconcile(dirtyRegion, region) - */ + @Override public void reconcile(DirtyRegion dirtyRegion, IRegion region) { // FIXME: This seems to generate too much flashing in // the contentoutline viewer. diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileSourceConfiguration.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileSourceConfiguration.java index bef5111da0f..520fb1b2e07 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileSourceConfiguration.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileSourceConfiguration.java @@ -24,7 +24,6 @@ import org.eclipse.jface.text.reconciler.IReconciler; import org.eclipse.jface.text.reconciler.MonoReconciler; import org.eclipse.jface.text.rules.DefaultDamagerRepairer; import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jface.util.PropertyChangeEvent; @@ -54,6 +53,7 @@ public class AutomakefileSourceConfiguration extends } + @Override public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { if (amHover == null) amHover = new AutomakeTextHover(editor); @@ -63,6 +63,7 @@ public class AutomakefileSourceConfiguration extends /** * @param event */ + @Override public void adaptToPreferenceChange(PropertyChangeEvent event) { AutomakefileCodeScanner scanner = getAutomakeCodeScanner(); scanner.adaptToPreferenceChange(event); @@ -72,11 +73,13 @@ public class AutomakefileSourceConfiguration extends * @param event * @return */ + @Override public boolean affectsBehavior(PropertyChangeEvent event) { AutomakefileCodeScanner scanner = getAutomakeCodeScanner(); return scanner.affectsBehavior(event); } + @Override public IPresentationReconciler getPresentationReconciler(ISourceViewer v) { PresentationReconciler reconciler = new PresentationReconciler(); @@ -111,10 +114,7 @@ public class AutomakefileSourceConfiguration extends return reconciler; } - - /** - * @see SourceViewerConfiguration#getReconciler(ISourceViewer) - */ + @Override public IReconciler getReconciler(ISourceViewer sourceViewer) { if (editor != null && editor.isEditable()) { MonoReconciler reconciler= new MonoReconciler(new AutomakefileReconcilingStrategy(editor), false); @@ -125,9 +125,7 @@ public class AutomakefileSourceConfiguration extends return null; } - /** - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer) - */ + @Override public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ContentAssistant assistant = new ContentAssistant(); assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), IDocument.DEFAULT_CONTENT_TYPE); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/BadDirective.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/BadDirective.java index 8bae9e0102f..f9d46c96cff 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/BadDirective.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/BadDirective.java @@ -19,6 +19,7 @@ public class BadDirective extends Directive implements IBadDirective { line = s; } + @Override public String toString() { return line; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Command.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Command.java index 2436d19a587..b975590395c 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Command.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Command.java @@ -37,6 +37,7 @@ public class Command extends Directive implements ICommand { * target as a prerequisite or has no prerequisites, any error * found while executing the command will be ignored. */ + @Override public boolean shouldIgnoreError() { // Check for the prefix hyphen in the command. if (getPrefix() == HYPHEN) { @@ -52,6 +53,7 @@ public class Command extends Directive implements ICommand { * target as a prerequisite or has no prerequisites, the command * will not be written to standard output before it is executed. */ + @Override public boolean shouldBeSilent() { // Check for the prefix at sign if (getPrefix() == AT) { @@ -65,6 +67,7 @@ public class Command extends Directive implements ICommand { * command line that will be executed even if -n, -q or -t is * specified. */ + @Override public boolean shouldExecute() { // Check for the prefix at sign if (getPrefix() == PLUS) { @@ -73,6 +76,7 @@ public class Command extends Directive implements ICommand { return false; } + @Override public String toString() { StringBuffer cmd = new StringBuffer(); cmd.append( '\t'); @@ -83,12 +87,14 @@ public class Command extends Directive implements ICommand { return cmd.toString(); } + @Override public boolean equals(Object cmd) { if (cmd instanceof Command) return cmd.toString().equals(toString()); return false; } + @Override public int hashCode() { return toString().hashCode(); } @@ -108,9 +114,7 @@ public class Command extends Directive implements ICommand { } } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.ICommand#execute(java.lang.String[], java.io.File) - */ + @Override public Process execute(String shell, String[] envp, File dir) throws IOException { String[] cmdArray = new String[] { shell, "-c", command}; //$NON-NLS-1$ return Runtime.getRuntime().exec(cmdArray, envp, dir); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Comment.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Comment.java index 0cfdf833221..3165326e448 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Comment.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Comment.java @@ -23,18 +23,21 @@ public class Comment extends Directive implements IComment { } } + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(POUND_STRING).append(comment).append('\n'); return buffer.toString(); } + @Override public boolean equals(Object cmt) { if (cmt instanceof Comment) return cmt.toString().equals(toString()); return false; } + @Override public int hashCode() { return toString().hashCode(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/CompletionProposalComparator.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/CompletionProposalComparator.java index 6e78eac1ded..c222a3b18fb 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/CompletionProposalComparator.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/CompletionProposalComparator.java @@ -18,24 +18,11 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal; public class CompletionProposalComparator implements Comparator, Serializable { - /** - * - */ private static final long serialVersionUID = 1L; - /** - * Constructor for CompletionProposalComparator. - */ - public CompletionProposalComparator() { - } - - /* (non-Javadoc) - * @see Comparator#compare(Object, Object) - */ + @Override public int compare(ICompletionProposal o1, ICompletionProposal o2) { - ICompletionProposal c1= (ICompletionProposal) o1; - ICompletionProposal c2= (ICompletionProposal) o2; - return c1.getDisplayString().compareToIgnoreCase(c2.getDisplayString()); + return o1.getDisplayString().compareToIgnoreCase(o2.getDisplayString()); } } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Conditional.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Conditional.java index ad2fefc369c..1d147b0dd25 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Conditional.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Conditional.java @@ -37,14 +37,17 @@ public abstract class Conditional extends Parent implements IConditional { } + @Override public String getConditional() { return cond; } + @Override public String getArg1() { return arg1; } + @Override public String getArg2() { return arg2; } @@ -53,22 +56,27 @@ public abstract class Conditional extends Parent implements IConditional { return false; } + @Override public boolean isIfdef() { return false; } + @Override public boolean isIfndef() { return false; } + @Override public boolean isIfeq() { return false; } + @Override public boolean isIfneq() { return false; } + @Override public boolean isElse() { return false; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/DefineVariable.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/DefineVariable.java index 511e740068b..ac209e4cb35 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/DefineVariable.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/DefineVariable.java @@ -17,10 +17,12 @@ public class DefineVariable extends GNUVariableDef { super(parent, name, value); } + @Override public boolean isMultiLine() { return true; } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.VARIABLE_DEFINE); sb.append(getName()).append('\n'); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Directive.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Directive.java index 330243d3cba..d069b4597d6 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Directive.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Directive.java @@ -26,32 +26,24 @@ public abstract class Directive implements IDirective { setLines(start, end); } + @Override public abstract String toString(); - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IDirective#getEndLine() - */ + @Override public int getEndLine() { return endLine; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IDirective#getStartLine() - */ + @Override public int getStartLine() { return startLine; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IDirective#getParent() - */ + @Override public IDirective getParent() { return parent; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IDirective#getFileName() - */ public String getFileName() { if (filename == null) { if (parent != null) { @@ -61,9 +53,7 @@ public abstract class Directive implements IDirective { return filename; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IDirective#getMakefile() - */ + @Override public IMakefile getMakefile() { if (makefile == null) { if (parent != null) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/EditorUtility.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/EditorUtility.java index 31d9ad9d5ec..0986e927844 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/EditorUtility.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/EditorUtility.java @@ -15,9 +15,6 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.text.MessageFormat; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.CModelException; @@ -34,21 +31,15 @@ import org.eclipse.cdt.core.resources.FileStorage; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.core.filebuffers.FileBuffers; import org.eclipse.core.filesystem.URIUtil; -import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IStorage; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jface.action.Action; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.MessageBox; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; @@ -70,135 +61,6 @@ public class EditorUtility { private EditorUtility () { } - /** - * Tests if a cu is currently shown in an editor - * @return the IEditorPart if shown, null if element is not open in an editor - */ - public static IEditorPart isOpenInEditor(Object inputElement) { - IEditorInput input = null; - - try { - input = getEditorInput(inputElement); - } catch (CModelException x) { - //CUIPlugin.log(x.getStatus()); - } - - if (input != null) { - IWorkbenchPage p= CUIPlugin.getActivePage(); - if (p != null) { - return p.findEditor(input); - } - } - - return null; - } - - /** - * Opens an editor for an element such as ICElement, - * IFile, or IStorage. - * The editor is activated by default. - * @return the IEditorPart or null if wrong element type or opening failed - */ - public static IEditorPart openInEditor(Object inputElement) throws CModelException, PartInitException { - return openInEditor(inputElement, true); - } - - /** - * Opens an editor for an element (ICElement, IFile, IStorage...) - * @return the IEditorPart or null if wrong element type or opening failed - */ - public static IEditorPart openInEditor(Object inputElement, boolean activate) throws CModelException, PartInitException { - - if (inputElement instanceof IFile) { - return openInEditor((IFile) inputElement, activate); - } - - IEditorInput input = getEditorInput(inputElement); - - if (input != null) { - return openInEditor(input, getEditorID(input, inputElement), activate); - } - - return null; - } - - // Following is not needed and drags in internal reference to CEditor. - -// /** -// * Selects a C Element in an editor -// */ -// public static void revealInEditor(IEditorPart part, ICElement element) { -// if (element != null && part instanceof CEditor) { -// ((CEditor) part).setSelection(element); -// } -// } - - private static IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException { - if (!file.getProject().isAccessible()){ - closedProject(file.getProject()); - return null; - } - - if (file != null) { - try { - if (!isLinked(file)) { - File tempFile = file.getRawLocation().toFile(); - - if (tempFile != null){ - String canonicalPath = null; - try { - canonicalPath = tempFile.getCanonicalPath(); - } catch (IOException e1) {} - - if (canonicalPath != null){ - IPath path = new Path(canonicalPath); - file = CUIPlugin.getWorkspace().getRoot().getFileForLocation(path); - } - } - } - - IEditorInput input = getEditorInput(file); - if (input != null) { - return openInEditor(input, getEditorID(input, file), activate); - } - } catch (CModelException e) {} - } - return null; - } - - @SuppressWarnings("deprecation") - public static boolean isLinked(IFile file) { - if (file.isLinked()) - return true; - - IPath path = file.getLocation(); - while (path.segmentCount() > 0) { - path = path.removeLastSegments(1); - IContainer[] containers = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(path); - - for(int i=0; i0 if no match was found - */ - public static int findLocalizedModifier(String token) { - if (token == null) - return 0; - - if (token.equalsIgnoreCase(Action.findModifierString(SWT.CTRL))) - return SWT.CTRL; - if (token.equalsIgnoreCase(Action.findModifierString(SWT.SHIFT))) - return SWT.SHIFT; - if (token.equalsIgnoreCase(Action.findModifierString(SWT.ALT))) - return SWT.ALT; - if (token.equalsIgnoreCase(Action.findModifierString(SWT.COMMAND))) - return SWT.COMMAND; - - return 0; - } - - /** - * Returns the modifier string for the given SWT modifier - * modifier bits. - * - * @param stateMask the SWT modifier bits - * @return the modifier string - * @since 2.1.1 - */ - public static String getModifierString(int stateMask) { - String modifierString= ""; //$NON-NLS-1$ - if ((stateMask & SWT.CTRL) == SWT.CTRL) - modifierString= appendModifierString(modifierString, SWT.CTRL); - if ((stateMask & SWT.ALT) == SWT.ALT) - modifierString= appendModifierString(modifierString, SWT.ALT); - if ((stateMask & SWT.SHIFT) == SWT.SHIFT) - modifierString= appendModifierString(modifierString, SWT.SHIFT); - if ((stateMask & SWT.COMMAND) == SWT.COMMAND) - modifierString= appendModifierString(modifierString, SWT.COMMAND); - - return modifierString; - } - - /** - * Appends to modifier string of the given SWT modifier bit - * to the given modifierString. - * - * @param modifierString the modifier string - * @param modifier an int with SWT modifier bit - * @return the concatenated modifier string - * @since 2.1.1 - */ - private static String appendModifierString(String modifierString, int modifier) { - if (modifierString == null) - modifierString= ""; //$NON-NLS-1$ - String newModifierString= Action.findModifierString(modifier); - if (modifierString.length() == 0) - return newModifierString; - return MakefileMessages.getFormattedString("EditorUtility.concatModifierStrings", new String[] {modifierString, newModifierString}); //$NON-NLS-1$ - } - public static IStorage getStorage(IBinary bin) { IStorage store = null; try { @@ -549,13 +316,4 @@ public class EditorUtility { return store; } - public static IStorage getStorage(ITranslationUnit tu) { - IStorage store = null; - try { - store = new FileStorage (new ByteArrayInputStream(tu.getBuffer().getContents().getBytes()), tu.getPath()); - } catch (CModelException e) { - // nothing; - } - return store; - } } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ElementListSelectionDialog.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ElementListSelectionDialog.java index 3b55792ffa8..5c030a933a4 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ElementListSelectionDialog.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ElementListSelectionDialog.java @@ -14,14 +14,13 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; import java.util.Arrays; import java.util.List; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ILabelProvider; - /** * A class to select one or more elements out of an indexed property */ @@ -29,15 +28,13 @@ public class ElementListSelectionDialog extends AbstractElementListSelectionDial private List fElements; - /* - * @private - */ + @Override protected void computeResult() { setResult(getWidgetSelection()); } - /* - * @private - */ + + + @Override protected Control createDialogArea(Composite parent) { Control result= super.createDialogArea(parent); @@ -59,9 +56,7 @@ public class ElementListSelectionDialog extends AbstractElementListSelectionDial public Object[] getSelectedElements() { return getResult(); } - /* - * @private - */ + @Override protected void handleDoubleClick() { if (verifyCurrentSelection()) { buttonPressed(IDialogConstants.OK_ID); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Else.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Else.java index d261779cae7..9bf9d4a5d46 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Else.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Else.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; import java.io.File; -import java.io.IOException; public class Else extends Conditional implements IAutomakeConditional, ICommand { @@ -23,16 +22,19 @@ public class Else extends Conditional implements IAutomakeConditional, ICommand super(parent); } + @Override public boolean isAutomake() { return isAutomake; } + @Override public Rule[] getRules() { if (rules != null) return rules.clone(); return rules; } + @Override public void setRules(Rule[] rules) { if (rules != null) this.rules = rules.clone(); @@ -40,32 +42,38 @@ public class Else extends Conditional implements IAutomakeConditional, ICommand this.rules = rules; } + @Override public void setAutomake(boolean value) { isAutomake = value; } + @Override public boolean isElse() { return true; } + @Override public String toString() { return GNUMakefileConstants.CONDITIONAL_ELSE; } // ICommand methods so Automake else can be a child of an IRule - public Process execute(String shell, String[] envp, File dir) - throws IOException { + @Override + public Process execute(String shell, String[] envp, File dir) { return null; } + @Override public boolean shouldBeSilent() { return false; } + @Override public boolean shouldIgnoreError() { return false; } + @Override public boolean shouldExecute() { return false; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/EmptyLine.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/EmptyLine.java index 016efd8afec..814094fe1f0 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/EmptyLine.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/EmptyLine.java @@ -20,6 +20,7 @@ public class EmptyLine extends Directive implements IEmptyLine { super(parent); } + @Override public String toString() { return NL_STRING; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endef.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endef.java index 0a67166d6d5..6b6c743e11d 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endef.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endef.java @@ -17,10 +17,12 @@ public class Endef extends Terminal { super(parent); } + @Override public boolean isEndef() { return true; } + @Override public String toString() { return GNUMakefileConstants.TERMINAL_ENDEF; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endif.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endif.java index a812ba4e0e1..30fa3638647 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endif.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endif.java @@ -17,11 +17,13 @@ public class Endif extends Terminal { super(parent); } + @Override public boolean isEndif() { return true; } - public String toString() { + @Override + public String toString() { return GNUMakefileConstants.TERMINAL_ENDIF; } } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExportVariable.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExportVariable.java index e0d455406e6..0e12cb95076 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExportVariable.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExportVariable.java @@ -17,6 +17,7 @@ public class ExportVariable extends GNUVariableDef { super(parent, name, value, type); } + @Override public boolean isExport() { return true; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInput.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInput.java index f59b44a45b6..1096d7faa03 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInput.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInput.java @@ -37,8 +37,7 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis private ITranslationUnit unit; private IPath location; - /* - */ + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -52,75 +51,58 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis } } + @Override public int hashCode() { return externalFile.hashCode(); } - /* - * @see IEditorInput#exists() - */ + @Override public boolean exists() { // External file can not be deleted return true; } - /* - * @see IAdaptable#getAdapter(Class) - */ - @SuppressWarnings({ "unchecked" }) - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + @Override + public T getAdapter(Class adapter) { if (ILocationProvider.class.equals(adapter)) { - return this; + return (T) this; } return Platform.getAdapterManager().getAdapter(this, adapter); } - /* - * @see IEditorInput#getImageDescriptor() - */ + @Override public ImageDescriptor getImageDescriptor() { IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry(); return registry.getImageDescriptor(externalFile.getFullPath().getFileExtension()); } - /* - * @see IEditorInput#getName() - */ + @Override public String getName() { return externalFile.getName(); } - /* - * @see IEditorInput#getPersistable() - */ + @Override public IPersistableElement getPersistable() { return this; } - /* - * see IStorageEditorInput#getStorage() - */ + @Override public IStorage getStorage() { return externalFile; } - /* - * @see IEditorInput#getToolTipText() - */ + @Override public String getToolTipText() { return externalFile.getFullPath().toString(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.autotools.ui.editors.automake.ITranslationUnitEditorInput#getTranslationUnit() - */ + @Override public ITranslationUnit getTranslationUnit() { return unit; } - /* (non-Javadoc) - * @see org.eclipse.ui.editors.text.ILocationProvider#getPath(java.lang.Object) - */ + @Override public IPath getPath(Object element) { return location; } @@ -156,16 +138,12 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis return markerResource; } - /* - * @see org.eclipse.ui.IPersistableElement#getFactoryId() - */ + @Override public String getFactoryId() { return ExternalEditorInputFactory.ID; } - /* - * @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento) - */ + @Override public void saveState(IMemento memento) { ExternalEditorInputFactory.saveState(memento, this); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInputFactory.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInputFactory.java index e4a86c885a2..5ef6ad1a9d6 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInputFactory.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInputFactory.java @@ -11,6 +11,9 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IAdaptable; @@ -20,10 +23,6 @@ import org.eclipse.ui.IElementFactory; import org.eclipse.ui.IMemento; import org.eclipse.ui.IPersistableElement; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.model.ITranslationUnit; - /** * The ExternalEditorInputFactory is used to save and recreate an ExternalEditorInput object. * As such, it implements the IPersistableElement interface for storage @@ -42,9 +41,7 @@ public class ExternalEditorInputFactory implements IElementFactory { private static final String TAG_PATH = "path";//$NON-NLS-1$ private static final String TAG_PROJECT = "project";//$NON-NLS-1$ - /* - * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento) - */ + @Override public IAdaptable createElement(IMemento memento) { // Get the file name. String fileName = memento.getString(TAG_PATH); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUAutomakefile.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUAutomakefile.java index cc8730de6d6..8c30b0d413f 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUAutomakefile.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUAutomakefile.java @@ -68,20 +68,18 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { } public void parse(String name) throws IOException { - FileReader stream = new FileReader(name); - try { + ; + try (FileReader stream = new FileReader(name)) { parse(name, stream); - } finally { - if (stream != null) { - stream.close(); - } } } + @Override public void parse(String filePath, Reader reader) throws IOException { parse(URIUtil.toURI(filePath), new MakefileReader(reader)); } + @Override public void parse(URI fileURI, Reader reader) throws IOException { parse(fileURI, new MakefileReader(reader)); } @@ -90,8 +88,8 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { protected void parse(URI fileURI, MakefileReader reader) throws IOException { String line; Rule[] rules = null; - Stack conditions = new Stack(); - Stack defines = new Stack(); + Stack conditions = new Stack<>(); + Stack defines = new Stack<>(); int startLine = 0; int endLine = 0; @@ -108,10 +106,10 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { if (GNUMakefileUtil.isEndef(line)) { // We should have a "define" for a "endef". if (!defines.empty()) { - GNUVariableDef def = (GNUVariableDef) defines.pop(); + GNUVariableDef def = defines.pop(); def.setEndLine(endLine); } - Endef endef = new Endef((Directive)this); + Endef endef = new Endef(this); endef.setLines(startLine, endLine); addDirective(conditions, endef); continue; @@ -131,7 +129,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { // We still in a define. if (!defines.empty()) { - GNUVariableDef def = (GNUVariableDef) defines.peek(); + GNUVariableDef def = defines.peek(); StringBuffer sb = def.getValue(); if (sb.length() > 0) { sb.append('\n'); @@ -626,7 +624,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { String[] directories; StringTokenizer st = new StringTokenizer(line); int count = st.countTokens(); - List dirs = new ArrayList(count); + List dirs = new ArrayList<>(count); if (count > 0) { for (int i = 0; i < count; i++) { if (count == 0) { @@ -642,7 +640,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { } } } - directories = (String[]) dirs.toArray(new String[0]); + directories = dirs.toArray(new String[0]); if (pattern == null) { pattern = ""; } @@ -876,12 +874,13 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { return new InferenceRule(this, new Target(tgt)); } + @Override public IDirective[] getDirectives(boolean expand) { if (!expand) { return getDirectives(); } IDirective[] dirs = getDirectives(); - ArrayList list = new ArrayList(Arrays.asList(dirs)); + ArrayList list = new ArrayList<>(Arrays.asList(dirs)); for (int i = 0; i < dirs.length; ++i) { if (dirs[i] instanceof Include) { Include include = (Include)dirs[i]; @@ -892,12 +891,13 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { } } } - return (IDirective[]) list.toArray(new IDirective[list.size()]); + return list.toArray(new IDirective[list.size()]); } /* (non-Javadoc) * @see org.eclipse.cdt.internal.autotools.ui.editors.automake.AbstractMakefile#getBuiltins() */ + @Override public IDirective[] getBuiltins() { if (builtins == null) { String location = "builtin" + File.separator + "gnu.mk"; //$NON-NLS-1$ //$NON-NLS-2$ @@ -924,10 +924,12 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { return builtins.clone(); } + @Override public void setIncludeDirectories(String[] dirs) { includeDirectories = dirs.clone(); } + @Override public String[] getIncludeDirectories() { return includeDirectories.clone(); } @@ -943,7 +945,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile { URI fileURI = file.getLocationURI(); IMakefile makefile = null; GNUAutomakefile gnu = new GNUAutomakefile(); - ArrayList includeList = new ArrayList(); + ArrayList includeList = new ArrayList<>(); includeList.add(new Path(fileURI.getPath()).removeLastSegments(1).toString()); includeList.addAll(Arrays.asList(gnu.getIncludeDirectories())); String[] includes = includeList.toArray(new String[includeList.size()]); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUTargetRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUTargetRule.java index 1f41ae8912e..2b4eac01e5d 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUTargetRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUTargetRule.java @@ -35,10 +35,7 @@ public class GNUTargetRule extends TargetRule { return orderOnlyPrerequisites.clone(); } - - /** - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getTarget().toString()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUVariableDef.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUVariableDef.java index 93831f0d64d..7c38994109c 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUVariableDef.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUVariableDef.java @@ -42,9 +42,7 @@ public class GNUVariableDef extends MacroDefinition implements IVariableDefiniti this.type = type; } - /** - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer sb = new StringBuffer(); if (isTargetSpecific()) { @@ -80,31 +78,38 @@ public class GNUVariableDef extends MacroDefinition implements IVariableDefiniti return sb.toString(); } + @Override public boolean isRecursivelyExpanded() { return type == TYPE_RECURSIVE_EXPAND; } + @Override public boolean isSimplyExpanded() { return type == TYPE_SIMPLE_EXPAND; } + @Override public boolean isConditional() { return type == TYPE_CONDITIONAL; } + @Override public boolean isAppend() { return type == TYPE_APPEND; } + @Override public boolean isTargetSpecific() { String t = getTarget(); return t != null && t.length() > 0; } + @Override public boolean isExport() { return false; } + @Override public boolean isMultiLine() { return false; } @@ -112,17 +117,20 @@ public class GNUVariableDef extends MacroDefinition implements IVariableDefiniti /** * Variable from an `override' directive. */ - public boolean isOverride() { + @Override + public boolean isOverride() { return false; } /** * Automatic variable -- cannot be set. */ - public boolean isAutomatic() { + @Override + public boolean isAutomatic() { return false; } + @Override public String getTarget() { return varTarget; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IDirective.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IDirective.java index 6b699d4d4cf..a58a108e640 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IDirective.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IDirective.java @@ -43,5 +43,6 @@ public interface IDirective { */ IMakefile getMakefile(); + @Override String toString(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ITarget.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ITarget.java index c014c22c401..6ea0e1bfc37 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ITarget.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ITarget.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; */ public interface ITarget { + @Override String toString(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/If.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/If.java index 5ca21d0ef84..d2fcf4a0a7a 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/If.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/If.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; import java.io.File; -import java.io.IOException; public class If extends Conditional implements IAutomakeConditional, ICommand { private static final String EMPTY = ""; //$NON-NLS-1$ @@ -26,12 +25,14 @@ public class If extends Conditional implements IAutomakeConditional, ICommand { } } + @Override public Rule[] getRules() { if (rules != null) return rules.clone(); return null; } + @Override public void setRules(Rule[] rules) { if (rules != null) this.rules = rules.clone(); @@ -39,18 +40,22 @@ public class If extends Conditional implements IAutomakeConditional, ICommand { this.rules = rules; } + @Override public boolean isIf() { return true; } + @Override public boolean isAutomake() { return true; } + @Override public void setAutomake(boolean value) { // ignore value } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.CONDITIONAL_IF); sb.append(' ').append(getVariable()); @@ -62,19 +67,22 @@ public class If extends Conditional implements IAutomakeConditional, ICommand { } // ICommand methods so Automake if can be a child of an IRule - public Process execute(String shell, String[] envp, File dir) - throws IOException { + @Override + public Process execute(String shell, String[] envp, File dir) { return null; } + @Override public boolean shouldBeSilent() { return false; } + @Override public boolean shouldIgnoreError() { return false; } + @Override public boolean shouldExecute() { return false; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifdef.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifdef.java index 52f47fd44cb..efaff83de33 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifdef.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifdef.java @@ -18,10 +18,12 @@ public class Ifdef extends Conditional { super(parent, var, EMPTY, EMPTY); } + @Override public boolean isIfdef() { return true; } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.CONDITIONAL_IFDEF); sb.append(' ').append(getVariable()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifeq.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifeq.java index 5bb35dfd21f..e69dbb34ebb 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifeq.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifeq.java @@ -17,10 +17,12 @@ public class Ifeq extends Conditional { super(parent, cond); } + @Override public boolean isIfeq() { return true; } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.CONDITIONAL_IFEQ); sb.append(' ').append(getConditional()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifndef.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifndef.java index 09e51105c10..91da5673486 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifndef.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifndef.java @@ -18,10 +18,12 @@ public class Ifndef extends Conditional { super(parent, var, EMPTY, EMPTY); } + @Override public boolean isIfndef() { return true; } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.CONDITIONAL_IFNDEF); sb.append(' ').append(getVariable()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifneq.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifneq.java index f222da2cca6..7dab01d05a5 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifneq.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifneq.java @@ -17,10 +17,12 @@ public class Ifneq extends Conditional { super(parent, cond); } + @Override public boolean isIfneq() { return true; } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.CONDITIONAL_IFNEQ); sb.append(' ').append(getConditional()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Include.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Include.java index ab9fe9d28eb..6fe507d9419 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Include.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Include.java @@ -23,6 +23,7 @@ public class Include extends Parent implements IInclude { dirs = directories.clone(); } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.DIRECTIVE_INCLUDE); for (int i = 0; i < filenames.length; i++) { @@ -31,10 +32,12 @@ public class Include extends Parent implements IInclude { return sb.toString(); } + @Override public String[] getFilenames() { return filenames.clone(); } + @Override public IDirective[] getDirectives() { clearDirectives(); for (int i = 0; i < filenames.length; i++) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/InferenceRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/InferenceRule.java index 1d68cad880f..c8645470e84 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/InferenceRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/InferenceRule.java @@ -24,9 +24,7 @@ public class InferenceRule extends Rule { super(parent, target, cmds); } - /** - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getTarget().toString()).append(":\n"); //$NON-NLS-1$ diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/LexicalSortingAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/LexicalSortingAction.java index da6a916582b..a351186f2b5 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/LexicalSortingAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/LexicalSortingAction.java @@ -44,6 +44,7 @@ public class LexicalSortingAction extends Action { valueChanged(checked, false); } + @Override public void run() { valueChanged(isChecked(), true); } @@ -66,6 +67,7 @@ public class LexicalSortingAction extends Action { return true; } + @Override public int category(Object obj) { if (obj instanceof ICElement) { ICElement elem= (ICElement)obj; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinition.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinition.java index 733a255229b..dfde4b2955a 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinition.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinition.java @@ -27,6 +27,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition { value = v; } + @Override public String getName() { return name; } @@ -35,25 +36,26 @@ public class MacroDefinition extends Directive implements IMacroDefinition { name = (n == null) ? "" : n.trim() ; //$NON-NLS-1$ } + @Override public StringBuffer getValue() { return value; } - /** - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getName()).append(" = ").append(getValue()).append('\n'); //$NON-NLS-1$ return buffer.toString(); } + @Override public boolean equals(Object v) { if (v instanceof MacroDefinition) return ((MacroDefinition)v).getName().equals(getName()); return false; } + @Override public int hashCode() { return getName().hashCode(); } @@ -78,37 +80,27 @@ public class MacroDefinition extends Directive implements IMacroDefinition { fromMakefile = from; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromCommand() - */ + @Override public boolean isFromCommand() { return fromCommand; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromDefault() - */ + @Override public boolean isFromDefault() { return fromDefault; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromEnviroment() - */ + @Override public boolean isFromEnviroment() { return fromEnvironment; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromEnviroment() - */ + @Override public boolean isFromEnvironmentOverride() { return fromEnvironmentOverride; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromMakefile() - */ + @Override public boolean isFromMakefile() { return fromMakefile; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinitionRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinitionRule.java index 09e4fe8133f..f8b8955ac90 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinitionRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinitionRule.java @@ -33,10 +33,12 @@ class MacroDefinitionRule implements IPredicateRule { this.defaultToken = defaultToken; } + @Override public IToken getSuccessToken() { return token; } + @Override public IToken evaluate(ICharacterScanner scanner, boolean resume) { buffer.setLength(0); int state = INIT_STATE; @@ -106,6 +108,7 @@ class MacroDefinitionRule implements IPredicateRule { } + @Override public IToken evaluate(ICharacterScanner scanner) { return evaluate(scanner, false); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroReferenceRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroReferenceRule.java index f8bc830cc97..92d999363b4 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroReferenceRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroReferenceRule.java @@ -32,11 +32,13 @@ public class MacroReferenceRule extends PatternRule { } } + @Override protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) { nOfBrackets = 1; return super.doEvaluate(scanner, resume); } + @Override protected boolean endSequenceDetected(ICharacterScanner scanner) { int c; char[][] delimiters = scanner.getLegalLineDelimiters(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileAnnotationHover.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileAnnotationHover.java index 34eed5eab26..be5d726c704 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileAnnotationHover.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileAnnotationHover.java @@ -89,8 +89,8 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov if (model == null) return null; - List exact= new ArrayList(); - List including= new ArrayList(); + List exact= new ArrayList<>(); + List including= new ArrayList<>(); @SuppressWarnings("rawtypes") Iterator e= model.getAnnotationIterator(); @@ -115,6 +115,7 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov /* * @see IVerticalRulerHover#getHoverInfo(ISourceViewer, int) */ + @Override public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) { List annotations = getAnnotationsForLine(sourceViewer, lineNumber); if (annotations != null && annotations.size() > 0) { @@ -122,25 +123,25 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov if (annotations.size() == 1) { // optimization - Annotation annotation = (Annotation) annotations.get(0); + Annotation annotation = annotations.get(0); String message= annotation.getText(); if (message != null && message.trim().length() > 0) return formatSingleMessage(message); } else { - List messages= new ArrayList(); + List messages= new ArrayList<>(); Iterator e= annotations.iterator(); while (e.hasNext()) { - Annotation annotation = (Annotation) e.next(); + Annotation annotation = e.next(); String message= annotation.getText(); if (message != null && message.trim().length() > 0) messages.add(message.trim()); } if (messages.size() == 1) - return formatSingleMessage((String) messages.get(0)); + return formatSingleMessage(messages.get(0)); if (messages.size() > 1) return formatMultipleMessages(messages); @@ -172,7 +173,7 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov HTMLPrinter.startBulletList(buffer); Iterator e= messages.iterator(); while (e.hasNext()) - HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent((String) e.next())); + HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent(e.next())); HTMLPrinter.endBulletList(buffer); HTMLPrinter.addPageEpilog(buffer); @@ -184,22 +185,27 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov // handles html. + @Override public IInformationControlCreator getHoverControlCreator() { return new IInformationControlCreator() { + @Override public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent, false); } }; } + @Override public boolean canHandleMouseCursor() { return false; } + @Override public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) { return new LineRange(lineNumber, 1); } + @Override public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleNumberOfLines) { return getHoverInfo(sourceViewer, lineRange.getStartLine()); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCodeScanner.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCodeScanner.java index 1abb345d2c4..171d548e91d 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCodeScanner.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCodeScanner.java @@ -56,6 +56,7 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner { initialize(); } + @Override protected List createRules() { IToken keyword = getToken(ColorManager.MAKE_KEYWORD_COLOR); IToken function = getToken(ColorManager.MAKE_FUNCTION_COLOR); @@ -64,13 +65,14 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner { IToken macroDef = getToken(ColorManager.MAKE_MACRO_DEF_COLOR); IToken other = getToken(ColorManager.MAKE_DEFAULT_COLOR); - List rules = new ArrayList(); + List rules = new ArrayList<>(); // Add rule for single line comments. rules.add(new EndOfLineRule("#", comment, '\\', true)); //$NON-NLS-1$ // Add generic whitespace rule. rules.add(new WhitespaceRule(new IWhitespaceDetector() { + @Override public boolean isWhitespace(char character) { return Character.isWhitespace(character); } @@ -107,6 +109,7 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner { /* * @see AbstractMakefileCodeScanner#getTokenProperties() */ + @Override protected String[] getTokenProperties() { return fTokenProperties; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCompletionProcessor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCompletionProcessor.java index f62ae6a0bf5..572b78c5fd9 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCompletionProcessor.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCompletionProcessor.java @@ -42,23 +42,17 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { protected int fInstallOffset; - /* - * @see IContextInformationValidator#isContextInformationValid(int) - */ + @Override public boolean isContextInformationValid(int offset) { return Math.abs(fInstallOffset - offset) < 5; } - /* - * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int) - */ + @Override public void install(IContextInformation info, ITextViewer viewer, int offset) { fInstallOffset = offset; } - /* - * @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation) - */ + @Override public boolean updatePresentation(int documentPosition, TextPresentation presentation) { return false; } @@ -66,9 +60,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { public static class DirectiveComparator implements Comparator{ - /* (non-Javadoc) - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ + @Override public int compare(Object o1, Object o2) { String name1; String name2; @@ -107,9 +99,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager(); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int) - */ + @Override public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) { WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset); boolean macro = WordPartDetector.inMacro(viewer, documentOffset); @@ -125,7 +115,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { statements = makefile.getTargetRules(); } - ArrayList proposalList = new ArrayList(statements.length); + ArrayList proposalList = new ArrayList<>(statements.length); // iterate over all the different categories for (int i = 0; i < statements.length; i++) { @@ -157,19 +147,17 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { proposalList.add(result); } } - ICompletionProposal[] proposals = (ICompletionProposal[]) proposalList.toArray(new ICompletionProposal[0]); + ICompletionProposal[] proposals = proposalList.toArray(new ICompletionProposal[0]); Arrays.sort(proposals, comparator); return proposals; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int) - */ + @Override public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) { WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset); boolean macro = WordPartDetector.inMacro(viewer, documentOffset); IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput()); - ArrayList contextList = new ArrayList(); + ArrayList contextList = new ArrayList<>(); if (macro) { IDirective[] statements = makefile.getMacroDefinitions(); for (int i = 0; i < statements.length; i++) { @@ -197,37 +185,29 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { IContextInformation[] result = new IContextInformation[contextList.size()]; for (int i = 0; i < result.length; i++) { - String context = (String)contextList.get(i); + String context = contextList.get(i); result[i] = new ContextInformation(imageMacro, wordPart.toString(), context); } return result; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() - */ + @Override public char[] getCompletionProposalAutoActivationCharacters() { return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters() - */ + @Override public char[] getContextInformationAutoActivationCharacters() { return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage() - */ + @Override public String getErrorMessage() { return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator() - */ + @Override public IContextInformationValidator getContextInformationValidator() { return fValidator; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileContentOutlinePage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileContentOutlinePage.java index 419e2a8e1db..a0608e8f6d2 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileContentOutlinePage.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileContentOutlinePage.java @@ -14,7 +14,6 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; import java.util.ArrayList; import java.util.List; - import org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin; import org.eclipse.cdt.internal.autotools.ui.MakeUIImages; import org.eclipse.jface.action.IMenuListener; @@ -24,7 +23,6 @@ import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TreeViewer; @@ -38,13 +36,12 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.part.IPageSite; import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; /** * MakefileContentOutlinePage */ -public class MakefileContentOutlinePage extends ContentOutlinePage implements IContentOutlinePage { +public class MakefileContentOutlinePage extends ContentOutlinePage { private class MakefileContentProvider implements ITreeContentProvider { @@ -56,9 +53,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC protected IMakefile makefile; protected IMakefile nullMakefile = new NullMakefile(); - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) - */ + @Override public Object[] getChildren(Object element) { if (element == fInput) { return getElements(makefile); @@ -68,9 +63,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC return new Object[0]; } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) - */ + @Override public Object getParent(Object element) { if (element instanceof IMakefile) { return fInput; @@ -80,9 +73,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC return fInput; } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) - */ + @Override public boolean hasChildren(Object element) { if (element == fInput) { return true; @@ -96,9 +87,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC return false; } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ + @Override public Object[] getElements(Object inputElement) { IDirective[] directives; if (inputElement == fInput) { @@ -114,7 +103,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC } else { directives = new IDirective[0]; } - List list = new ArrayList(directives.length); + List list = new ArrayList<>(directives.length); for (int i = 0; i < directives.length; i++) { if (showMacroDefinition && directives[i] instanceof IMacroDefinition) { list.add(directives[i]); @@ -134,15 +123,11 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC return list.toArray(); } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ + @Override public void dispose() { } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (oldInput != null) { makefile = nullMakefile; @@ -159,11 +144,9 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC } - private static class MakefileLabelProvider extends LabelProvider implements ILabelProvider { + private static class MakefileLabelProvider extends LabelProvider { - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) - */ + @Override public Image getImage(Object element) { if (element instanceof ITargetRule) { return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE); @@ -183,9 +166,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC return super.getImage(element); } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ + @Override public String getText(Object element) { String name; if (element instanceof IRule) { @@ -216,9 +197,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC fOpenIncludeAction = new OpenIncludeAction(this); } - /* (non-Javadoc) - * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(Composite parent) { super.createControl(parent); TreeViewer viewer = getTreeViewer(); @@ -231,6 +210,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC MenuManager manager= new MenuManager("#MakefileOutlinerContext"); //$NON-NLS-1$ manager.setRemoveAllWhenShown(true); manager.addMenuListener(new IMenuListener() { + @Override public void menuAboutToShow(IMenuManager m) { contextMenuAboutToShow(m); } @@ -240,9 +220,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC tree.setMenu(menu); viewer.addDoubleClickListener(new IDoubleClickListener() { - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) - */ + @Override public void doubleClick(DoubleClickEvent event) { if (fOpenIncludeAction != null) { fOpenIncludeAction.run(); @@ -290,6 +268,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC final Control control = viewer.getControl(); if (control != null && !control.isDisposed()) { control.getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (!control.isDisposed()) { control.setRedraw(false); @@ -306,6 +285,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage implements IC /* (non-Javadoc) * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars) */ + @Override public void setActionBars(IActionBars actionBars) { super.setActionBars(actionBars); IToolBarManager toolBarManager= actionBars.getToolBarManager(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentProvider.java index 6cd9c7092b3..954e7664f24 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentProvider.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentProvider.java @@ -65,16 +65,12 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement return null; } - /* (non-Javadoc) - * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createAnnotationModel(org.eclipse.core.resources.IFile) - */ - protected IAnnotationModel createAnnotationModel(IFile file) { + @Override + protected IAnnotationModel createAnnotationModel(IFile file) { return new MakefileAnnotationModel(file); } - /* - * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createFileInfo(java.lang.Object) - */ + @Override protected FileInfo createFileInfo(Object element) throws CoreException { if (!(element instanceof IFileEditorInput)) return null; @@ -101,10 +97,8 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement return makefileInfo; } - /* (non-Javadoc) - * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#disposeFileInfo(java.lang.Object, org.eclipse.ui.editors.text.TextFileDocumentProvider.FileInfo) - */ - protected void disposeFileInfo(Object element, FileInfo info) { + @Override + protected void disposeFileInfo(Object element, FileInfo info) { if (info instanceof MakefileFileInfo) { MakefileFileInfo makefileInfo= (MakefileFileInfo) info; if (makefileInfo.fCopy != null) { @@ -114,16 +108,12 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement super.disposeFileInfo(element, info); } - /* - * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createEmptyFileInfo() - */ + @Override protected FileInfo createEmptyFileInfo() { return new MakefileFileInfo(); } - /* - * @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IMakefileDocumentProvider#getWorkingCopy(java.lang.Object) - */ + @Override public IMakefile getWorkingCopy(Object element) { FileInfo fileInfo= getFileInfo(element); if (fileInfo instanceof MakefileFileInfo) { @@ -133,9 +123,7 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement return null; } - /* - * @see org.eclipse.cdt.internal.autotools.ui.editors.automake.MakefileDocumentProvider#shutdown() - */ + @Override public void shutdown() { @SuppressWarnings("rawtypes") Iterator e= getConnectedElementsIterator(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentSetupParticipant.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentSetupParticipant.java index 75553c2d944..6ce9473d4bb 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentSetupParticipant.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentSetupParticipant.java @@ -31,9 +31,7 @@ public class MakefileDocumentSetupParticipant implements IDocumentSetupParticip public MakefileDocumentSetupParticipant() { } - /* - * @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument) - */ + @Override public void setup(IDocument document) { if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3= (IDocumentExtension3) document; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditor.java index fe124463695..af7d8bd544a 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditor.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditor.java @@ -90,9 +90,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe super(); } - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor() - */ + @Override protected void initializeEditor() { setRangeIndicator(new DefaultRangeIndicator()); setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$ @@ -106,9 +104,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe setSourceViewerConfiguration(new MakefileSourceConfiguration(chainedStore, this)); } - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ + @Override public void dispose() { if (fProjectionMakefileUpdater != null) { fProjectionMakefileUpdater.uninstall(); @@ -121,18 +117,14 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe return AutotoolsPlugin.getDefault().getPreferenceStore().getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED); } - /* - * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#isTabsToSpacesConversionEnabled() - */ + @Override protected boolean isTabsToSpacesConversionEnabled() { // always false for Makefiles // see http://bugs.eclipse.org/186106 return false; } - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createPartControl(Composite parent) { super.createPartControl(parent); ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); @@ -154,6 +146,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe } } + @Override protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles); @@ -163,9 +156,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe return viewer; } - /* (non-Javadoc) - * Method declared on IAdaptable - */ + @Override public Object getAdapter(@SuppressWarnings("rawtypes") Class key) { if (ProjectionAnnotationModel.class.equals(key)) { if (projectionSupport != null) { @@ -180,9 +171,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe return super.getAdapter(key); } - /* (non-Javadoc) - * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public void doSave(IProgressMonitor monitor) { super.doSave(monitor); if (page != null) { @@ -190,9 +179,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe } } - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions() - */ + @Override protected void createActions() { super.createActions(); @@ -223,9 +210,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe } - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) - */ + @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection.isEmpty()) { @@ -306,9 +291,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe } } - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager) - */ + @Override protected void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Comment"); //$NON-NLS-1$ @@ -342,8 +325,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe } } - /* - */ + @Override public void reconciled() { // Notify listeners Object[] listeners = fReconcilingListeners.getListeners(); @@ -352,9 +334,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe } } - /* - * @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert() - */ + @Override protected void performRevert() { ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer(); projectionViewer.setRedraw(false); @@ -381,9 +361,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe } - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.AbstractTextEditor#handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent) - */ + @Override protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) @@ -416,9 +394,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe super.handlePreferenceStoreChanged(event); } - /* - * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#collectContextMenuPreferencePages() - */ + @Override protected String[] collectContextMenuPreferencePages() { // Add Makefile Editor relevant pages String[] parentPrefPageIds = super.collectContextMenuPreferencePages(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorActionContributor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorActionContributor.java index 181e53c393e..9c0a930a7de 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorActionContributor.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorActionContributor.java @@ -50,9 +50,7 @@ public class MakefileEditorActionContributor extends BasicTextEditorActionContri } - /** - * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(IEditorPart) - */ + @Override public void setActiveEditor(IEditorPart targetEditor) { super.setActiveEditor(targetEditor); doSetActiveEditor(targetEditor); @@ -76,17 +74,13 @@ public class MakefileEditorActionContributor extends BasicTextEditorActionContri fOpenDeclarationAction.update(); } - /* - * @see IEditorActionBarContributor#dispose() - */ + @Override public void dispose() { doSetActiveEditor(null); super.dispose(); } - /** - * @see org.eclipse.ui.part.EditorActionBarContributor#init(IActionBars) - */ + @Override public void init(IActionBars bars) { super.init(bars); IMenuManager menuManager = bars.getMenuManager(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorTogglePresentationAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorTogglePresentationAction.java index 6a71db7bb61..5a64c38bfef 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorTogglePresentationAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorTogglePresentationAction.java @@ -30,9 +30,7 @@ public class MakefileEditorTogglePresentationAction extends TextEditorAction { update(); } - /** - * @see org.eclipse.jface.action.IAction#run() - */ + @Override public void run() { ITextEditor editor= getTextEditor(); editor.resetHighlightRange(); @@ -41,9 +39,7 @@ public class MakefileEditorTogglePresentationAction extends TextEditorAction { editor.showHighlightRangeOnly(!show); } - /** - * @see org.eclipse.ui.texteditor.IUpdate#update() - */ + @Override public void update() { setChecked(getTextEditor() != null && getTextEditor().showsHighlightRangeOnly()); setEnabled(true); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefilePartitionScanner.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefilePartitionScanner.java index a992172cba3..34a9f842c41 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefilePartitionScanner.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefilePartitionScanner.java @@ -56,7 +56,7 @@ public class MakefilePartitionScanner extends RuleBasedPartitionScanner { IToken tDef = new Token(MAKEFILE_DEF_BLOCK_PARTITION); IToken tOther = new Token(MAKEFILE_OTHER_PARTITION); - List rules = new ArrayList(); + List rules = new ArrayList<>(); // Add rule for single line comments. @@ -86,9 +86,7 @@ public class MakefilePartitionScanner extends RuleBasedPartitionScanner { } - /* - * @see ICharacterScanner#getLegalLineDelimiters - */ + @Override public char[][] getLegalLineDelimiters() { return fModDelimiters.clone(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReader.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReader.java index 4b6c1cd89b2..1c751bfb97d 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReader.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReader.java @@ -28,6 +28,7 @@ public class MakefileReader extends LineNumberReader { } + @Override public String readLine() throws IOException { boolean done = false; StringBuffer buffer = new StringBuffer(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReconcilingStrategy.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReconcilingStrategy.java index 7a9cc1a03ca..7483074ab94 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReconcilingStrategy.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReconcilingStrategy.java @@ -43,16 +43,12 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy { fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor; } - /** - * @see IReconcilingStrategy#reconcile(document) - */ + @Override public void setDocument(IDocument document) { } - /** - * @see IReconcilingStrategy#reconcile(region) - */ + @Override public void reconcile(IRegion region) { // We use a trick to avoid running the reconciler multiple times // on a file when it gets changed. This is because this gets called @@ -64,9 +60,7 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy { fLastRegionOffset = region.getOffset(); } - /** - * @see IReconcilingStrategy#reconcile(dirtyRegion, region) - */ + @Override public void reconcile(DirtyRegion dirtyRegion, IRegion region) { // FIXME: This seems to generate to much flashing in // the contentouline viewer. diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileSourceConfiguration.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileSourceConfiguration.java index b7a62b66115..a70600b4dca 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileSourceConfiguration.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileSourceConfiguration.java @@ -28,7 +28,6 @@ import org.eclipse.jface.text.rules.DefaultDamagerRepairer; import org.eclipse.jface.text.rules.Token; import org.eclipse.jface.text.source.IAnnotationHover; import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.graphics.RGB; import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; @@ -58,9 +57,7 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration { colorManager = ColorManager.getDefault(); } - /** - * @see SourceViewerConfiguration#getConfiguredContentTypes(ISourceViewer) - */ + @Override public String[] getConfiguredContentTypes(ISourceViewer v) { return new String[] { IDocument.DEFAULT_CONTENT_TYPE, @@ -73,9 +70,7 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration { } - /** - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer) - */ + @Override public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ContentAssistant assistant = new ContentAssistant(); assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), IDocument.DEFAULT_CONTENT_TYPE); @@ -103,6 +98,7 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration { } + @Override public IPresentationReconciler getPresentationReconciler(ISourceViewer v) { PresentationReconciler reconciler = new PresentationReconciler(); @@ -138,9 +134,7 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration { return reconciler; } - /** - * @see SourceViewerConfiguration#getReconciler(ISourceViewer) - */ + @Override public IReconciler getReconciler(ISourceViewer sourceViewer) { if (fEditor != null && fEditor.isEditable()) { MonoReconciler reconciler= new MonoReconciler(new MakefileReconcilingStrategy(fEditor), false); @@ -151,22 +145,16 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration { return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getDefaultPrefixes(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) - */ + @Override public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType) { return new String[]{"#"}; //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getTextHover(org.eclipse.jface.text.source.ISourceViewer, java.lang.String) - */ + @Override public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) { return new MakefileTextHover(fEditor); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer) - */ + @Override public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { return new MakefileAnnotationHover(fEditor); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileStorageDocumentProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileStorageDocumentProvider.java index 20a96f929fa..9228b225e42 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileStorageDocumentProvider.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileStorageDocumentProvider.java @@ -22,10 +22,7 @@ import org.eclipse.ui.editors.text.StorageDocumentProvider; */ public class MakefileStorageDocumentProvider extends StorageDocumentProvider { - /* - * @see org.eclipse.ui.editors.text.StorageDocumentProvider#setupDocument(java.lang.Object, - * org.eclipse.jface.text.IDocument) - */ + @Override protected void setupDocument(Object element, IDocument document) { if (document != null) { IDocumentPartitioner partitioner= createDocumentPartitioner(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileTextHover.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileTextHover.java index e25962feacb..631d259e467 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileTextHover.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileTextHover.java @@ -36,12 +36,7 @@ public class MakefileTextHover implements ITextHover { fEditor = editor; } - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, - * org.eclipse.jface.text.IRegion) - */ + @Override public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { if (hoverRegion != null) { try { @@ -85,12 +80,7 @@ public class MakefileTextHover implements ITextHover { return ""; //$NON-NLS-1$ } - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, - * int) - */ + @Override public IRegion getHoverRegion(ITextViewer textViewer, int offset) { Point selection = textViewer.getSelectedRange(); if (selection.x <= offset && offset < selection.x + selection.y) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileWordDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileWordDetector.java index a103b51f5de..bcdc4a38516 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileWordDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileWordDetector.java @@ -17,16 +17,12 @@ public class MakefileWordDetector implements IWordDetector { private static final String correctStartSpecChars = "%*().><"; //$NON-NLS-1$ private static final String correctSpecChars = "@$/\\"; //$NON-NLS-1$ - /** - * @see IWordDetector#isWordPart(character) - */ + @Override public boolean isWordPart(char character) { return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0); } - /** - * @see IWordDetector#isWordStart(char) - */ + @Override public boolean isWordStart(char character) { return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MessageLine.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MessageLine.java index 6419424a49c..118e3dafe5f 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MessageLine.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MessageLine.java @@ -109,6 +109,7 @@ public class MessageLine { if (fErrorColor == null) { fErrorColor= new Color(clabel.getDisplay(), fErrorRGB); clabel.addDisposeListener(new DisposeListener() { + @Override public void widgetDisposed(DisposeEvent e) { fErrorColor.dispose(); } @@ -132,23 +133,14 @@ public class MessageLine { } } - /** - * @see org.eclipse.swt.custom.CLabel#isDisposed() - */ public boolean isDisposed() { return clabel.isDisposed(); } - /** - * @see org.eclipse.swt.custom.CLabel#setAlignment(int) - */ public void setAlignment(int left) { clabel.setAlignment(left); } - /** - * @see org.eclipse.swt.widgets.Control#setLayoutData(Object) - */ public void setLayoutData(GridData gridData) { clabel.setLayoutData(gridData); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/NullMakefile.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/NullMakefile.java index 10f1027c669..23d899e09c1 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/NullMakefile.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/NullMakefile.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.internal.autotools.ui.editors.automake; -import java.io.IOException; import java.io.Reader; import java.net.URI; @@ -38,10 +37,12 @@ public class NullMakefile extends AbstractMakefile { super(null); } + @Override public IDirective[] getDirectives() { return EMPTY_DIRECTIVES; } + @Override public IDirective[] getBuiltins() { return EMPTY_DIRECTIVES; } @@ -49,19 +50,19 @@ public class NullMakefile extends AbstractMakefile { public void addDirective(IDirective directive) { } + @Override public String toString() { return ""; } - /* (non-Javadoc) - * @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.io.Reader) - */ - public void parse(String name, Reader makefile) throws IOException { + @Override + public void parse(String name, Reader makefile) { } - public void parse(URI fileURI, Reader reader) throws IOException { + @Override + public void parse(URI fileURI, Reader reader) { } - protected void parse(URI fileURI, MakefileReader reader) throws IOException { + protected void parse(URI fileURI, MakefileReader reader) { } } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenDeclarationAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenDeclarationAction.java index d2b1bc0646e..5530dcf82fd 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenDeclarationAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenDeclarationAction.java @@ -43,11 +43,7 @@ public class OpenDeclarationAction extends TextEditorAction { super(MakeUIMessages.getResourceBundle(), "OpenDeclarationAction.", editor); //$NON-NLS-1$ } - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.action.IAction#run() - */ + @Override public void run() { ITextEditor editor = getTextEditor(); if (editor == null) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenIncludeAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenIncludeAction.java index 38e293d9b96..783c4e5adb3 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenIncludeAction.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenIncludeAction.java @@ -21,7 +21,6 @@ import java.util.HashSet; import java.util.List; import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.IInclude; import org.eclipse.cdt.core.parser.ExtendedScannerInfo; @@ -77,6 +76,7 @@ public class OpenIncludeAction extends Action { fSelectionProvider= provider; } + @Override public void run() { IInclude include= getIncludeStatement(fSelectionProvider.getSelection()); if (include == null) { @@ -85,7 +85,7 @@ public class OpenIncludeAction extends Action { try { IResource res = include.getUnderlyingResource(); - ArrayList filesFound = new ArrayList(4); + ArrayList filesFound = new ArrayList<>(4); String fullFileName= include.getFullFileName(); if (fullFileName != null) { IPath fullPath= new Path(fullFileName); @@ -150,8 +150,6 @@ public class OpenIncludeAction extends Action { if (fileToOpen != null) { EditorUtility.openInEditor(fileToOpen, include); } - } catch (CModelException e) { - CUIPlugin.log(e.getStatus()); } catch (CoreException e) { CUIPlugin.log(e.getStatus()); } @@ -196,8 +194,7 @@ public class OpenIncludeAction extends Action { return ResourcesPlugin.getWorkspace().getRoot(); } - private void findFile(String[] includePaths, String name, ArrayList list) - throws CoreException { + private void findFile(String[] includePaths, String name, ArrayList list) { // in case it is an absolute path IPath includeFile= new Path(name); if (includeFile.isAbsolute()) { @@ -207,7 +204,7 @@ public class OpenIncludeAction extends Action { return; } } - HashSet foundSet = new HashSet(); + HashSet foundSet = new HashSet<>(); for (int i = 0; i < includePaths.length; i++) { IPath path = PathUtil.getCanonicalPath(new Path(includePaths[i]).append(includeFile)); File file = path.toFile(); @@ -233,7 +230,8 @@ public class OpenIncludeAction extends Action { private void findFile(IContainer parent, final IPath name, final ArrayList list) throws CoreException { parent.accept(new IResourceProxyVisitor() { - public boolean visit(IResourceProxy proxy) throws CoreException { + @Override + public boolean visit(IResourceProxy proxy) { if (proxy.getType() == IResource.FILE && proxy.getName().equalsIgnoreCase(name.lastSegment())) { IPath rPath = proxy.requestResource().getLocation(); int numSegToRemove = rPath.segmentCount() - name.segmentCount(); @@ -254,6 +252,7 @@ public class OpenIncludeAction extends Action { private IPath chooseFile(ArrayList filesFound) { ILabelProvider renderer= new LabelProvider() { + @Override public String getText(Object element) { if (element instanceof IPath) { IPath file= (IPath)element; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OverrideDefine.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OverrideDefine.java index 64b4c46b4c0..dfd77e17b59 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OverrideDefine.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OverrideDefine.java @@ -17,6 +17,7 @@ public class OverrideDefine extends DefineVariable { super(parent, name, value); } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.VARIABLE_OVERRIDE + " " + GNUMakefileConstants.VARIABLE_DEFINE); //$NON-NLS-1$ sb.append(getName()).append('\n'); @@ -25,6 +26,7 @@ public class OverrideDefine extends DefineVariable { return sb.toString(); } + @Override public boolean isOverride() { return true; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OverrideVariable.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OverrideVariable.java index d757cff56c4..84c78762809 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OverrideVariable.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OverrideVariable.java @@ -17,6 +17,7 @@ public class OverrideVariable extends GNUVariableDef { super(parent, name, value, type); } + @Override public boolean isOverride() { return true; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Parent.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Parent.java index da478d25c8d..378698c336e 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Parent.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Parent.java @@ -19,7 +19,7 @@ import java.util.Arrays; public abstract class Parent extends Directive implements IParent { - ArrayList children = new ArrayList(); + ArrayList children = new ArrayList<>(); public Parent(Directive parent) { super(parent); @@ -29,9 +29,10 @@ public abstract class Parent extends Directive implements IParent { return getDirectives(); } + @Override public IDirective[] getDirectives() { children.trimToSize(); - return (IDirective[]) children.toArray(new IDirective[0]); + return children.toArray(new IDirective[0]); } public void addDirective(Directive directive) { @@ -54,12 +55,10 @@ public abstract class Parent extends Directive implements IParent { public Directive[] getStatements() { children.trimToSize(); - return (Directive[]) children.toArray(new Directive[0]); + return children.toArray(new Directive[0]); } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer sb = new StringBuffer(); IDirective[] directives = getDirectives(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/PosixMakefileUtil.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/PosixMakefileUtil.java index c757f4ec816..5cb4991663b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/PosixMakefileUtil.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/PosixMakefileUtil.java @@ -23,7 +23,7 @@ public class PosixMakefileUtil { } public static String[] findTargets(String line) { - List aList = new ArrayList(); + List aList = new ArrayList<>(); int space; // Trim away trailing and prepending spaces. line = line.trim(); @@ -35,7 +35,7 @@ public class PosixMakefileUtil { if (line.length() > 0) { aList.add(line); } - return (String[]) aList.toArray(new String[0]); + return aList.toArray(new String[0]); } public static boolean isMacroDefinition(String line) { diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ProjectionMakefileUpdater.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ProjectionMakefileUpdater.java index d13b00bbc93..ef264e7eb70 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ProjectionMakefileUpdater.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ProjectionMakefileUpdater.java @@ -83,9 +83,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { private class ReconcilerParticipant implements IReconcilingParticipant { - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IReconcilingParticipant#reconciled() - */ + @Override public void reconciled() { processReconcile(); } @@ -105,9 +103,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { @SuppressWarnings("unused") private boolean fCollapseConditional = false; - /* - * @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionEnabled() - */ + @Override public void projectionEnabled() { // http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html // projectionEnabled messages are not always paired with projectionDisabled @@ -121,9 +117,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { fEditor.addReconcilingParticipant(fParticipant); } - /* - * @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionDisabled() - */ + @Override public void projectionDisabled() { fCachedDocument= null; if (fParticipant != null) { @@ -173,7 +167,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { } private Map computeAdditions(IParent parent) { - Map map= new HashMap(); + Map map= new HashMap<>(); computeAdditions(parent.getDirectives(), map); return map; } @@ -244,9 +238,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener { fCachedDocument= provider.getDocument(fEditor.getEditorInput()); fAllowCollapsing= false; - Map additions= new HashMap(); - List deletions= new ArrayList(); - List updates= new ArrayList(); + Map additions= new HashMap<>(); + List deletions= new ArrayList<>(); + List updates= new ArrayList<>(); Map updated= computeAdditions((IParent) fInput); Map> previous= createAnnotationMap(model); @@ -254,9 +248,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener { Iterator e= updated.keySet().iterator(); while (e.hasNext()) { - MakefileProjectionAnnotation annotation= (MakefileProjectionAnnotation) e.next(); + MakefileProjectionAnnotation annotation= e.next(); IDirective element= annotation.getElement(); - Position position= (Position) updated.get(annotation); + Position position= updated.get(annotation); List annotations= previous.get(element); if (annotations == null) { @@ -264,7 +258,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { } else { Iterator x= annotations.iterator(); while (x.hasNext()) { - MakefileProjectionAnnotation a= (MakefileProjectionAnnotation) x.next(); + MakefileProjectionAnnotation a= x.next(); if (annotation.isComment() == a.isComment()) { Position p= model.getPosition(a); if (p != null && !position.equals(p)) { @@ -309,19 +303,19 @@ public class ProjectionMakefileUpdater implements IProjectionListener { if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty())) return; - List newDeletions= new ArrayList(); - List newChanges= new ArrayList(); + List newDeletions= new ArrayList<>(); + List newChanges= new ArrayList<>(); Iterator deletionIterator= deletions.iterator(); outer: while (deletionIterator.hasNext()) { - MakefileProjectionAnnotation deleted= (MakefileProjectionAnnotation) deletionIterator.next(); + MakefileProjectionAnnotation deleted= deletionIterator.next(); Position deletedPosition= model.getPosition(deleted); if (deletedPosition == null) continue; Iterator changesIterator= changes.iterator(); while (changesIterator.hasNext()) { - MakefileProjectionAnnotation changed= (MakefileProjectionAnnotation) changesIterator.next(); + MakefileProjectionAnnotation changed= changesIterator.next(); if (deleted.isComment() == changed.isComment()) { Position changedPosition= model.getPosition(changed); if (changedPosition == null) @@ -345,9 +339,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener { Iterator additionsIterator= additions.keySet().iterator(); while (additionsIterator.hasNext()) { - MakefileProjectionAnnotation added= (MakefileProjectionAnnotation) additionsIterator.next(); + MakefileProjectionAnnotation added= additionsIterator.next(); if (deleted.isComment() == added.isComment()) { - Position addedPosition= (Position) additions.get(added); + Position addedPosition= additions.get(added); if (deletedPosition.getOffset() == addedPosition.getOffset()) { @@ -370,7 +364,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { } private Map> createAnnotationMap(IAnnotationModel model) { - Map> map= new HashMap>(); + Map> map= new HashMap<>(); @SuppressWarnings("rawtypes") Iterator e= model.getAnnotationIterator(); while (e.hasNext()) { @@ -379,7 +373,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { MakefileProjectionAnnotation directive= (MakefileProjectionAnnotation) annotation; List list= map.get(directive.getElement()); if (list == null) { - list= new ArrayList(2); + list= new ArrayList<>(2); map.put(directive.getElement(), list); } list.add(directive); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ResourceMarkerAnnotationModel.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ResourceMarkerAnnotationModel.java index 9f2513ccf5c..2f0f25dbab8 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ResourceMarkerAnnotationModel.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ResourceMarkerAnnotationModel.java @@ -45,6 +45,7 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel /* * @see IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) */ + @Override public void resourceChanged(IResourceChangeEvent e) { IResourceDelta delta= e.getDelta(); if (delta != null && fResource != null) { @@ -78,6 +79,7 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel /* * @see AbstractMarkerAnnotationModel#isAcceptable(IMarker) */ + @Override protected boolean isAcceptable(IMarker marker) { return marker != null && fResource.equals(marker.getResource()); } @@ -116,10 +118,9 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel * * @param markerDeltas the array of marker deltas */ - @SuppressWarnings("unchecked") private void batchedUpdate(IMarkerDelta[] markerDeltas) { - HashSet removedMarkers= new HashSet(markerDeltas.length); - HashSet modifiedMarkers= new HashSet(markerDeltas.length); + HashSet removedMarkers= new HashSet<>(markerDeltas.length); + HashSet modifiedMarkers= new HashSet<>(markerDeltas.length); for (int i= 0; i < markerDeltas.length; i++) { IMarkerDelta delta= markerDeltas[i]; @@ -139,7 +140,7 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel if (modifiedMarkers.isEmpty() && removedMarkers.isEmpty()) return; - Iterator e= getAnnotationIterator(false); + Iterator e= getAnnotationIterator(false); while (e.hasNext()) { Object o= e.next(); if (o instanceof MarkerAnnotation) { @@ -163,14 +164,12 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel } } - Iterator iter= modifiedMarkers.iterator(); + Iterator iter= modifiedMarkers.iterator(); while (iter.hasNext()) - addMarkerAnnotation((IMarker)iter.next()); + addMarkerAnnotation(iter.next()); } - /* - * @see AbstractMarkerAnnotationModel#listenToMarkerChanges(boolean) - */ + @Override protected void listenToMarkerChanges(boolean listen) { if (listen) fWorkspace.addResourceChangeListener(fResourceChangeListener); @@ -178,11 +177,10 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel fWorkspace.removeResourceChangeListener(fResourceChangeListener); } - /* - * @see AbstractMarkerAnnotationModel#deleteMarkers(IMarker[]) - */ + @Override protected void deleteMarkers(final IMarker[] markers) throws CoreException { fWorkspace.run(new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { for (int i= 0; i < markers.length; ++i) { markers[i].delete(); @@ -191,9 +189,7 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel }, null, IWorkspace.AVOID_UPDATE, null); } - /* - * @see AbstractMarkerAnnotationModel#retrieveMarkers() - */ + @Override protected IMarker[] retrieveMarkers() throws CoreException { return fResource.findMarkers(IMarker.MARKER, true, IResource.DEPTH_ZERO); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Rule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Rule.java index 5a22407a7d9..3ebf0b87f73 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Rule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Rule.java @@ -26,17 +26,19 @@ public abstract class Rule extends Parent implements IRule { addDirectives(cmds); } + @Override public ICommand[] getCommands() { IDirective[] directives = getDirectives(); - ArrayList cmds = new ArrayList(directives.length); + ArrayList cmds = new ArrayList<>(directives.length); for (int i = 0; i < directives.length; i++) { if (directives[i] instanceof ICommand) { cmds.add(directives[i]); } } - return (ICommand[])cmds.toArray(new ICommand[0]); + return cmds.toArray(new ICommand[0]); } + @Override public ITarget getTarget() { return target; } @@ -45,12 +47,14 @@ public abstract class Rule extends Parent implements IRule { target = tgt; } + @Override public boolean equals(Object r) { if (r instanceof Rule) return ((Rule)r).getTarget().equals(getTarget()); return false; } + @Override public int hashCode() { return getTarget().hashCode(); } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionList.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionList.java index a31b324d4dd..13e8c5aa5cc 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionList.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionList.java @@ -61,6 +61,7 @@ public class SelectionList extends Composite { fList= new Table(this, style); fList.setLayoutData(new GridData(GridData.FILL_BOTH)); fList.addDisposeListener(new DisposeListener() { + @Override public void widgetDisposed(DisposeEvent e) { fRenderer.dispose(); } @@ -75,6 +76,7 @@ public class SelectionList extends Composite { spec.verticalAlignment= GridData.BEGINNING; fText.setLayoutData(spec); Listener l= new Listener() { + @Override public void handleEvent(Event evt) { filter(false); } @@ -120,9 +122,9 @@ public class SelectionList extends Composite { */ public List getSelection() { if (fList == null || fList.isDisposed() || fList.getSelectionCount() == 0) - return new ArrayList(0); + return new ArrayList<>(0); int[] listSelection= fList.getSelectionIndices(); - List selected= new ArrayList(listSelection.length); + List selected= new ArrayList<>(listSelection.length); for (int i= 0; i < listSelection.length; i++) { selected.add(fElements[fFilteredElements[listSelection[i]]]); } @@ -182,9 +184,7 @@ public class SelectionList extends Composite { if (refilter) filter(true); } - /* - * Non Java-doc - */ + @Override public void setEnabled(boolean enable) { super.setEnabled(enable); fText.setEnabled(enable); @@ -198,15 +198,11 @@ public class SelectionList extends Composite { if (refilter) filter(true); } - /* - * Non Java-doc - */ + @Override public boolean setFocus() { return fText.setFocus(); } - /* - * Non Java-doc - */ + @Override public void setFont(Font font) { super.setFont(font); fText.setFont(font); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionStatusDialog.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionStatusDialog.java index d3054a57e04..f614da2fa7c 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionStatusDialog.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionStatusDialog.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake; import java.util.Arrays; import java.util.List; +import org.eclipse.core.runtime.IStatus; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; @@ -22,11 +23,8 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; - import org.eclipse.ui.dialogs.SelectionDialog; -import org.eclipse.core.runtime.IStatus; - /** * An abstract base class for dialogs with a status bar and ok/cancel buttons. * The status message must be passed over as StatusInfo object and can be @@ -49,6 +47,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog { /* (non-Javadoc) * Method declared in Window. */ + @Override protected void configureShell(Shell shell) { super.configureShell(shell); if (fImage != null) @@ -57,6 +56,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog { /* (non-Javadoc) * Method declared in Dialog. */ + @Override protected Control createButtonBar(Composite parent) { Composite composite= new Composite(parent, SWT.NULL); GridLayout layout= new GridLayout(); @@ -80,6 +80,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog { /* (non-Javadoc) * Method declared in Dialog. */ + @Override public void create() { super.create(); if (fLastStatus != null) { @@ -115,9 +116,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog { super(parent); fInitialSelectionSet= false; } - /* (non-Javadoc) - * Method declared in Dialog. - */ + @Override protected void okPressed() { computeResult(); super.okPressed(); @@ -150,6 +149,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog { setInitialSelections(new Object[0]); } } + @Override public void setInitialSelections(Object[] selectedElements) { super.setInitialSelections(selectedElements); fInitialSelectionSet= true; diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SpecialRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SpecialRule.java index 2d19bb2d5ee..b0b9005da2c 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SpecialRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SpecialRule.java @@ -22,10 +22,12 @@ public abstract class SpecialRule extends Rule implements ISpecialRule { prerequisites = reqs.clone(); } + @Override public String[] getPrerequisites() { return prerequisites.clone(); } + @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append(target).append(':'); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StaticTargetRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StaticTargetRule.java index c630122590b..d6827c32905 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StaticTargetRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StaticTargetRule.java @@ -44,9 +44,7 @@ public class StaticTargetRule extends InferenceRule implements IInferenceRule { targetPattern = target_pattern; } - /** - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getTarget()).append(':'); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusInfo.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusInfo.java index fd6a842cdf4..a594c5a9dcd 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusInfo.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusInfo.java @@ -11,9 +11,8 @@ *******************************************************************************/ package org.eclipse.cdt.internal.autotools.ui.editors.automake; -import org.eclipse.core.runtime.IStatus; - import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.core.runtime.IStatus; /** * A settable IStatus @@ -45,39 +44,27 @@ public class StatusInfo implements IStatus { fSeverity= severity; } - /** - * @see IStatus#getChildren() - */ + @Override public IStatus[] getChildren() { return new IStatus[0]; } - /** - * @see IStatus#getCode() - */ + @Override public int getCode() { return fSeverity; } - /** - * @see IStatus#getException() - */ + @Override public Throwable getException() { return null; } - /** - * @see IStatus#getMessage - */ + @Override public String getMessage() { return fStatusMessage; } - /** - * @see IStatus#getPlugin() - */ + @Override public String getPlugin() { return CUIPlugin.PLUGIN_ID; } - /** - * @see IStatus#getSeverity() - */ + @Override public int getSeverity() { return fSeverity; } @@ -87,21 +74,18 @@ public class StatusInfo implements IStatus { public boolean isInfo() { return fSeverity == IStatus.INFO; } - /** - * @see IStatus#isMultiStatus() - */ + @Override public boolean isMultiStatus() { return false; } + @Override public boolean isOK() { return fSeverity == IStatus.OK; } public boolean isWarning() { return fSeverity == IStatus.WARNING; } - /** - * @see IStatus#matches(int) - */ + @Override public boolean matches(int severityMask) { return (fSeverity & severityMask) != 0; } @@ -126,6 +110,7 @@ public class StatusInfo implements IStatus { * Returns a string representation of the status, suitable * for debugging purposes only. */ + @Override public String toString() { StringBuffer buf = new StringBuffer(); buf.append("StatusInfo "); //$NON-NLS-1$ diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StringMatcher.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StringMatcher.java index 68d31a43948..02fdaeaafcb 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StringMatcher.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StringMatcher.java @@ -101,6 +101,7 @@ public class StringMatcher { * specifying if case should be ignored * @deprecated Use StringMatcher(pattern, ignoreCase, ignoreWildCards). */ + @Deprecated public StringMatcher(String aPattern, boolean ignoreCase) { this(aPattern, ignoreCase, false); } @@ -248,7 +249,7 @@ public class StringMatcher { } } - Vector temp= new Vector(); + Vector temp= new Vector<>(); int pos= 0; StringBuffer buf= new StringBuffer(); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Target.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Target.java index 236a02fd023..30acadfbbe1 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Target.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Target.java @@ -20,6 +20,7 @@ public class Target implements ITarget { target = t; } + @Override public String toString() { return target; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetRule.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetRule.java index 1bdea41fa41..2f184bbc38b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetRule.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetRule.java @@ -43,13 +43,12 @@ public class TargetRule extends Rule implements ITargetRule { prerequisites = reqs.clone(); } + @Override public String[] getPrerequisites() { return prerequisites.clone(); } - /** - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getTarget().toString()); diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetVariable.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetVariable.java index 558e2f08a7a..a01d19411d0 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetVariable.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetVariable.java @@ -26,6 +26,7 @@ public class TargetVariable extends GNUVariableDef { this.override = override; } + @Override public boolean isOverride() { return override; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Terminal.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Terminal.java index f57259d1163..8df03a19b1e 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Terminal.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Terminal.java @@ -16,14 +16,17 @@ public abstract class Terminal extends Directive implements ITerminal { super(parent); } + @Override public boolean isEndif() { return false; } + @Override public boolean isEndef() { return false; } + @Override public String toString() { return "\n"; //$NON-NLS-1$ } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/UnExport.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/UnExport.java index 6464c39f8ad..a8d87e40794 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/UnExport.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/UnExport.java @@ -19,12 +19,14 @@ public class UnExport extends Directive implements IUnExport { variable = var; } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.DIRECTIVE_UNEXPORT); sb.append(' ').append(variable); return sb.toString(); } + @Override public String getVariable() { return variable; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/VPath.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/VPath.java index 965c3e3e874..2aa1b4e9822 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/VPath.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/VPath.java @@ -21,6 +21,7 @@ public class VPath extends Directive implements IVPath { directories = dirs.clone(); } + @Override public String toString() { StringBuffer sb = new StringBuffer(GNUMakefileConstants.DIRECTIVE_VPATH); if (pattern != null && pattern.length() > 0) { @@ -32,10 +33,12 @@ public class VPath extends Directive implements IVPath { return sb.toString(); } + @Override public String[] getDirectories() { return directories.clone(); } + @Override public String getPattern() { return pattern; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/VariableDefinition.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/VariableDefinition.java index a43106e5861..213e189eb2b 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/VariableDefinition.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/VariableDefinition.java @@ -41,9 +41,7 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi this.type = type; } - /** - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer sb = new StringBuffer(); if (isTargetSpecific()) { @@ -79,31 +77,38 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi return sb.toString(); } + @Override public boolean isRecursivelyExpanded() { return type == TYPE_RECURSIVE_EXPAND; } + @Override public boolean isSimplyExpanded() { return type == TYPE_SIMPLE_EXPAND; } + @Override public boolean isConditional() { return type == TYPE_CONDITIONAL; } + @Override public boolean isAppend() { return type == TYPE_APPEND; } + @Override public boolean isTargetSpecific() { String t = getTarget(); return t != null && t.length() > 0; } + @Override public boolean isExport() { return false; } + @Override public boolean isMultiLine() { return false; } @@ -111,6 +116,7 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi /** * Variable from an `override' directive. */ + @Override public boolean isOverride() { return false; } @@ -118,10 +124,12 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi /** * Automatic variable -- cannot be set. */ + @Override public boolean isAutomatic() { return false; } + @Override public String getTarget() { return varTarget; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WordPartDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WordPartDetector.java index 156fc5e7fb9..b88905671d2 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WordPartDetector.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WordPartDetector.java @@ -82,9 +82,7 @@ public class WordPartDetector { } - /** - * @return String - */ + @Override public String toString() { return wordPart; } diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WorkingCopyManager.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WorkingCopyManager.java index 8a0a11d4323..2ea5cbb4d52 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WorkingCopyManager.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WorkingCopyManager.java @@ -41,23 +41,17 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana fDocumentProvider= provider; } - /* - * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput) - */ + @Override public void connect(IEditorInput input) throws CoreException { fDocumentProvider.connect(input); } - /* - * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput) - */ + @Override public void disconnect(IEditorInput input) { fDocumentProvider.disconnect(input); } - /* - * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#shutdown() - */ + @Override public void shutdown() { if (!fIsShuttingDown) { fIsShuttingDown= true; @@ -73,28 +67,22 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana } } - /* - * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput) - */ + @Override public IMakefile getWorkingCopy(IEditorInput input) { IMakefile unit= fMap == null ? null : (IMakefile) fMap.get(input); return unit != null ? unit : fDocumentProvider.getWorkingCopy(input); } - /* - * @see org.eclipse.cdt.make.ui.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.cdt.make.core.makefile.IMakefile) - */ + @Override public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) { if (fDocumentProvider.getDocument(input) != null) { if (fMap == null) - fMap= new HashMap(); + fMap= new HashMap<>(); fMap.put(input, workingCopy); } } - /* - * @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput) - */ + @Override public void removeWorkingCopy(IEditorInput input) { fMap.remove(input); if (fMap.isEmpty()) diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AbstractEditorPreferencePage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AbstractEditorPreferencePage.java index 6a1de86d4a4..470a8c85700 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AbstractEditorPreferencePage.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AbstractEditorPreferencePage.java @@ -51,26 +51,30 @@ import org.osgi.service.prefs.BackingStoreException; public abstract class AbstractEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { OverlayPreferenceStore fOverlayStore; - Map fCheckBoxes= new HashMap(); + Map fCheckBoxes= new HashMap<>(); private SelectionListener fCheckBoxListener= new SelectionListener() { + @Override public void widgetDefaultSelected(SelectionEvent e) { } + @Override public void widgetSelected(SelectionEvent e) { Button button= (Button) e.widget; - fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection()); + fOverlayStore.setValue(fCheckBoxes.get(button), button.getSelection()); } }; - Map fTextFields= new HashMap(); + Map fTextFields= new HashMap<>(); private ModifyListener fTextFieldListener= new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { Text text= (Text) e.widget; - fOverlayStore.setValue((String) fTextFields.get(text), text.getText()); + fOverlayStore.setValue(fTextFields.get(text), text.getText()); } }; - private Map fNumberFields= new HashMap(); + private Map fNumberFields= new HashMap<>(); private ModifyListener fNumberFieldListener= new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { numberFieldChanged((Text) e.widget); } @@ -87,6 +91,7 @@ public abstract class AbstractEditorPreferencePage extends PreferencePage implem /* (non-Javadoc) * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) */ + @Override public void init(IWorkbench workbench) { } @@ -95,15 +100,15 @@ public abstract class AbstractEditorPreferencePage extends PreferencePage implem Map textFields= getTextFields(); Iterator