Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 16:20:42 +0000
committerJonah Graham2018-11-22 21:47:02 +0000
commit170e654b4796bad1453ae85a427b97317d67a69a (patch)
tree6ca9b8a8fedd5fd25f97eb79c408312e256ff981 /build/org.eclipse.cdt.autotools.ui/src/org
parent35996a5c5ca5c254959ba48241eaada6dbf8628d (diff)
downloadorg.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.gz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.xz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.zip
Bug 540373: Cleanup: Format & Remove trailing whitespace
This was done by selecting all projects in Eclipse then Source -> Clean Up... -> choosing: - Format source code - Remove trailing white spaces on all lines and completing the wizard Change-Id: I63685372c6bcc67719bcf145123bcb72e5b00394
Diffstat (limited to 'build/org.eclipse.cdt.autotools.ui/src/org')
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/AutotoolsUIPlugin.java10
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AcInitElement.java17
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfAnnotationHover.java100
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfCodeScanner.java161
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentProvider.java6
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfDocumentSetupParticipant.java15
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditor.java886
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMacroValidator.java34
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMessages.java49
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfErrorHandler.java28
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfIdentifierRule.java8
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfKeywordDetector.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacro.java8
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroCodeScanner.java169
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroContentAssistProcessor.java23
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroDamagerRepairer.java5
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroParameterListValidator.java181
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroPartitionRule.java48
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroProposalContextInformation.java30
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroRule.java11
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacroWordDetector.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPKGWordDetector.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitionScanner.java18
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfPartitioner.java26
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfReconcilingStrategy.java15
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfSourceViewerConfiguration.java28
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/IAutotoolsEditor.java5
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/InlineDataRule.java29
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/MultilineRuleDamagerRepairer.java5
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/ParseException.java13
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RecursiveSingleLineRule.java28
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/RestrictedEndOfLineRule.java20
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentOutlinePage.java31
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfContentProvider.java30
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/outline/AutoconfLabelProvider.java9
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseConditionElement.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseElement.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElement.java38
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElifElement.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElseElement.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfForElement.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfIfElement.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroArgumentElement.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroDetector.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfMacroElement.java10
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfOutlineErrorHandler.java41
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfParser.java498
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfRootElement.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfSelectElement.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfTokenizer.java99
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfUntilElement.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfWhileElement.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfErrorHandler.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroDetector.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroValidator.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IMacroDetector.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ITokenConstants.java13
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/InvalidMacroException.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ParseException.java20
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/Token.java10
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AbstractAutotoolsCPropertyTab.java5
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AutotoolsConsole.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AutotoolsUIPluginImages.java82
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CBuildStepsConsole.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CConfigureConsole.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CWordFinder.java63
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/Console.java11
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ConsoleMessages.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ErrorParserBlock.java12
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/FileRelevance.java22
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTML2TextReader.java172
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java58
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLTextPresenter.java164
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LineBreakingReader.java65
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LocationAdapter.java19
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIImages.java18
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIMessages.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MessageLine.java22
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/OptionalMessageDialog.java75
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java51
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookupTree.java479
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SingleCharReader.java28
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/SubstitutionTextReader.java83
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AbstractAutotoolsHandler.java22
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/AutomakeHandler.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeMessages.java11
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/SingleInputDialog.java10
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/TwoInputDialog.java18
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/ContainsFilter.java56
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/LexicalSortingAction.java61
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/autoconf/ProjectionFileUpdater.java255
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractElementListSelectionDialog.java142
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefile.java144
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AbstractMakefileCodeScanner.java99
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutoconfSubstRule.java32
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeCompletionProcessor.java286
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeConfigMacro.java8
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeDocumentProvider.java39
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java49
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditorFactory.java12
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeErrorHandler.java27
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeIfElse.java5
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroDefinitionRule.java147
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeMacroReferenceRule.java12
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeTextHover.java42
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeWordDetector.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Automakefile.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileCodeScanner.java55
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileContentOutlinePage.java32
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileReconcilingStrategy.java32
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileSourceConfiguration.java37
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileUtil.java7
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Command.java8
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Comment.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/CompletionProposalComparator.java5
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Conditional.java17
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/DefineVariable.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Directive.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/EditorUtility.java116
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ElementListSelectionDialog.java51
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Else.java16
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endef.java7
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endif.java9
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInput.java20
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ExternalEditorInputFactory.java42
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUAutomakefile.java78
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileConstants.java53
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileUtil.java63
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUTargetRule.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUVariableDef.java8
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IAutomakeConditional.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IMakefileEditorActionDefinitionIds.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IReconcilingParticipant.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/If.java22
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifdef.java5
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifeq.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifndef.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Ifneq.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Include.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinition.java6
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroDefinitionRule.java77
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MacroReferenceRule.java10
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakeFileConstants.java15
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileAnnotationHover.java87
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCodeScanner.java30
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileCompletionProcessor.java46
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileContentOutlinePage.java22
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentProvider.java63
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileDocumentSetupParticipant.java19
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditor.java94
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorActionContributor.java18
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorPreferenceConstants.java17
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorTogglePresentationAction.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileMessages.java33
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefilePartitionScanner.java12
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReader.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileReconcilingStrategy.java30
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileSourceConfiguration.java34
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileStorageDocumentProvider.java9
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileTextHover.java9
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MessageLine.java43
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/NullMakefile.java10
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenDeclarationAction.java7
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OpenIncludeAction.java101
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/OverrideDefine.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Parent.java2
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/PosixMakefileUtil.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ProjectionMakefileUpdater.java241
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/ResourceMarkerAnnotationModel.java75
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Rule.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionList.java105
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/SelectionStatusDialog.java66
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StaticTargetRule.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusInfo.java45
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusTool.java18
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StringMatcher.java228
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetRule.java6
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TargetVariable.java3
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TwoArrayQuickSort.java69
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Util.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/VariableDefinition.java8
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WordPartDetector.java19
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/WorkingCopyManager.java28
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AbstractEditorPreferencePage.java215
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutoconfEditorPreferencePage.java356
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutomakeEditorPreferencePage.java280
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsEditorPreferenceConstants.java25
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencePage.java1
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencesMessages.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorEditor.java58
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorManager.java12
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/OverlayPreferenceStore.java162
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/StatusInfo.java21
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/TabFolderLayout.java36
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AbstractConfigurePropertyOptionsPage.java28
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java76
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsCategoryPropertyOptionPage.java62
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePrefStore.java60
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyPage.java11
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyTab.java110
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsEditorPropertyTab.java74
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsGeneralPropertyPage.java6
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsHeadPropertyPage.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyManager.java14
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyMessages.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolPropertyOptionPage.java29
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolsPropertyTab.java134
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IProjectPropertyListener.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IPropertyChangeManager.java12
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListContentProvider.java13
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListElement.java18
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListLabelProvider.java47
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfPrototype.java27
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java87
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/HoverMessages.java33
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java10
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizardHandler.java7
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizard.java45
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizardPage.java59
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsWizardMessages.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/CProjectPlatformPage.java73
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationContentProvider.java7
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java16
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizard.java85
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizardPage.java132
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ManagedProjectOptionBlock.java24
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/NewAutotoolsProjectOptionPage.java38
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ReferenceBlock.java29
228 files changed, 5342 insertions, 5391 deletions
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 18999540a27..ce66521c174 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
@@ -39,9 +39,9 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
// The shared instance
private static AutotoolsUIPlugin plugin;
-
+
private ResourceBundle resourceBundle;
-
+
/**
* The constructor.
*/
@@ -59,7 +59,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
public static String getPluginId() {
return PLUGIN_ID;
}
-
+
public static String getUniqueIdentifier() {
if (getDefault() == null) {
// If the default instance is not yet initialized,
@@ -89,7 +89,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
/**
* Returns the string from the plugin's resource bundle,
* or 'key' if not found.
- *
+ *
* @param key the message key
* @return the resource bundle message
*/
@@ -146,7 +146,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
* Returns the active workbench page or <code>null</code> if none.
*/
public static IWorkbenchPage getActivePage() {
- IWorkbenchWindow window= getActiveWorkbenchWindow();
+ IWorkbenchWindow window = getActiveWorkbenchWindow();
if (window != null) {
return window.getActivePage();
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AcInitElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AcInitElement.java
index c0cdfb6bafa..1447e6b1727 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AcInitElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AcInitElement.java
@@ -23,7 +23,7 @@ import org.eclipse.cdt.internal.autotools.core.VersionComparator;
public class AcInitElement extends AutoconfMacroElement {
private static final String BAD_VERSION_NUMBER = "AC_INIT_badVersionNumber";
-
+
public AcInitElement(String name) {
super(name);
}
@@ -31,15 +31,14 @@ public class AcInitElement extends AutoconfMacroElement {
@Override
public void validate(String version) throws InvalidMacroException {
super.validate(version);
-
+
if (this.getChildren().length == 0)
return;
-
- if (VersionComparator.compare(version,
- AutotoolsPropertyConstants.AC_VERSION_2_59) >= 0){
+
+ if (VersionComparator.compare(version, AutotoolsPropertyConstants.AC_VERSION_2_59) >= 0) {
if (this.getChildren().length < 2)
return;
-
+
// autoconf 2.67 onwards allows a more relaxed VERSION string format,
// so only validate arguments for earlier versions
if (VersionComparator.compare(version, AutotoolsPropertyConstants.AC_VERSION_2_67) < 0)
@@ -48,8 +47,8 @@ public class AcInitElement extends AutoconfMacroElement {
return;
}
-
- private void validateMultipleArguments () throws InvalidMacroException{
+
+ private void validateMultipleArguments() throws InvalidMacroException {
// There are no restrictions on the first argument.
@@ -57,7 +56,7 @@ public class AcInitElement extends AutoconfMacroElement {
AutoconfElement argument = this.getChildren()[1];
// match a digit followed by a dot zero or more times
// but always end with a digit
- if (!argument.getName().matches("(\\d*\\.)*((\\d+))")){
+ if (!argument.getName().matches("(\\d*\\.)*((\\d+))")) {
throw new InvalidMacroException(AutoconfEditorMessages.getString(BAD_VERSION_NUMBER), argument);
}
}
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 b54aba76dd7..583757b42f5 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
@@ -34,17 +34,16 @@ import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.LineRange;
import org.eclipse.swt.widgets.Shell;
-
public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHoverExtension {
-
+
/**
* Returns the distance to the ruler line.
*/
protected int compareRulerLine(Position position, IDocument document, int line) {
-
+
if (position.getOffset() > -1 && position.getLength() > -1) {
try {
- int markerLine= document.getLineOfOffset(position.getOffset());
+ int markerLine = document.getLineOfOffset(position.getOffset());
if (line == markerLine)
return 1;
if (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()))
@@ -52,10 +51,10 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
} catch (BadLocationException x) {
}
}
-
+
return 0;
}
-
+
/**
* Selects a set of markers from the two lists. By default, it just returns
* the set of exact matches.
@@ -68,32 +67,32 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
* Returns one marker which includes the ruler's line of activity.
*/
protected List<Annotation> getAnnotationsForLine(ISourceViewer viewer, int line) {
-
- IDocument document= viewer.getDocument();
- IAnnotationModel model= viewer.getAnnotationModel();
-
+
+ IDocument document = viewer.getDocument();
+ IAnnotationModel model = viewer.getAnnotationModel();
+
if (model == null)
return null;
-
- List<Annotation> exact= new ArrayList<>();
- List<Annotation> including= new ArrayList<>();
-
+
+ List<Annotation> exact = new ArrayList<>();
+ List<Annotation> including = new ArrayList<>();
+
Iterator<?> e = model.getAnnotationIterator();
while (e.hasNext()) {
- Object o= e.next();
+ Object o = e.next();
if (o instanceof Annotation) {
- Annotation a= (Annotation) o;
+ Annotation a = (Annotation) o;
switch (compareRulerLine(model.getPosition(a), document, line)) {
- case 1:
- exact.add(a);
- break;
- case 2:
- including.add(a);
- break;
+ case 1:
+ exact.add(a);
+ break;
+ case 2:
+ including.add(a);
+ break;
}
}
}
-
+
return select(exact, including);
}
@@ -101,73 +100,72 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
List<Annotation> annotations = getAnnotationsForLine(sourceViewer, lineNumber);
if (annotations != null && annotations.size() > 0) {
-
+
if (annotations.size() == 1) {
-
+
// optimization
Annotation annotation = annotations.get(0);
- String message= annotation.getText();
+ String message = annotation.getText();
if (message != null && message.trim().length() > 0)
return formatSingleMessage(message);
-
+
} else {
-
- List<String> messages= new ArrayList<>();
-
- Iterator<Annotation> e= annotations.iterator();
+
+ List<String> messages = new ArrayList<>();
+
+ Iterator<Annotation> e = annotations.iterator();
while (e.hasNext()) {
Annotation annotation = e.next();
- String message= annotation.getText();
+ String message = annotation.getText();
if (message != null && message.trim().length() > 0)
messages.add(message.trim());
}
-
+
if (messages.size() == 1)
return formatSingleMessage(messages.get(0));
-
+
if (messages.size() > 1)
return formatMultipleMessages(messages);
}
}
-
+
return null;
}
-
-
+
/*
* Formats a message as HTML text.
*/
private String formatSingleMessage(String message) {
- StringBuilder buffer= new StringBuilder();
+ StringBuilder buffer = new StringBuilder();
HTMLPrinter.addPageProlog(buffer);
HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(message));
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
-
+
/*
* Formats several message as HTML text.
*/
private String formatMultipleMessages(List<String> messages) {
- StringBuilder buffer= new StringBuilder();
+ StringBuilder buffer = new StringBuilder();
HTMLPrinter.addPageProlog(buffer);
- HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(AutoconfEditorMessages.getString("AutoconfAnnotationHover.multipleMarkers"))); //$NON-NLS-1$
-
+ HTMLPrinter.addParagraph(buffer, HTMLPrinter
+ .convertToHTMLContent(AutoconfEditorMessages.getString("AutoconfAnnotationHover.multipleMarkers"))); //$NON-NLS-1$
+
HTMLPrinter.startBulletList(buffer);
- Iterator<String> e= messages.iterator();
+ Iterator<String> e = messages.iterator();
while (e.hasNext())
HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent(e.next()));
- HTMLPrinter.endBulletList(buffer);
-
+ HTMLPrinter.endBulletList(buffer);
+
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
-
+
// IAnnotationHoverExtension members
// We need to use the extension to get a Hover Control Creator which
// handles html.
-
-
+
@Override
public IInformationControlCreator getHoverControlCreator() {
return new IInformationControlCreator() {
@@ -177,17 +175,17 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
}
};
}
-
+
@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 67e490ce05b..a6014b48cab 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,15 +38,14 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
-
public class AutoconfCodeScanner extends RuleBasedScanner {
- private Map<String, IToken> fTokenMap= new HashMap<>();
+ private Map<String, IToken> fTokenMap = new HashMap<>();
private String[] fPropertyNamesColor;
-
+
/**
* Preference keys for boolean preferences which are <code>true</code>,
- * iff the corresponding token should be rendered bold.
+ * iff the corresponding token should be rendered bold.
*/
private String[] fPropertyNamesBold;
/**
@@ -55,49 +54,42 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
*/
private String[] fPropertyNamesItalic;
- private static String[] keywords = {
- "case", "do", "done", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "esac", "if", "elif", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "else", "fi", "for", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "in", "then" }; //$NON-NLS-1$ //$NON-NLS-2$
-
- static final String[] fTokenProperties = new String[] {
- ColorManager.AUTOCONF_COMMENT_COLOR,
- ColorManager.AUTOCONF_KEYWORD_COLOR,
- ColorManager.AUTOCONF_ACMACRO_COLOR,
- ColorManager.AUTOCONF_AMMACRO_COLOR,
- ColorManager.AUTOCONF_VAR_REF_COLOR,
- ColorManager.AUTOCONF_VAR_SET_COLOR,
- ColorManager.AUTOCONF_CODESEQ_COLOR,
- ColorManager.AUTOCONF_DEFAULT_COLOR,
- };
+ private static String[] keywords = { "case", "do", "done", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "esac", "if", "elif", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "else", "fi", "for", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "in", "then" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+ static final String[] fTokenProperties = new String[] { ColorManager.AUTOCONF_COMMENT_COLOR,
+ ColorManager.AUTOCONF_KEYWORD_COLOR, ColorManager.AUTOCONF_ACMACRO_COLOR,
+ ColorManager.AUTOCONF_AMMACRO_COLOR, ColorManager.AUTOCONF_VAR_REF_COLOR,
+ ColorManager.AUTOCONF_VAR_SET_COLOR, ColorManager.AUTOCONF_CODESEQ_COLOR,
+ ColorManager.AUTOCONF_DEFAULT_COLOR, };
public AutoconfCodeScanner() {
-
+
initialize();
-
- IToken other= getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
+
+ IToken other = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
IToken keyword = getToken(ColorManager.AUTOCONF_KEYWORD_COLOR);
- IToken comment= getToken(ColorManager.AUTOCONF_COMMENT_COLOR);
+ IToken comment = getToken(ColorManager.AUTOCONF_COMMENT_COLOR);
IToken string = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
IToken varRef = getToken(ColorManager.AUTOCONF_VAR_REF_COLOR);
IToken acmacro = getToken(ColorManager.AUTOCONF_ACMACRO_COLOR);
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR);
-
- List<IRule> rules= new ArrayList<>();
+
+ List<IRule> rules = new ArrayList<>();
// Add rule for single line comments.
rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$
rules.add(new EndOfLineRule("#", comment, '\\')); //$NON-NLS-1$
-
+
// Add special recursive rule for strings which allows variable
// references to be internally tokenized.
- RecursiveSingleLineRule stringRule =
- new RecursiveSingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$
+ RecursiveSingleLineRule stringRule = new RecursiveSingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$
stringRule.addRule(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
rules.add(stringRule);
-
+
// Add rule for variable references
rules.add(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
// Add rule for strings
@@ -114,31 +106,31 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
// Add rule for m4_ macros
rules.add(new AutoconfMacroRule("m4_", new AutoconfM4WordDetector(), acmacro)); //$NON-NLS-1$
-
+
// Add rule for code sequences starting with <<EOF and ending with EOF
rules.add(new InlineDataRule(code));
-
+
// Add word rule for keywords.
- WordRule wordRule= new WordRule(new AutoconfWordDetector(), Token.UNDEFINED);
- for (int i= 0; i < keywords.length; i++)
+ WordRule wordRule = new WordRule(new AutoconfWordDetector(), Token.UNDEFINED);
+ for (int i = 0; i < keywords.length; i++)
wordRule.addWord(keywords[i], keyword);
rules.add(wordRule);
-
+
// Add word rule for identifier.
rules.add(new AutoconfIdentifierRule(other));
-
+
// Make sure we don't treat "\#" as comment start.
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
-
+
rules.add(new WhitespaceRule(new AutoconfWhitespaceDetector()));
-
+
setDefaultReturnToken(other);
- IRule[] result= new IRule[rules.size()];
+ IRule[] result = new IRule[rules.size()];
rules.toArray(result);
setRules(result);
}
-
+
protected Token getToken(String key) {
return (Token) fTokenMap.get(key);
}
@@ -150,26 +142,27 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
protected String[] getTokenProperties() {
return fTokenProperties;
}
-
+
private int indexOf(String property) {
if (property != null) {
- int length= fPropertyNamesColor.length;
- for (int i= 0; i < length; i++) {
- if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i]) || property.equals(fPropertyNamesItalic[i]))
+ int length = fPropertyNamesColor.length;
+ for (int i = 0; i < length; i++) {
+ if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i])
+ || property.equals(fPropertyNamesItalic[i]))
return i;
}
}
return -1;
}
-
+
public boolean affectsBehavior(PropertyChangeEvent event) {
return indexOf(event.getProperty()) >= 0;
}
-
+
public void adaptToPreferenceChange(PropertyChangeEvent event) {
- String p= event.getProperty();
- int index= indexOf(p);
- Token token= getToken(fPropertyNamesColor[index]);
+ String p = event.getProperty();
+ int index = indexOf(p);
+ Token token = getToken(fPropertyNamesColor[index]);
if (fPropertyNamesColor[index].equals(p))
adaptToColorChange(event, token);
else if (fPropertyNamesBold[index].equals(p))
@@ -179,72 +172,74 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
}
protected void adaptToColorChange(PropertyChangeEvent event, Token token) {
- RGB rgb= null;
- Object value= event.getNewValue();
+ RGB rgb = null;
+ Object value = event.getNewValue();
if (value instanceof RGB) {
- rgb= (RGB) value;
+ rgb = (RGB) value;
} else if (value instanceof String) {
- rgb= StringConverter.asRGB((String) value);
+ rgb = StringConverter.asRGB((String) value);
}
-
+
if (rgb != null) {
- TextAttribute attr= (TextAttribute) token.getData();
- token.setData(new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
+ TextAttribute attr = (TextAttribute) token.getData();
+ token.setData(
+ new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
}
}
protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) {
- if (token == null) {
+ if (token == null) {
return;
}
- boolean eventValue= false;
- Object value= event.getNewValue();
+ boolean eventValue = false;
+ Object value = event.getNewValue();
if (value instanceof Boolean) {
- eventValue= ((Boolean) value).booleanValue();
+ eventValue = ((Boolean) value).booleanValue();
} else if (IPreferenceStore.TRUE.equals(value)) {
- eventValue= true;
+ eventValue = true;
}
-
- TextAttribute attr= (TextAttribute) token.getData();
- boolean activeValue= (attr.getStyle() & styleAttribute) == styleAttribute;
- if (activeValue != eventValue) {
- token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(), eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
+
+ TextAttribute attr = (TextAttribute) token.getData();
+ boolean activeValue = (attr.getStyle() & styleAttribute) == styleAttribute;
+ if (activeValue != eventValue) {
+ token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(),
+ eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
}
}
protected TextAttribute createTextAttribute(String colorID, String boldKey, String italicKey) {
- Color color= null;
+ Color color = null;
if (colorID != null) {
- color= AutoconfEditor.getPreferenceColor(colorID);
+ color = AutoconfEditor.getPreferenceColor(colorID);
}
- IPreferenceStore store= AutotoolsPlugin.getDefault().getPreferenceStore();
- int style= store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
+ IPreferenceStore store = AutotoolsPlugin.getDefault().getPreferenceStore();
+ int style = store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
if (store.getBoolean(italicKey)) {
style |= SWT.ITALIC;
- }
+ }
return new TextAttribute(color, null, style);
}
-
+
/**
* Must be called after the constructor has been called.
*/
public final void initialize() {
-
- fPropertyNamesColor= getTokenProperties();
- int length= fPropertyNamesColor.length;
- fPropertyNamesBold= new String[length];
- fPropertyNamesItalic= new String[length];
-
- for (int i= 0; i < length; i++) {
- fPropertyNamesBold[i]= fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
- fPropertyNamesItalic[i]= fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
+
+ fPropertyNamesColor = getTokenProperties();
+ int length = fPropertyNamesColor.length;
+ fPropertyNamesBold = new String[length];
+ fPropertyNamesItalic = new String[length];
+
+ for (int i = 0; i < length; i++) {
+ fPropertyNamesBold[i] = fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
+ fPropertyNamesItalic[i] = fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]);
}
}
@Override
public void unread() {
- --fOffset;
- fColumn = UNDEFINED;
+ --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 ca2a7f42de3..35e381ac99b 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
@@ -19,16 +19,16 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
public class AutoconfDocumentProvider extends TextFileDocumentProvider {
-
+
public void shutdown() {
Iterator<?> e = getConnectedElementsIterator();
while (e.hasNext())
disconnect(e.next());
}
-
+
@Override
public IDocument getDocument(Object element) {
- FileInfo info= 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 df50360fb69..84711d32f6b 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,30 +19,27 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.IDocumentListener;
-public class AutoconfDocumentSetupParticipant implements
- IDocumentSetupParticipant, IDocumentListener {
+public class AutoconfDocumentSetupParticipant implements IDocumentSetupParticipant, IDocumentListener {
@Override
public void setup(IDocument document) {
- AutoconfPartitioner partitioner =
- new AutoconfPartitioner(
- new AutoconfPartitionScanner(),
+ AutoconfPartitioner partitioner = new AutoconfPartitioner(new AutoconfPartitionScanner(),
AutoconfPartitionScanner.AUTOCONF_PARTITION_TYPES);
partitioner.connect(document, 1);
if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
+ IDocumentExtension3 extension3 = (IDocumentExtension3) document;
extension3.setDocumentPartitioner(AutoconfEditor.AUTOCONF_PARTITIONING, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
-// document.addDocumentListener(this);
+ // document.addDocumentListener(this);
}
-
+
@Override
public void documentAboutToBeChanged(DocumentEvent e) {
// do nothing
}
-
+
@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 63f3b156749..a29f9dc76a0 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
@@ -86,28 +86,26 @@ import org.eclipse.ui.texteditor.TextEditorAction;
import org.eclipse.ui.texteditor.TextOperationAction;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IProjectPropertyListener {
- public final static String AUTOCONF_PARTITIONING= "autoconf_partitioning"; //$NON-NLS-1$
-
-
- private AutoconfPartitionScanner fPartitionScanner;
- private RuleBasedScanner fCodeScanner;
- private RuleBasedScanner fMacroCodeScanner;
- private static volatile AutoconfDocumentProvider fDocumentProvider;
- private AutoconfElement rootElement;
- private AutoconfContentOutlinePage outlinePage;
- private AutoconfParser fParser;
- private IEditorInput input;
- private IProject fProject;
-
- /** The information provider used to present focusable information shells. */
- private InformationPresenter fInformationPresenter;
- /**
- * This editor's projection support
+ public final static String AUTOCONF_PARTITIONING = "autoconf_partitioning"; //$NON-NLS-1$
+
+ private AutoconfPartitionScanner fPartitionScanner;
+ private RuleBasedScanner fCodeScanner;
+ private RuleBasedScanner fMacroCodeScanner;
+ private static volatile AutoconfDocumentProvider fDocumentProvider;
+ private AutoconfElement rootElement;
+ private AutoconfContentOutlinePage outlinePage;
+ private AutoconfParser fParser;
+ private IEditorInput input;
+ private IProject fProject;
+
+ /** The information provider used to present focusable information shells. */
+ private InformationPresenter fInformationPresenter;
+ /**
+ * This editor's projection support
*/
-
+
ProjectionSupport fProjectionSupport;
ProjectionFileUpdater fProjectionFileUpdater;
@@ -116,74 +114,69 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
*/
private ListenerList<IReconcilingParticipant> fReconcilingListeners = new ListenerList<>(ListenerList.IDENTITY);
+ public AutoconfEditor() {
+ super();
+ }
- public AutoconfEditor() {
- super();
- }
-
- @Override
+ @Override
protected void initializeEditor() {
- super.initializeEditor();
- setDocumentProvider(getAutoconfDocumentProvider());
+ super.initializeEditor();
+ setDocumentProvider(getAutoconfDocumentProvider());
IPreferenceStore[] stores = new IPreferenceStore[2];
stores[0] = AutotoolsPlugin.getDefault().getPreferenceStore();
stores[1] = EditorsUI.getPreferenceStore();
ChainedPreferenceStore chainedStore = new ChainedPreferenceStore(stores);
- setPreferenceStore(chainedStore);
+ setPreferenceStore(chainedStore);
setSourceViewerConfiguration(new AutoconfSourceViewerConfiguration(chainedStore, this));
AutotoolsEditorPreferenceConstants.initializeDefaultValues(stores[0]);
- AutoconfEditorPreferencePage.initDefaults(stores[0]);
- }
-
- public static AutoconfDocumentProvider getAutoconfDocumentProvider() {
- if (fDocumentProvider == null)
- fDocumentProvider= new AutoconfDocumentProvider();
- return fDocumentProvider;
- }
-
- public AutoconfElement getRootElement() {
- return rootElement;
- }
-
- public void setRootElement(AutoconfElement element) {
- rootElement = element;
- }
-
- public ISourceViewer getViewer() {
- return getSourceViewer();
- }
-
+ AutoconfEditorPreferencePage.initDefaults(stores[0]);
+ }
+
+ public static AutoconfDocumentProvider getAutoconfDocumentProvider() {
+ if (fDocumentProvider == null)
+ fDocumentProvider = new AutoconfDocumentProvider();
+ return fDocumentProvider;
+ }
+
+ public AutoconfElement getRootElement() {
+ return rootElement;
+ }
+
+ public void setRootElement(AutoconfElement element) {
+ rootElement = element;
+ }
+
+ public ISourceViewer getViewer() {
+ return getSourceViewer();
+ }
+
protected IDocument getInputDocument() {
return getDocumentProvider().getDocument(input);
}
- @Override
- protected void doSetInput(IEditorInput newInput) throws CoreException
- {
- // If this editor is for a project file, remove this editor as a property
- // change listener.
- if (fProject != null)
- AutotoolsPropertyManager.getDefault().removeProjectPropertyListener(fProject, this);
- this.fProject = null;
+ @Override
+ protected void doSetInput(IEditorInput newInput) throws CoreException {
+ // If this editor is for a project file, remove this editor as a property
+ // change listener.
+ if (fProject != null)
+ AutotoolsPropertyManager.getDefault().removeProjectPropertyListener(fProject, this);
+ this.fProject = null;
super.doSetInput(newInput);
this.input = newInput;
if (input instanceof IFileEditorInput) {
- IFile f = ((IFileEditorInput)input).getFile();
+ IFile f = ((IFileEditorInput) input).getFile();
fProject = f.getProject();
// This is a project file. We want to be notified if the Autoconf editor
// properties are changed such that the macro versions are changed.
AutotoolsPropertyManager.getDefault().addProjectPropertyListener(fProject, this);
}
getOutlinePage().setInput(input);
- try
- {
+ try {
IDocument document = getInputDocument();
setRootElement(reparseDocument(document));
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
@@ -203,75 +196,75 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
}
return super.getAdapter(required);
}
-
- public AutoconfContentOutlinePage getOutlinePage() {
+ public AutoconfContentOutlinePage getOutlinePage() {
if (outlinePage == null) {
- outlinePage= new AutoconfContentOutlinePage(this);
+ outlinePage = new AutoconfContentOutlinePage(this);
if (getEditorInput() != null)
outlinePage.setInput(getEditorInput());
}
return outlinePage;
}
- /**
- * Return a scanner for creating Autoconf partitions.
- *
- * @return a scanner for creating Autoconf partitions
- */
- public AutoconfParser getAutoconfParser() {
- if (fParser == null) {
- AutoconfErrorHandler errorHandler = new AutoconfErrorHandler(input);
- IAutoconfMacroValidator macroValidator = new AutoconfEditorMacroValidator(this);
- fParser = new AutoconfParser(errorHandler, new AutoconfMacroDetector(), macroValidator);
- }
- return fParser;
- }
-
/**
- * Return a scanner for creating Autoconf partitions.
- *
- * @return a scanner for creating Autoconf partitions
- */
- public AutoconfPartitionScanner getAutoconfPartitionScanner() {
- if (fPartitionScanner == null)
- fPartitionScanner= new AutoconfPartitionScanner();
- return fPartitionScanner;
- }
-
- /**
- * Returns the Autoconf code scanner.
- *
- * @return the Autoconf code scanner
- */
- public RuleBasedScanner getAutoconfCodeScanner() {
- if (fCodeScanner == null)
- fCodeScanner= new AutoconfCodeScanner();
- return fCodeScanner;
- }
-
- /**
- * Returns the Autoconf code scanner.
- *
- * @return the Autoconf code scanner
- */
- public RuleBasedScanner getAutoconfMacroCodeScanner() {
- if (fMacroCodeScanner == null)
- fMacroCodeScanner= new AutoconfMacroCodeScanner();
- return fMacroCodeScanner;
- }
-
+ * Return a scanner for creating Autoconf partitions.
+ *
+ * @return a scanner for creating Autoconf partitions
+ */
+ public AutoconfParser getAutoconfParser() {
+ if (fParser == null) {
+ AutoconfErrorHandler errorHandler = new AutoconfErrorHandler(input);
+ IAutoconfMacroValidator macroValidator = new AutoconfEditorMacroValidator(this);
+ fParser = new AutoconfParser(errorHandler, new AutoconfMacroDetector(), macroValidator);
+ }
+ return fParser;
+ }
+
+ /**
+ * Return a scanner for creating Autoconf partitions.
+ *
+ * @return a scanner for creating Autoconf partitions
+ */
+ public AutoconfPartitionScanner getAutoconfPartitionScanner() {
+ if (fPartitionScanner == null)
+ fPartitionScanner = new AutoconfPartitionScanner();
+ return fPartitionScanner;
+ }
+
+ /**
+ * Returns the Autoconf code scanner.
+ *
+ * @return the Autoconf code scanner
+ */
+ public RuleBasedScanner getAutoconfCodeScanner() {
+ if (fCodeScanner == null)
+ fCodeScanner = new AutoconfCodeScanner();
+ return fCodeScanner;
+ }
+
+ /**
+ * Returns the Autoconf code scanner.
+ *
+ * @return the Autoconf code scanner
+ */
+ public RuleBasedScanner getAutoconfMacroCodeScanner() {
+ if (fMacroCodeScanner == null)
+ fMacroCodeScanner = new AutoconfMacroCodeScanner();
+ return fMacroCodeScanner;
+ }
+
/**
* Returns the preference color, identified by the given preference.
*/
public static Color getPreferenceColor(String key) {
- return ColorManager.getDefault().getColor(PreferenceConverter.getColor(AutotoolsPlugin.getDefault().getPreferenceStore(), key));
+ 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();
+ ISourceViewer sourceViewer = getSourceViewer();
if (sourceViewer == null)
return;
handleVersionChange(sourceViewer);
@@ -280,9 +273,9 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
/**
* Handle the case whereby the Autoconf or Automake macro versions to use
- * for this project are changed in which case we want to invalidate and reparse
+ * for this project are changed in which case we want to invalidate and reparse
* the document.
- *
+ *
* @param sourceViewer
*/
protected void handleVersionChange(ISourceViewer sourceViewer) {
@@ -291,45 +284,44 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
IDocument document = getInputDocument();
setRootElement(reparseDocument(document));
- }
- catch (Exception e) {
+ } catch (Exception e) {
e.printStackTrace();
}
}
-
+
private AutoconfElement reparseDocument(IDocument document) {
AutoconfParser parser = getAutoconfParser();
- ((AutoconfErrorHandler)parser.getErrorHandler()).removeAllExistingMarkers();
-
+ ((AutoconfErrorHandler) parser.getErrorHandler()).removeAllExistingMarkers();
+
return parser.parse(document);
}
@Override
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
- ISourceViewer sourceViewer= getSourceViewer();
+ ISourceViewer sourceViewer = getSourceViewer();
if (sourceViewer == null)
return;
- String property = event.getProperty();
+ String property = event.getProperty();
- AutoconfCodeScanner scanner = (AutoconfCodeScanner)getAutoconfCodeScanner();
- if (scanner != null) {
- if (scanner.affectsBehavior(event)) {
- scanner.adaptToPreferenceChange(event);
- sourceViewer.invalidateTextPresentation();
- }
- }
+ AutoconfCodeScanner scanner = (AutoconfCodeScanner) getAutoconfCodeScanner();
+ if (scanner != null) {
+ if (scanner.affectsBehavior(event)) {
+ scanner.adaptToPreferenceChange(event);
+ sourceViewer.invalidateTextPresentation();
+ }
+ }
- if (AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION.equals(property) ||
- AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION.equals(property)) {
- handleVersionChange(sourceViewer);
- } else if (AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) {
+ if (AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION.equals(property)
+ || AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION.equals(property)) {
+ handleVersionChange(sourceViewer);
+ } else if (AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) {
if (sourceViewer instanceof ProjectionViewer) {
- ProjectionViewer projectionViewer= (ProjectionViewer) sourceViewer;
+ ProjectionViewer projectionViewer = (ProjectionViewer) sourceViewer;
if (fProjectionFileUpdater != null)
fProjectionFileUpdater.uninstall();
// either freshly enabled or provider changed
- fProjectionFileUpdater= new ProjectionFileUpdater();
+ fProjectionFileUpdater = new ProjectionFileUpdater();
if (fProjectionFileUpdater != null) {
fProjectionFileUpdater.install(this, projectionViewer);
}
@@ -340,244 +332,255 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
super.handlePreferenceStoreChanged(event);
}
- /**
- * Information provider used to present focusable information shells.
- *
- * @since 3.1.1
- */
- private static final class InformationProvider implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2 {
+ /**
+ * Information provider used to present focusable information shells.
+ *
+ * @since 3.1.1
+ */
+ private static final class InformationProvider
+ implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2 {
- private IRegion fHoverRegion;
- private Object fHoverInfo;
- private IInformationControlCreator fControlCreator;
+ private IRegion fHoverRegion;
+ private Object fHoverInfo;
+ private IInformationControlCreator fControlCreator;
- InformationProvider(IRegion hoverRegion, Object hoverInfo, IInformationControlCreator controlCreator) {
- fHoverRegion= hoverRegion;
- fHoverInfo= hoverInfo;
- fControlCreator= controlCreator;
- }
- @Override
+ InformationProvider(IRegion hoverRegion, Object hoverInfo, IInformationControlCreator controlCreator) {
+ fHoverRegion = hoverRegion;
+ fHoverInfo = hoverInfo;
+ fControlCreator = controlCreator;
+ }
+
+ @Override
public IRegion getSubject(ITextViewer textViewer, int invocationOffset) {
- return fHoverRegion;
- }
- @Override
+ return fHoverRegion;
+ }
+
+ @Override
public String getInformation(ITextViewer textViewer, IRegion subject) {
- return fHoverInfo.toString();
- }
-
- @Override
+ return fHoverInfo.toString();
+ }
+
+ @Override
public Object getInformation2(ITextViewer textViewer, IRegion subject) {
- return fHoverInfo;
- }
- @Override
+ return fHoverInfo;
+ }
+
+ @Override
public IInformationControlCreator getInformationPresenterControlCreator() {
- return fControlCreator;
- }
- }
-
- /**
- * This action behaves in two different ways: If there is no current text
- * hover, the tooltip is displayed using information presenter. If there is
- * a current text hover, it is converted into a information presenter in
- * order to make it sticky.
- * @since 3.1.1
- */
- class InformationDispatchAction extends TextEditorAction {
-
- /** The wrapped text operation action. */
- private final TextOperationAction fTextOperationAction;
-
- /**
- * Creates a dispatch action.
- *
- * @param resourceBundle the resource bundle
- * @param prefix the prefix
- * @param textOperationAction the text operation action
- */
- public InformationDispatchAction(ResourceBundle resourceBundle, String prefix, final TextOperationAction textOperationAction) {
- super(resourceBundle, prefix, AutoconfEditor.this);
- if (textOperationAction == null)
- throw new IllegalArgumentException();
- fTextOperationAction= textOperationAction;
- }
-
- @Override
+ return fControlCreator;
+ }
+ }
+
+ /**
+ * This action behaves in two different ways: If there is no current text
+ * hover, the tooltip is displayed using information presenter. If there is
+ * a current text hover, it is converted into a information presenter in
+ * order to make it sticky.
+ * @since 3.1.1
+ */
+ class InformationDispatchAction extends TextEditorAction {
+
+ /** The wrapped text operation action. */
+ private final TextOperationAction fTextOperationAction;
+
+ /**
+ * Creates a dispatch action.
+ *
+ * @param resourceBundle the resource bundle
+ * @param prefix the prefix
+ * @param textOperationAction the text operation action
+ */
+ public InformationDispatchAction(ResourceBundle resourceBundle, String prefix,
+ final TextOperationAction textOperationAction) {
+ super(resourceBundle, prefix, AutoconfEditor.this);
+ if (textOperationAction == null)
+ throw new IllegalArgumentException();
+ fTextOperationAction = textOperationAction;
+ }
+
+ @Override
public void run() {
- ISourceViewer sourceViewer= getSourceViewer();
- if (sourceViewer == null) {
- fTextOperationAction.run();
- return;
- }
-
- if (sourceViewer instanceof ITextViewerExtension4) {
- ITextViewerExtension4 extension4= (ITextViewerExtension4) sourceViewer;
- if (extension4.moveFocusToWidgetToken())
- return;
- }
-
- if (sourceViewer instanceof ITextViewerExtension2) {
- // does a text hover exist?
- ITextHover textHover= ((ITextViewerExtension2) sourceViewer).getCurrentTextHover();
- if (textHover != null && makeTextHoverFocusable(sourceViewer, textHover))
- return;
- }
-
- if (sourceViewer instanceof ISourceViewerExtension3) {
- // does an annotation hover exist?
- IAnnotationHover annotationHover= ((ISourceViewerExtension3) sourceViewer).getCurrentAnnotationHover();
- if (annotationHover != null && makeAnnotationHoverFocusable(sourceViewer, annotationHover))
- return;
- }
-
- // otherwise, just display the tooltip
- //fTextOperationAction.run();
- }
-
- /**
- * Tries to make a text hover focusable (or "sticky").
- *
- * @param sourceViewer the source viewer to display the hover over
- * @param textHover the hover to make focusable
- * @return <code>true</code> if successful, <code>false</code> otherwise
- */
- @SuppressWarnings("deprecation")
+ ISourceViewer sourceViewer = getSourceViewer();
+ if (sourceViewer == null) {
+ fTextOperationAction.run();
+ return;
+ }
+
+ if (sourceViewer instanceof ITextViewerExtension4) {
+ ITextViewerExtension4 extension4 = (ITextViewerExtension4) sourceViewer;
+ if (extension4.moveFocusToWidgetToken())
+ return;
+ }
+
+ if (sourceViewer instanceof ITextViewerExtension2) {
+ // does a text hover exist?
+ ITextHover textHover = ((ITextViewerExtension2) sourceViewer).getCurrentTextHover();
+ if (textHover != null && makeTextHoverFocusable(sourceViewer, textHover))
+ return;
+ }
+
+ if (sourceViewer instanceof ISourceViewerExtension3) {
+ // does an annotation hover exist?
+ IAnnotationHover annotationHover = ((ISourceViewerExtension3) sourceViewer).getCurrentAnnotationHover();
+ if (annotationHover != null && makeAnnotationHoverFocusable(sourceViewer, annotationHover))
+ return;
+ }
+
+ // otherwise, just display the tooltip
+ //fTextOperationAction.run();
+ }
+
+ /**
+ * Tries to make a text hover focusable (or "sticky").
+ *
+ * @param sourceViewer the source viewer to display the hover over
+ * @param textHover the hover to make focusable
+ * @return <code>true</code> if successful, <code>false</code> otherwise
+ */
+ @SuppressWarnings("deprecation")
private boolean makeTextHoverFocusable(ISourceViewer sourceViewer, ITextHover textHover) {
- Point hoverEventLocation= ((ITextViewerExtension2) sourceViewer).getHoverEventLocation();
- int offset= computeOffsetAtLocation(sourceViewer, hoverEventLocation.x, hoverEventLocation.y);
- if (offset == -1)
- return false;
-
- try {
- IRegion hoverRegion= textHover.getHoverRegion(sourceViewer, offset);
- if (hoverRegion == null)
- return false;
-
- String hoverInfo= textHover.getHoverInfo(sourceViewer, hoverRegion);
-
- IInformationControlCreator controlCreator= null;
- if (textHover instanceof IInformationProviderExtension2)
- controlCreator= ((IInformationProviderExtension2)textHover).getInformationPresenterControlCreator();
-
- IInformationProvider informationProvider= new InformationProvider(hoverRegion, hoverInfo, controlCreator);
-
- fInformationPresenter.setOffset(offset);
- fInformationPresenter.setAnchor(AbstractInformationControlManager.ANCHOR_BOTTOM);
- fInformationPresenter.setMargins(6, 6); // default values from AbstractInformationControlManager
- String contentType= TextUtilities.getContentType(sourceViewer.getDocument(), AutoconfPartitionScanner.AUTOCONF_MACRO, offset, true);
- fInformationPresenter.setInformationProvider(informationProvider, contentType);
- fInformationPresenter.showInformation();
-
- return true;
-
- } catch (BadLocationException e) {
- return false;
- }
- }
-
- /**
- * Tries to make an annotation hover focusable (or "sticky").
- *
- * @param sourceViewer the source viewer to display the hover over
- * @param annotationHover the hover to make focusable
- * @return <code>true</code> if successful, <code>false</code> otherwise
- */
- private boolean makeAnnotationHoverFocusable(ISourceViewer sourceViewer, IAnnotationHover annotationHover) {
- IVerticalRulerInfo info= getVerticalRuler();
- int line= info.getLineOfLastMouseButtonActivity();
- if (line == -1)
- return false;
-
- try {
-
- // compute the hover information
- Object hoverInfo;
- if (annotationHover instanceof IAnnotationHoverExtension) {
- IAnnotationHoverExtension extension= (IAnnotationHoverExtension) annotationHover;
- ILineRange hoverLineRange= extension.getHoverLineRange(sourceViewer, line);
- if (hoverLineRange == null)
- return false;
- final int maxVisibleLines= Integer.MAX_VALUE; // allow any number of lines being displayed, as we support scrolling
- hoverInfo= extension.getHoverInfo(sourceViewer, hoverLineRange, maxVisibleLines);
- } else {
- hoverInfo= annotationHover.getHoverInfo(sourceViewer, line);
- }
-
- // hover region: the beginning of the concerned line to place the control right over the line
- IDocument document= sourceViewer.getDocument();
- int offset= document.getLineOffset(line);
- String contentType= TextUtilities.getContentType(document, AutoconfPartitionScanner.AUTOCONF_MACRO, offset, true);
-
- IInformationControlCreator controlCreator= null;
-
-// /*
-// * XXX: This is a hack to avoid API changes at the end of 3.2,
-// * and should be fixed for 3.3, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=137967
-// */
-// if ("org.eclipse.jface.text.source.projection.ProjectionAnnotationHover".equals(annotationHover.getClass().getName())) { //$NON-NLS-1$
-// controlCreator= new IInformationControlCreator() {
-// public IInformationControl createInformationControl(Shell shell) {
-// int shellStyle= SWT.RESIZE | SWT.TOOL | getOrientation();
-// int style= SWT.V_SCROLL | SWT.H_SCROLL;
-// return new SourceViewerInformationControl(shell, shellStyle, style);
-// }
-// };
-//
-// } else {
- if (annotationHover instanceof IInformationProviderExtension2)
- controlCreator= ((IInformationProviderExtension2) annotationHover).getInformationPresenterControlCreator();
- else if (annotationHover instanceof IAnnotationHoverExtension)
- controlCreator= ((IAnnotationHoverExtension) annotationHover).getHoverControlCreator();
-// }
-
- IInformationProvider informationProvider= new InformationProvider(new Region(offset, 0), hoverInfo, controlCreator);
-
- fInformationPresenter.setOffset(offset);
- fInformationPresenter.setAnchor(AbstractInformationControlManager.ANCHOR_RIGHT);
- fInformationPresenter.setMargins(4, 0); // AnnotationBarHoverManager sets (5,0), minus SourceViewer.GAP_SIZE_1
- fInformationPresenter.setInformationProvider(informationProvider, contentType);
- fInformationPresenter.showInformation();
-
- return true;
-
- } catch (BadLocationException e) {
- return false;
- }
- }
-
- // modified version from TextViewer
- private int computeOffsetAtLocation(ITextViewer textViewer, int x, int y) {
-
- StyledText styledText= textViewer.getTextWidget();
- IDocument document= textViewer.getDocument();
-
- if (document == null)
- return -1;
-
- try {
- int widgetOffset= styledText.getOffsetAtLocation(new Point(x, y));
- Point p= styledText.getLocationAtOffset(widgetOffset);
- if (p.x > x)
- widgetOffset--;
-
- if (textViewer instanceof ITextViewerExtension5) {
- ITextViewerExtension5 extension= (ITextViewerExtension5) textViewer;
- return extension.widgetOffset2ModelOffset(widgetOffset);
- } else {
- IRegion visibleRegion= textViewer.getVisibleRegion();
- return widgetOffset + visibleRegion.getOffset();
- }
- } catch (IllegalArgumentException e) {
- return -1;
- }
-
- }
- }
+ Point hoverEventLocation = ((ITextViewerExtension2) sourceViewer).getHoverEventLocation();
+ int offset = computeOffsetAtLocation(sourceViewer, hoverEventLocation.x, hoverEventLocation.y);
+ if (offset == -1)
+ return false;
+
+ try {
+ IRegion hoverRegion = textHover.getHoverRegion(sourceViewer, offset);
+ if (hoverRegion == null)
+ return false;
+
+ String hoverInfo = textHover.getHoverInfo(sourceViewer, hoverRegion);
+
+ IInformationControlCreator controlCreator = null;
+ if (textHover instanceof IInformationProviderExtension2)
+ controlCreator = ((IInformationProviderExtension2) textHover)
+ .getInformationPresenterControlCreator();
+
+ IInformationProvider informationProvider = new InformationProvider(hoverRegion, hoverInfo,
+ controlCreator);
+
+ fInformationPresenter.setOffset(offset);
+ fInformationPresenter.setAnchor(AbstractInformationControlManager.ANCHOR_BOTTOM);
+ fInformationPresenter.setMargins(6, 6); // default values from AbstractInformationControlManager
+ String contentType = TextUtilities.getContentType(sourceViewer.getDocument(),
+ AutoconfPartitionScanner.AUTOCONF_MACRO, offset, true);
+ fInformationPresenter.setInformationProvider(informationProvider, contentType);
+ fInformationPresenter.showInformation();
+
+ return true;
+
+ } catch (BadLocationException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Tries to make an annotation hover focusable (or "sticky").
+ *
+ * @param sourceViewer the source viewer to display the hover over
+ * @param annotationHover the hover to make focusable
+ * @return <code>true</code> if successful, <code>false</code> otherwise
+ */
+ private boolean makeAnnotationHoverFocusable(ISourceViewer sourceViewer, IAnnotationHover annotationHover) {
+ IVerticalRulerInfo info = getVerticalRuler();
+ int line = info.getLineOfLastMouseButtonActivity();
+ if (line == -1)
+ return false;
+
+ try {
+
+ // compute the hover information
+ Object hoverInfo;
+ if (annotationHover instanceof IAnnotationHoverExtension) {
+ IAnnotationHoverExtension extension = (IAnnotationHoverExtension) annotationHover;
+ ILineRange hoverLineRange = extension.getHoverLineRange(sourceViewer, line);
+ if (hoverLineRange == null)
+ return false;
+ final int maxVisibleLines = Integer.MAX_VALUE; // allow any number of lines being displayed, as we support scrolling
+ hoverInfo = extension.getHoverInfo(sourceViewer, hoverLineRange, maxVisibleLines);
+ } else {
+ hoverInfo = annotationHover.getHoverInfo(sourceViewer, line);
+ }
+
+ // hover region: the beginning of the concerned line to place the control right over the line
+ IDocument document = sourceViewer.getDocument();
+ int offset = document.getLineOffset(line);
+ String contentType = TextUtilities.getContentType(document, AutoconfPartitionScanner.AUTOCONF_MACRO,
+ offset, true);
+
+ IInformationControlCreator controlCreator = null;
+
+ // /*
+ // * XXX: This is a hack to avoid API changes at the end of 3.2,
+ // * and should be fixed for 3.3, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=137967
+ // */
+ // if ("org.eclipse.jface.text.source.projection.ProjectionAnnotationHover".equals(annotationHover.getClass().getName())) { //$NON-NLS-1$
+ // controlCreator= new IInformationControlCreator() {
+ // public IInformationControl createInformationControl(Shell shell) {
+ // int shellStyle= SWT.RESIZE | SWT.TOOL | getOrientation();
+ // int style= SWT.V_SCROLL | SWT.H_SCROLL;
+ // return new SourceViewerInformationControl(shell, shellStyle, style);
+ // }
+ // };
+ //
+ // } else {
+ if (annotationHover instanceof IInformationProviderExtension2)
+ controlCreator = ((IInformationProviderExtension2) annotationHover)
+ .getInformationPresenterControlCreator();
+ else if (annotationHover instanceof IAnnotationHoverExtension)
+ controlCreator = ((IAnnotationHoverExtension) annotationHover).getHoverControlCreator();
+ // }
+
+ IInformationProvider informationProvider = new InformationProvider(new Region(offset, 0), hoverInfo,
+ controlCreator);
+
+ fInformationPresenter.setOffset(offset);
+ fInformationPresenter.setAnchor(AbstractInformationControlManager.ANCHOR_RIGHT);
+ fInformationPresenter.setMargins(4, 0); // AnnotationBarHoverManager sets (5,0), minus SourceViewer.GAP_SIZE_1
+ fInformationPresenter.setInformationProvider(informationProvider, contentType);
+ fInformationPresenter.showInformation();
+
+ return true;
+
+ } catch (BadLocationException e) {
+ return false;
+ }
+ }
+
+ // modified version from TextViewer
+ private int computeOffsetAtLocation(ITextViewer textViewer, int x, int y) {
+
+ StyledText styledText = textViewer.getTextWidget();
+ IDocument document = textViewer.getDocument();
+
+ if (document == null)
+ return -1;
+
+ try {
+ int widgetOffset = styledText.getOffsetAtLocation(new Point(x, y));
+ Point p = styledText.getLocationAtOffset(widgetOffset);
+ if (p.x > x)
+ widgetOffset--;
+
+ if (textViewer instanceof ITextViewerExtension5) {
+ ITextViewerExtension5 extension = (ITextViewerExtension5) textViewer;
+ return extension.widgetOffset2ModelOffset(widgetOffset);
+ } else {
+ IRegion visibleRegion = textViewer.getVisibleRegion();
+ return widgetOffset + visibleRegion.getOffset();
+ }
+ } catch (IllegalArgumentException e) {
+ return -1;
+ }
+
+ }
+ }
/**
* Adds the given listener.
* Has no effect if an identical listener was not already registered.
- *
+ *
* @param listener The reconcile listener to be added
*/
@Override
@@ -586,11 +589,11 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
fReconcilingListeners.add(listener);
}
}
-
+
/**
* Removes the given listener.
* Has no effect if an identical listener was not already registered.
- *
+ *
* @param listener the reconcile listener to be removed
*/
final void removeReconcilingParticipant(IReconcilingParticipant listener) {
@@ -598,7 +601,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
fReconcilingListeners.remove(listener);
}
}
-
+
/*
*/
public void reconciled() {
@@ -608,108 +611,111 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
}
}
- /**
- * Determines is folding enabled.
- * @return <code>true</code> if folding is enabled, <code>false</code> otherwise.
- */
+ /**
+ * Determines is folding enabled.
+ * @return <code>true</code> if folding is enabled, <code>false</code> otherwise.
+ */
boolean isFoldingEnabled() {
- return AutotoolsPlugin.getDefault().getPreferenceStore().getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED);
+ return AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED);
}
@Override
protected void initializeKeyBindingScopes() {
- setKeyBindingScopes(new String [] { AutotoolsUIPlugin.getUniqueIdentifier() + ".editor.scope" } ); //$NON-NLS-1$
+ setKeyBindingScopes(new String[] { AutotoolsUIPlugin.getUniqueIdentifier() + ".editor.scope" }); //$NON-NLS-1$
}
-
- @Override
+ @Override
protected void createActions() {
- super.createActions();
- // TODO: Figure out how to do this later.
-// fFoldingGroup= new FoldingActionGroup(this, getSourceViewer());
-
- // Sticky hover support
- ResourceAction resAction= new TextOperationAction(AutoconfEditorMessages.getResourceBundle(), "ShowToolTip.", this, ISourceViewer.INFORMATION, true); //$NON-NLS-1$
- resAction= new InformationDispatchAction(AutoconfEditorMessages.getResourceBundle(), "ShowToolTip.", (TextOperationAction) resAction); //$NON-NLS-1$
- resAction.setActionDefinitionId(IAutotoolEditorActionDefinitionIds.SHOW_TOOLTIP);
- setAction("ShowToolTip", resAction); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(resAction, IAutotoolHelpContextIds.SHOW_TOOLTIP_ACTION);
-
- // Content assist
- Action action = new ContentAssistAction(AutoconfEditorMessages.getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
+ super.createActions();
+ // TODO: Figure out how to do this later.
+ // fFoldingGroup= new FoldingActionGroup(this, getSourceViewer());
+
+ // Sticky hover support
+ ResourceAction resAction = new TextOperationAction(AutoconfEditorMessages.getResourceBundle(), "ShowToolTip.", //$NON-NLS-1$
+ this, ISourceViewer.INFORMATION, true);
+ resAction = new InformationDispatchAction(AutoconfEditorMessages.getResourceBundle(), "ShowToolTip.", //$NON-NLS-1$
+ (TextOperationAction) resAction);
+ resAction.setActionDefinitionId(IAutotoolEditorActionDefinitionIds.SHOW_TOOLTIP);
+ setAction("ShowToolTip", resAction); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(resAction, IAutotoolHelpContextIds.SHOW_TOOLTIP_ACTION);
+
+ // Content assist
+ Action action = new ContentAssistAction(AutoconfEditorMessages.getResourceBundle(), "ContentAssistProposal.", //$NON-NLS-1$
+ this);
action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
setAction("ContentAssistProposal", action); //$NON-NLS-1$
markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IAutotoolHelpContextIds.CONTENT_ASSIST);
- }
-
- /**
- * The <code>AbstractTextEditor</code> implementation of this
- * <code>IWorkbenchPart</code> method creates the vertical ruler and
- * source viewer. Subclasses may extend.
- *
- * We attach our own mouseDown listener on the menu bar,
- * and our own listener for cursor/key/selection events to update cursor position in
- * status bar.
-
- * @param parent Parent composite of the control.
- */
- @Override
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(action, IAutotoolHelpContextIds.CONTENT_ASSIST);
+ }
+
+ /**
+ * The <code>AbstractTextEditor</code> implementation of this
+ * <code>IWorkbenchPart</code> method creates the vertical ruler and
+ * source viewer. Subclasses may extend.
+ *
+ * We attach our own mouseDown listener on the menu bar,
+ * and our own listener for cursor/key/selection events to update cursor position in
+ * status bar.
+
+ * @param parent Parent composite of the control.
+ */
+ @Override
public void createPartControl(Composite parent) {
- super.createPartControl(parent);
+ super.createPartControl(parent);
- // Sticky hover support
- IInformationControlCreator informationControlCreator= new IInformationControlCreator() {
- @Override
+ // Sticky hover support
+ IInformationControlCreator informationControlCreator = new IInformationControlCreator() {
+ @Override
public IInformationControl createInformationControl(Shell shell) {
- return new DefaultInformationControl(shell, true);
- }
- };
-
- fInformationPresenter= new InformationPresenter(informationControlCreator);
- fInformationPresenter.setSizeConstraints(60, 10, true, true);
- fInformationPresenter.install(getSourceViewer());
- fInformationPresenter.setDocumentPartitioning(AutoconfPartitionScanner.AUTOCONF_MACRO);
-
- ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
-
- fProjectionSupport= new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
- fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
- fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
- fProjectionSupport.install();
-
- if (isFoldingEnabled())
- projectionViewer.doOperation(ProjectionViewer.TOGGLE);
-
- fProjectionFileUpdater= new ProjectionFileUpdater();
+ return new DefaultInformationControl(shell, true);
+ }
+ };
+
+ fInformationPresenter = new InformationPresenter(informationControlCreator);
+ fInformationPresenter.setSizeConstraints(60, 10, true, true);
+ fInformationPresenter.install(getSourceViewer());
+ fInformationPresenter.setDocumentPartitioning(AutoconfPartitionScanner.AUTOCONF_MACRO);
+
+ ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
+
+ fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
+ fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
+ fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
+ fProjectionSupport.install();
+
+ if (isFoldingEnabled())
+ projectionViewer.doOperation(ProjectionViewer.TOGGLE);
+
+ fProjectionFileUpdater = new ProjectionFileUpdater();
if (fProjectionFileUpdater != null) {
fProjectionFileUpdater.install(this, projectionViewer);
fProjectionFileUpdater.initialize();
}
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IAutotoolHelpContextIds.AC_EDITOR_VIEW);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IAutotoolHelpContextIds.AC_EDITOR_VIEW);
- // TODO: Do we need the following two lines?
-// fEditorSelectionChangedListener= new EditorSelectionChangedListener();
-// fEditorSelectionChangedListener.install(getSelectionProvider());
- }
+ // TODO: Do we need the following two lines?
+ // fEditorSelectionChangedListener= new EditorSelectionChangedListener();
+ // fEditorSelectionChangedListener.install(getSelectionProvider());
+ }
- @Override
+ @Override
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
- ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
+ ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(),
+ styles);
+
+ // ensure decoration support has been created and configured.
+ getSourceViewerDecorationSupport(viewer);
- // ensure decoration support has been created and configured.
- getSourceViewerDecorationSupport(viewer);
+ return viewer;
+ }
- return viewer;
- }
-
-
@Override
public void dispose() {
if (fProjectionFileUpdater != null) {
fProjectionFileUpdater.uninstall();
- fProjectionFileUpdater= null;
+ fProjectionFileUpdater = null;
}
if (fProject != null) {
AutotoolsPropertyManager.getDefault().removeProjectPropertyListener(fProject, this);
@@ -719,11 +725,11 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
@Override
protected void performRevert() {
- ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
+ ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
projectionViewer.setRedraw(false);
try {
- boolean projectionMode= projectionViewer.isProjectionMode();
+ boolean projectionMode = projectionViewer.isProjectionMode();
if (projectionMode) {
projectionViewer.disableProjection();
if (fProjectionFileUpdater != null)
@@ -743,7 +749,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
}
}
- public IProject getProject() {
+ public IProject getProject() {
return this.fProject;
}
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 9dd5266e91a..800a1238d04 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
@@ -29,7 +29,6 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
-
/**
* Validate a macro call by checking against the stored macro prototypes
*/
@@ -44,8 +43,7 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
}
@Override
- public void validateMacroCall(AutoconfMacroElement macro)
- throws ParseException, InvalidMacroException {
+ public void validateMacroCall(AutoconfMacroElement macro) throws ParseException, InvalidMacroException {
AutoconfPrototype p = AutoconfTextHover.getPrototype(macro.getName(), fEditor);
if (p != null) {
boolean tooFew = false;
@@ -67,7 +65,7 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
break;
}
}
-
+
int length = macro.getEndOffset() - macro.getStartOffset();
int start = macro.getStartOffset();
int end = macro.getEndOffset();
@@ -75,31 +73,25 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
try {
lineNumber = macro.getDocument().getLineOfOffset(start);
} catch (BadLocationException e) {
-
+
}
-
+
if (!justRight) {
if (tooFew) {
- String formatString = AutoconfEditorMessages.getFormattedString(AUTOCONF_MACRO_ARGS_TOO_FEW,
- AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION),
+ String formatString = AutoconfEditorMessages.getFormattedString(AUTOCONF_MACRO_ARGS_TOO_FEW,
+ AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION),
p.getName(), Integer.toString(minParms));
- throw new ParseException(
- formatString,
- start, end,
- lineNumber, 0, length,
- IMarker.SEVERITY_WARNING);
+ throw new ParseException(formatString, start, end, lineNumber, 0, length, IMarker.SEVERITY_WARNING);
} else if (tooMany) {
String formatString = AutoconfEditorMessages.getFormattedString(AUTOCONF_MACRO_ARGS_TOO_MANY,
- AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION),
+ AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION),
p.getName(), Integer.toString(maxParms));
- throw new ParseException(
- formatString,
- start, end,
- lineNumber, 0, length,
- IMarker.SEVERITY_WARNING);
+ throw new ParseException(formatString, start, end, lineNumber, 0, length, IMarker.SEVERITY_WARNING);
}
}
-
+
IProject project = fEditor.getProject();
String acDocVer = AutoconfTextHover.getDefaultAutoconfMacrosVer();
try {
@@ -114,7 +106,7 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
} catch (CoreException ce1) {
// do nothing
}
-
+
macro.validate(acDocVer);
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMessages.java
index 799f3bda6b3..c56d270b929 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMessages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/AutoconfEditorMessages.java
@@ -18,15 +18,14 @@ import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-
/**
* AutoconfEditorMessages
*/
public class AutoconfEditorMessages {
- private static final String RESOURCE_BUNDLE= AutoconfEditorMessages.class.getName();
+ private static final String RESOURCE_BUNDLE = AutoconfEditorMessages.class.getName();
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ private static ResourceBundle fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
private AutoconfEditorMessages() {
}
@@ -34,7 +33,7 @@ public class AutoconfEditorMessages {
public static ResourceBundle getResourceBundle() {
return fgResourceBundle;
}
-
+
public static String getString(String key) {
try {
return fgResourceBundle.getString(key);
@@ -42,75 +41,77 @@ public class AutoconfEditorMessages {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
}
+
/**
* Gets a string from the resource bundle and formats it with the argument
- *
+ *
* @param key the string used to get the bundle value, must not be null
* @since 3.0
*/
public static String getFormattedString(String key, Object arg) {
- String format= null;
+ String format = null;
try {
- format= fgResourceBundle.getString(key);
+ format = fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
if (arg == null)
- arg= ""; //$NON-NLS-1$
+ arg = ""; //$NON-NLS-1$
return MessageFormat.format(format, new Object[] { arg });
}
+
/**
* Gets a string from the resource bundle and formats it with the arguments
- *
+ *
* @param key the string used to get the bundle value, must not be null
* @since 3.0
*/
public static String getFormattedString(String key, Object arg1, Object arg2) {
- String format= null;
+ String format = null;
try {
- format= fgResourceBundle.getString(key);
+ format = fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
if (arg1 == null)
- arg1= ""; //$NON-NLS-1$
+ arg1 = ""; //$NON-NLS-1$
if (arg2 == null)
- arg2= ""; //$NON-NLS-1$
+ arg2 = ""; //$NON-NLS-1$
return MessageFormat.format(format, new Object[] { arg1, arg2 });
}
-
+
/**
* Gets a string from the resource bundle and formats it with the arguments
- *
+ *
* @param key the string used to get the bundle value, must not be null
* @since 3.0
*/
public static String getFormattedString(String key, Object arg1, Object arg2, Object arg3) {
- String format= null;
+ String format = null;
try {
- format= fgResourceBundle.getString(key);
+ format = fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
if (arg1 == null)
- arg1= ""; //$NON-NLS-1$
+ arg1 = ""; //$NON-NLS-1$
if (arg2 == null)
- arg2= ""; //$NON-NLS-1$
+ arg2 = ""; //$NON-NLS-1$
if (arg3 == null)
- arg3= ""; //$NON-NLS-1$
+ arg3 = ""; //$NON-NLS-1$
return MessageFormat.format(format, new Object[] { arg1, arg2, arg3 });
}
-
+
/**
* Gets a string from the resource bundle and formats it with the argument
- *
+ *
* @param key the string used to get the bundle value, must not be null
* @since 3.0
*/
public static String getFormattedString(String key, boolean arg) {
- String format= null;
+ String format = null;
try {
- format= fgResourceBundle.getString(key);
+ format = fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
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 5ee1e545951..9796e777229 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
@@ -26,23 +26,23 @@ import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationModel;
import org.eclipse.ui.IEditorInput;
-
public class AutoconfErrorHandler implements IAutoconfErrorHandler {
-
+
public static final String CDT_ANNOTATION_INFO = "org.eclipse.cdt.ui.info"; //$NON-NLS-1$
public static final String CDT_ANNOTATION_WARNING = "org.eclipse.cdt.ui.warning"; //$NON-NLS-1$
public static final String CDT_ANNOTATION_ERROR = "org.eclipse.cdt.ui.error"; //$NON-NLS-1$
-
+
private int CDT_WARNING = 1;
private int CDT_ERROR = 2;
-
+
private Map<Position, Annotation> annotations = new HashMap<>();
private AnnotationModel fAnnotationModel;
-
+
public AutoconfErrorHandler(IEditorInput input) {
- this.fAnnotationModel = (AnnotationModel)AutoconfEditor.getAutoconfDocumentProvider().getAnnotationModel(input);
+ this.fAnnotationModel = (AnnotationModel) AutoconfEditor.getAutoconfDocumentProvider()
+ .getAnnotationModel(input);
}
-
+
// TODO: no quickfixes yet implemented, but maybe in the future
private static class AutoconfAnnotation extends Annotation implements IQuickFixableAnnotation {
public AutoconfAnnotation(String annotationType, boolean persist, String message) {
@@ -65,31 +65,29 @@ public class AutoconfErrorHandler implements IAutoconfErrorHandler {
}
}
-
+
@Override
public void handleError(ParseException e) {
Integer charStart = Integer.valueOf(e.getStartOffset());
Integer charEnd = Integer.valueOf(e.getEndOffset());
-
+
String annotationType = CDT_ANNOTATION_INFO;
if (e.getSeverity() == CDT_ERROR)
annotationType = CDT_ANNOTATION_ERROR;
else if (e.getSeverity() == CDT_WARNING)
annotationType = CDT_ANNOTATION_WARNING;
Annotation annotation = new AutoconfAnnotation(annotationType, true, e.getLocalizedMessage());
- Position p = new Position(charStart.intValue(),charEnd.intValue() - charStart.intValue());
+ Position p = new Position(charStart.intValue(), charEnd.intValue() - charStart.intValue());
fAnnotationModel.addAnnotation(annotation, p);
annotations.put(p, annotation);
}
-
- public void removeAllExistingMarkers()
- {
+
+ public void removeAllExistingMarkers() {
fAnnotationModel.removeAllAnnotations();
annotations.clear();
}
- public void removeExistingMarkers(int offset, int length)
- {
+ public void removeExistingMarkers(int offset, int length) {
Iterator<Annotation> i = fAnnotationModel.getAnnotationIterator();
while (i.hasNext()) {
Annotation annotation = i.next();
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 1889502515c..a792cdac58a 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
@@ -23,7 +23,7 @@ public class AutoconfIdentifierRule implements IPredicateRule {
private IToken fToken;
private String fExtraChars = "_${@"; //$NON-NLS-1$
-
+
public AutoconfIdentifierRule(IToken token) {
Assert.isNotNull(token);
fToken = token;
@@ -38,14 +38,14 @@ public class AutoconfIdentifierRule implements IPredicateRule {
public IToken evaluate(ICharacterScanner scanner) {
return evaluate(scanner, false);
}
-
+
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
int c = scanner.read();
- if (Character.isLetterOrDigit((char)c) || fExtraChars.indexOf((char)c) >= 0) {
+ if (Character.isLetterOrDigit((char) c) || fExtraChars.indexOf((char) c) >= 0) {
do {
c = scanner.read();
- } while (Character.isLetterOrDigit((char)c) || fExtraChars.indexOf((char)c) >= 0);
+ } while (Character.isLetterOrDigit((char) c) || fExtraChars.indexOf((char) c) >= 0);
scanner.unread();
return fToken;
}
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 45f89d21301..dd15b3980f6 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
@@ -28,4 +28,3 @@ public class AutoconfKeywordDetector implements IWordDetector {
}
}
-
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 9c78af949d7..6597b514bea 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
@@ -44,18 +44,18 @@ public class AutoconfMacro implements Comparable<Object> {
AutoconfMacro y = (AutoconfMacro) x;
return getName().compareTo(y.getName());
}
-
+
@Override
public boolean equals(Object x) {
if (x == null)
return false;
- AutoconfMacro y = (AutoconfMacro)x;
+ AutoconfMacro y = (AutoconfMacro) x;
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 d4a21f84420..f1300431f42 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,17 +36,16 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
-
public class AutoconfMacroCodeScanner extends RuleBasedScanner {
- private Map<String, IToken> fTokenMap= new HashMap<>();
+ private Map<String, IToken> fTokenMap = new HashMap<>();
private String[] fPropertyNamesColor;
-
+
private int quoteLevel;
-
+
/**
* Preference keys for boolean preferences which are <code>true</code>,
- * iff the corresponding token should be rendered bold.
+ * iff the corresponding token should be rendered bold.
*/
private String[] fPropertyNamesBold;
/**
@@ -55,49 +54,42 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
*/
private String[] fPropertyNamesItalic;
- private static String[] keywords = {
- "case", "do", "done", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "esac", "if", "elif", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "else", "fi", "for", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "in", "then" }; //$NON-NLS-1$ //$NON-NLS-2$
-
- static final String[] fTokenProperties = new String[] {
- ColorManager.AUTOCONF_COMMENT_COLOR,
- ColorManager.AUTOCONF_KEYWORD_COLOR,
- ColorManager.AUTOCONF_ACMACRO_COLOR,
- ColorManager.AUTOCONF_AMMACRO_COLOR,
- ColorManager.AUTOCONF_VAR_REF_COLOR,
- ColorManager.AUTOCONF_VAR_SET_COLOR,
- ColorManager.AUTOCONF_CODESEQ_COLOR,
- ColorManager.AUTOCONF_DEFAULT_COLOR,
- };
+ private static String[] keywords = { "case", "do", "done", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "esac", "if", "elif", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "else", "fi", "for", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "in", "then" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+ static final String[] fTokenProperties = new String[] { ColorManager.AUTOCONF_COMMENT_COLOR,
+ ColorManager.AUTOCONF_KEYWORD_COLOR, ColorManager.AUTOCONF_ACMACRO_COLOR,
+ ColorManager.AUTOCONF_AMMACRO_COLOR, ColorManager.AUTOCONF_VAR_REF_COLOR,
+ ColorManager.AUTOCONF_VAR_SET_COLOR, ColorManager.AUTOCONF_CODESEQ_COLOR,
+ ColorManager.AUTOCONF_DEFAULT_COLOR, };
public AutoconfMacroCodeScanner() {
-
+
initialize();
-
- IToken other= getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
+
+ IToken other = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
IToken keyword = getToken(ColorManager.AUTOCONF_KEYWORD_COLOR);
- IToken comment= getToken(ColorManager.AUTOCONF_COMMENT_COLOR);
+ IToken comment = getToken(ColorManager.AUTOCONF_COMMENT_COLOR);
IToken string = getToken(ColorManager.AUTOCONF_DEFAULT_COLOR);
IToken varRef = getToken(ColorManager.AUTOCONF_VAR_REF_COLOR);
IToken acmacro = getToken(ColorManager.AUTOCONF_ACMACRO_COLOR);
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR);
-
- List<IRule> rules= new ArrayList<>();
+
+ List<IRule> rules = new ArrayList<>();
// Add rule for single line comments.
rules.add(new RestrictedEndOfLineRule("dnl", "[]", comment)); //$NON-NLS-1$
rules.add(new RestrictedEndOfLineRule("#", "[]", comment, '\\')); //$NON-NLS-1$
-
+
// Add special recursive rule for strings which allows variable
// references to be internally tokenized.
- RecursiveSingleLineRule stringRule =
- new RecursiveSingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$
+ RecursiveSingleLineRule stringRule = new RecursiveSingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$ //$NON-NLS-2$
stringRule.addRule(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
rules.add(stringRule);
-
+
// Add rule for variable references
rules.add(new SingleLineRule("${", "}", varRef)); //$NON-NLS-1$ //$NON-NLS-2$
// Add rule for strings
@@ -111,29 +103,29 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
// Add rule for m4_ macros
rules.add(new AutoconfMacroRule("m4_", new AutoconfM4WordDetector(), acmacro)); //$NON-NLS-1$
-
+
// Add rule for code sequences starting with <<EOF and ending with EOF
rules.add(new InlineDataRule(code));
-
+
// Add word rule for keywords.
- WordRule wordRule= new WordRule(new AutoconfWordDetector(), other);
- for (int i= 0; i < keywords.length; i++)
+ WordRule wordRule = new WordRule(new AutoconfWordDetector(), other);
+ for (int i = 0; i < keywords.length; i++)
wordRule.addWord(keywords[i], keyword);
rules.add(wordRule);
-
+
// Add word rule for identifier.
rules.add(new AutoconfIdentifierRule(other));
-
+
// Make sure we don't treat "\#" as comment start.
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
-
+
rules.add(new WhitespaceRule(new AutoconfWhitespaceDetector()));
-
- IRule[] result= new IRule[rules.size()];
+
+ IRule[] result = new IRule[rules.size()];
rules.toArray(result);
setRules(result);
}
-
+
@Override
public IToken nextToken() {
int ch = read();
@@ -159,30 +151,31 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
protected String[] getTokenProperties() {
return fTokenProperties;
}
-
+
private int indexOf(String property) {
if (property != null) {
- int length= fPropertyNamesColor.length;
- for (int i= 0; i < length; i++) {
- if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i]) || property.equals(fPropertyNamesItalic[i]))
+ int length = fPropertyNamesColor.length;
+ for (int i = 0; i < length; i++) {
+ if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i])
+ || property.equals(fPropertyNamesItalic[i]))
return i;
}
}
return -1;
}
-
+
public void incQuoteLevel() {
++quoteLevel;
}
-
+
public void decQuoteLevel() {
--quoteLevel;
}
-
+
public void resetQuoteLevel() {
quoteLevel = 0;
}
-
+
public int getQuoteLevel() {
return quoteLevel;
}
@@ -190,11 +183,11 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
public boolean affectsBehavior(PropertyChangeEvent event) {
return indexOf(event.getProperty()) >= 0;
}
-
+
public void adaptToPreferenceChange(PropertyChangeEvent event) {
- String p= event.getProperty();
- int index= indexOf(p);
- Token token= getToken(fPropertyNamesColor[index]);
+ String p = event.getProperty();
+ int index = indexOf(p);
+ Token token = getToken(fPropertyNamesColor[index]);
if (fPropertyNamesColor[index].equals(p))
adaptToColorChange(event, token);
else if (fPropertyNamesBold[index].equals(p))
@@ -204,73 +197,75 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
}
protected void adaptToColorChange(PropertyChangeEvent event, Token token) {
- RGB rgb= null;
- Object value= event.getNewValue();
+ RGB rgb = null;
+ Object value = event.getNewValue();
if (value instanceof RGB) {
- rgb= (RGB) value;
+ rgb = (RGB) value;
} else if (value instanceof String) {
- rgb= StringConverter.asRGB((String) value);
+ rgb = StringConverter.asRGB((String) value);
}
-
+
if (rgb != null) {
- TextAttribute attr= (TextAttribute) token.getData();
- token.setData(new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
+ TextAttribute attr = (TextAttribute) token.getData();
+ token.setData(
+ new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
}
}
protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) {
- if (token == null) {
+ if (token == null) {
return;
}
- boolean eventValue= false;
- Object value= event.getNewValue();
+ boolean eventValue = false;
+ Object value = event.getNewValue();
if (value instanceof Boolean) {
- eventValue= ((Boolean) value).booleanValue();
+ eventValue = ((Boolean) value).booleanValue();
} else if (IPreferenceStore.TRUE.equals(value)) {
- eventValue= true;
+ eventValue = true;
}
-
- TextAttribute attr= (TextAttribute) token.getData();
- boolean activeValue= (attr.getStyle() & styleAttribute) == styleAttribute;
- if (activeValue != eventValue) {
- token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(), eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
+
+ TextAttribute attr = (TextAttribute) token.getData();
+ boolean activeValue = (attr.getStyle() & styleAttribute) == styleAttribute;
+ if (activeValue != eventValue) {
+ token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(),
+ eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
}
}
protected TextAttribute createTextAttribute(String colorID, String boldKey, String italicKey) {
- Color color= null;
+ Color color = null;
if (colorID != null) {
- color= AutoconfEditor.getPreferenceColor(colorID);
+ color = AutoconfEditor.getPreferenceColor(colorID);
}
- IPreferenceStore store= AutotoolsPlugin.getDefault().getPreferenceStore();
- int style= store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
+ IPreferenceStore store = AutotoolsPlugin.getDefault().getPreferenceStore();
+ int style = store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
if (store.getBoolean(italicKey)) {
style |= SWT.ITALIC;
- }
+ }
return new TextAttribute(color, null, style);
}
-
+
/**
* Must be called after the constructor has been called.
*/
public final void initialize() {
-
+
resetQuoteLevel();
- fPropertyNamesColor= getTokenProperties();
- int length= fPropertyNamesColor.length;
- fPropertyNamesBold= new String[length];
- fPropertyNamesItalic= new String[length];
-
- for (int i= 0; i < length; i++) {
- fPropertyNamesBold[i]= fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
- fPropertyNamesItalic[i]= fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
+ fPropertyNamesColor = getTokenProperties();
+ int length = fPropertyNamesColor.length;
+ fPropertyNamesBold = new String[length];
+ fPropertyNamesItalic = new String[length];
+
+ for (int i = 0; i < length; i++) {
+ fPropertyNamesBold[i] = fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
+ fPropertyNamesItalic[i] = fPropertyNamesColor[i] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]);
}
}
@Override
public void unread() {
- --fOffset;
- fColumn = UNDEFINED;
+ --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 8f1a9e68a9d..0c52b4f325d 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
@@ -25,12 +25,10 @@ import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+public class AutoconfMacroContentAssistProcessor implements IContentAssistProcessor {
-public class AutoconfMacroContentAssistProcessor implements
- IContentAssistProcessor {
-
protected AutoconfEditor editor;
-
+
/**
* @since 2.0
*/
@@ -48,11 +46,10 @@ public class AutoconfMacroContentAssistProcessor implements
}
return offset;
}
-
+
@Override
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
- int offset) {
-
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
+
IDocument document = viewer.getDocument();
String prefix = ""; //$NON-NLS-1$
AutoconfMacro[] macros = AutoconfTextHover.getMacroList(editor);
@@ -80,11 +77,12 @@ public class AutoconfMacroContentAssistProcessor implements
if (macros[i].hasParms()) {
// Provide parameter info as context information that
// is tied to the completion proposal.
- ci = new AutoconfMacroProposalContextInformation(macros[i].getParms(), macros[i].getParms());
+ ci = new AutoconfMacroProposalContextInformation(macros[i].getParms(),
+ macros[i].getParms());
ci.setContextInformationPosition(offset - prefixLen + cursorPos - 1);
}
- ICompletionProposal cp = new CompletionProposal(template, offset - prefixLen, prefixLen, cursorPos, null,
- name, ci, AutoconfTextHover.getIndexedInfo(name, editor));
+ ICompletionProposal cp = new CompletionProposal(template, offset - prefixLen, prefixLen,
+ cursorPos, null, name, ci, AutoconfTextHover.getIndexedInfo(name, editor));
validList.add(cp);
}
}
@@ -96,8 +94,7 @@ public class AutoconfMacroContentAssistProcessor implements
}
@Override
- public IContextInformation[] computeContextInformation(ITextViewer viewer,
- int offset) {
+ public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
// 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 500a65ecf18..8342498a1cc 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
@@ -17,12 +17,12 @@ import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.rules.ITokenScanner;
public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer {
-
+
public final static String UNMATCHED_RIGHT_PARENTHESIS = "UnmatchedRightParenthesis"; //$NON-NLS-1$
public final static String UNMATCHED_LEFT_PARENTHESIS = "UnmatchedLeftParenthesis"; //$NON-NLS-1$
public final static String UNMATCHED_RIGHT_QUOTE = "UnmatchedRightQuote"; //$NON-NLS-1$
public final static String UNMATCHED_LEFT_QUOTE = "UnmatchedLeftQuote"; //$NON-NLS-1$
-
+
/**
* Creates a damager/repairer that uses the given scanner. The scanner may
* not be <code>null</code> and is assumed to return only token that carry
@@ -35,5 +35,4 @@ public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer {
super(scanner);
}
-
}
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 8be1334c3c1..bf82fd3505f 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
@@ -28,7 +28,7 @@ import org.eclipse.swt.custom.StyleRange;
/**
* This class provides the macro call parameter parsing for the Autoconf Editor hover
* It is modified from the CDT class CParameterListValidator
- *
+ *
* @author jjohnstn
*
*/
@@ -36,25 +36,25 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
private int fPosition;
private ITextViewer fViewer;
private IContextInformation fInformation;
-
+
private int fCurrentParameter;
-
+
public AutoconfMacroParameterListValidator() {
}
-
+
@Override
public void install(IContextInformation info, ITextViewer viewer, int documentPosition) {
-
- fPosition= documentPosition;
- fViewer= viewer;
- fInformation= info;
-
- fCurrentParameter= -1;
+
+ fPosition = documentPosition;
+ fViewer = viewer;
+ fInformation = info;
+
+ fCurrentParameter = -1;
}
-
+
private int getStringEnd(IDocument d, int pos, int end, char ch) throws BadLocationException {
while (pos < end) {
- char curr= d.getChar(pos);
+ char curr = d.getChar(pos);
pos++;
if (curr == '\\') {
// ignore escaped characters
@@ -65,12 +65,12 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
}
return end;
}
-
- private int getCharCount(IDocument document, int start, int end,
- char increment, char decrement, boolean considerNesting) throws BadLocationException {
-
+
+ private int getCharCount(IDocument document, int start, int end, char increment, char decrement,
+ boolean considerNesting) throws BadLocationException {
+
Assert.isTrue((increment != 0 || decrement != 0) && increment != decrement);
-
+
// There are two nesting levels to worry about. Arguments can be
// quoted with [] which means to treat the contents as one arg.
// As well, macro calls can be nested within macro calls so we
@@ -81,131 +81,130 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
while (start < end) {
char curr = document.getChar(start++);
switch (curr) {
- case 'd':
- if (start < end - 2) {
- char next= document.getChar(start);
- if (next == 'n') {
- // a comment starts, advance to the comment end
- next = document.getChar(start + 1);
- if (next == 'l')
- // dnl-comment: nothing to do anymore on this line
- start= end;
- }
+ case 'd':
+ if (start < end - 2) {
+ char next = document.getChar(start);
+ if (next == 'n') {
+ // a comment starts, advance to the comment end
+ next = document.getChar(start + 1);
+ if (next == 'l')
+ // dnl-comment: nothing to do anymore on this line
+ start = end;
}
+ }
+ break;
+ case '"':
+ case '\'':
+ start = getStringEnd(document, start, end, curr);
+ break;
+ default:
+ if ('[' == curr)
+ ++macroQuotingLevel;
+ else if (']' == curr)
+ --macroQuotingLevel;
+ if (macroQuotingLevel != 0)
break;
- case '"':
- case '\'':
- start= getStringEnd(document, start, end, curr);
- break;
- default:
- if ('[' == curr)
- ++ macroQuotingLevel;
- else if (']' == curr)
- -- macroQuotingLevel;
- if (macroQuotingLevel != 0)
- break;
- if (considerNesting) {
- if ('(' == curr)
- ++ macroNestingLevel;
- else if (')' == curr) {
- -- macroNestingLevel;
- }
- if (macroNestingLevel != 0)
- break;
+ if (considerNesting) {
+ if ('(' == curr)
+ ++macroNestingLevel;
+ else if (')' == curr) {
+ --macroNestingLevel;
}
- if (increment != 0) {
- if (curr == increment) {
- ++charCount;
- }
+ if (macroNestingLevel != 0)
+ break;
+ }
+ if (increment != 0) {
+ if (curr == increment) {
+ ++charCount;
}
-
- if (decrement != 0) {
- if (curr == decrement) {
- -- charCount;
- }
+ }
+
+ if (decrement != 0) {
+ if (curr == decrement) {
+ --charCount;
}
+ }
}
}
-
+
return charCount;
}
-
+
@Override
- public boolean isContextInformationValid(int position) {
-
+ public boolean isContextInformationValid(int position) {
+
try {
if (position < fPosition)
return false;
-
- IDocument document= fViewer.getDocument();
- IRegion line= document.getLineInformationOfOffset(fPosition);
-
+
+ IDocument document = fViewer.getDocument();
+ IRegion line = document.getLineInformationOfOffset(fPosition);
+
if (position > line.getOffset() + line.getLength())
return false;
-
+
return (getCharCount(document, fPosition, position, '(', ')', false) >= 0);
-
+
} catch (BadLocationException x) {
return false;
}
}
-
+
@Override
public boolean updatePresentation(int position, TextPresentation presentation) {
- int currentParameter= -1;
+ int currentParameter = -1;
try {
- currentParameter= getCharCount(fViewer.getDocument(), fPosition, position, ',', (char) 0, true);
+ currentParameter = getCharCount(fViewer.getDocument(), fPosition, position, ',', (char) 0, true);
} catch (BadLocationException x) {
return false;
}
-
+
if (fCurrentParameter != -1) {
if (currentParameter == fCurrentParameter)
return false;
}
-
+
presentation.clear();
- fCurrentParameter= currentParameter;
-
+ fCurrentParameter = currentParameter;
+
//Don't presume what has been done to the string, rather use as is
- String s= fInformation.getInformationDisplayString();
-
+ String s = fInformation.getInformationDisplayString();
+
//@@@ This is obviously going to have problems with functions such
//int myfunction(int (*function_argument)(void * extra, int param), void * extra)
//int myfunction(/*A comment, indeed */int a);
- int start= 0;
- int occurrences= 0;
+ int start = 0;
+ int occurrences = 0;
while (occurrences < fCurrentParameter) {
- int found= s.indexOf(',', start);
+ int found = s.indexOf(',', start);
if (found == -1)
break;
- start= found + 1;
- ++ occurrences;
+ start = found + 1;
+ ++occurrences;
}
-
+
if (occurrences < fCurrentParameter) {
presentation.addStyleRange(new StyleRange(0, s.length(), null, null, SWT.NORMAL));
return true;
}
-
+
if (start == -1)
- start= 0;
-
- int end= s.indexOf(',', start);
+ start = 0;
+
+ int end = s.indexOf(',', start);
if (end == -1)
- end= s.length();
-
- if (start > 0)
+ end = s.length();
+
+ if (start > 0)
presentation.addStyleRange(new StyleRange(0, start, null, null, SWT.NORMAL));
-
+
if (end > start)
presentation.addStyleRange(new StyleRange(start, end - start, null, null, SWT.BOLD));
-
+
if (end < s.length())
presentation.addStyleRange(new StyleRange(end, s.length() - end, null, null, SWT.NORMAL));
-
+
return true;
}
}
-
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 ceab6f745d9..a9648801a98 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
@@ -20,7 +20,6 @@ import org.eclipse.jface.text.rules.IWhitespaceDetector;
import org.eclipse.jface.text.rules.IWordDetector;
import org.eclipse.jface.text.rules.Token;
-
public class AutoconfMacroPartitionRule implements IPredicateRule {
/**
* The default token to be returned on success and if nothing else has been
@@ -52,7 +51,7 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
public IToken getSuccessToken() {
return token;
}
-
+
protected void matchParentheses(ICharacterScanner scanner) {
boolean finished = false;
int depth = 1;
@@ -61,50 +60,48 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
while (!finished && c != ICharacterScanner.EOF) {
if (c == '[') {
++quoteDepth;
- }
- else if (c == ']') {
+ } else if (c == ']') {
--quoteDepth;
if (quoteDepth < 0)
finished = true;
}
if (quoteDepth == 0) {
if (c == ')') {
- --depth;
- if (depth <= 0)
- finished = true;
- }
- else if (c == '(') {
+ --depth;
+ if (depth <= 0)
+ finished = true;
+ } else if (c == '(') {
++depth;
}
}
c = scanner.read();
}
}
-
+
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
-// if (resume)
-// return Token.UNDEFINED;
+ // if (resume)
+ // return Token.UNDEFINED;
return evaluate(scanner);
}
-
+
@Override
public IToken evaluate(ICharacterScanner scanner) {
int c = scanner.read();
fBuffer.setLength(0);
- fBuffer.append((char)c);
+ fBuffer.append((char) c);
if (c == 'A') {
c = scanner.read();
- fBuffer.append((char)c);
+ fBuffer.append((char) c);
if (c != 'C' && c != 'H' && c != 'M') {
unreadBuffer(scanner);
- return Token.UNDEFINED;
+ return Token.UNDEFINED;
}
fDetector = generalMacroWordDetector;
} else if (c == 'm') {
c = scanner.read();
- fBuffer.append((char)c);
+ fBuffer.append((char) c);
if (c != 4) {
unreadBuffer(scanner);
return Token.UNDEFINED;
@@ -114,22 +111,19 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
unreadBuffer(scanner);
return Token.UNDEFINED;
}
-
- c = scanner.read();
- while (c != ICharacterScanner.EOF
- && fDetector.isWordPart((char) c)) {
+
+ c = scanner.read();
+ while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c)) {
fBuffer.append((char) c);
c = scanner.read();
}
if (c != ICharacterScanner.EOF) {
- if (c == ';' || fWsDetector.isWhitespace((char)c)) {
+ if (c == ';' || fWsDetector.isWhitespace((char) c)) {
// We are done
- }
- else if (c == '(') {
+ } else if (c == '(') {
matchParentheses(scanner);
- }
- else {
+ } else {
scanner.unread();
unreadBuffer(scanner);
return Token.UNDEFINED;
@@ -142,7 +136,7 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
/**
* Returns the characters in the buffer to the scanner.
- *
+ *
* @param scanner
* the scanner to be used
*/
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 d127863dc1e..32e8c6c5e33 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
@@ -51,41 +51,43 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat
* @param informationDisplayString the string to be displayed when presenting the context information,
* may not be <code>null</code>
*/
- public AutoconfMacroProposalContextInformation(Image image, String contextDisplayString, String informationDisplayString) {
+ public AutoconfMacroProposalContextInformation(Image image, String contextDisplayString,
+ String informationDisplayString) {
//Assert.isNotNull(informationDisplayString);
- fImage= image;
- fContextDisplayString= contextDisplayString;
- fInformationDisplayString= informationDisplayString;
+ fImage = image;
+ fContextDisplayString = contextDisplayString;
+ fInformationDisplayString = informationDisplayString;
}
@Override
public boolean equals(Object object) {
if (object instanceof IContextInformation) {
- IContextInformation contextInformation= (IContextInformation) object;
- boolean equals= fInformationDisplayString.equalsIgnoreCase(contextInformation.getInformationDisplayString());
- if (fContextDisplayString != null)
- equals= equals && fContextDisplayString.equalsIgnoreCase(contextInformation.getContextDisplayString());
+ IContextInformation contextInformation = (IContextInformation) object;
+ boolean equals = fInformationDisplayString
+ .equalsIgnoreCase(contextInformation.getInformationDisplayString());
+ if (fContextDisplayString != null)
+ equals = equals && fContextDisplayString.equalsIgnoreCase(contextInformation.getContextDisplayString());
return equals;
}
return false;
}
-
+
@Override
public int hashCode() {
String combined = fInformationDisplayString.toLowerCase().concat(fContextDisplayString.toLowerCase());
return combined.hashCode();
}
-
+
@Override
public String getInformationDisplayString() {
return fInformationDisplayString;
}
-
+
@Override
public Image getImage() {
return fImage;
}
-
+
@Override
public String getContextDisplayString() {
if (fContextDisplayString != null)
@@ -97,8 +99,8 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat
public int getContextInformationPosition() {
return fInformationPosition;
}
-
- public void setContextInformationPosition( int pos ){
+
+ public void setContextInformationPosition(int pos) {
fInformationPosition = pos;
}
}
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 4b4a3daf3bc..cca1412eeb4 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
@@ -41,8 +41,7 @@ public class AutoconfMacroRule implements IRule {
private String fStartingSequence;
- public AutoconfMacroRule(String startingSequence,
- IWordDetector detector, IToken inToken) {
+ public AutoconfMacroRule(String startingSequence, IWordDetector detector, IToken inToken) {
token = inToken;
fDetector = detector;
fStartingSequence = startingSequence;
@@ -62,14 +61,12 @@ public class AutoconfMacroRule implements IRule {
c = scanner.read();
}
- while (c != ICharacterScanner.EOF
- && fDetector.isWordPart((char) c)) {
+ while (c != ICharacterScanner.EOF && fDetector.isWordPart((char) c)) {
fBuffer.append((char) c);
c = scanner.read();
}
- if (c != ICharacterScanner.EOF && c != '(' && c != ';'
- && !fWsDetector.isWhitespace((char)c)) {
+ if (c != ICharacterScanner.EOF && c != '(' && c != ';' && !fWsDetector.isWhitespace((char) c)) {
unreadBuffer(scanner);
return Token.UNDEFINED;
}
@@ -80,7 +77,7 @@ public class AutoconfMacroRule implements IRule {
/**
* Returns the characters in the buffer to the scanner.
- *
+ *
* @param scanner
* the scanner to be used
*/
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 12694a985ee..edf328ef927 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
@@ -19,8 +19,7 @@ public class AutoconfMacroWordDetector implements IWordDetector {
@Override
public boolean isWordPart(char c) {
- return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
- Character.isDigit(c) || c == '_');
+ return ((Character.isLetter(c) && Character.isUpperCase(c)) || Character.isDigit(c) || c == '_');
}
@Override
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 a5235bbadc2..295db31b608 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
@@ -19,8 +19,7 @@ public class AutoconfPKGWordDetector implements IWordDetector {
@Override
public boolean isWordPart(char c) {
- return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
- Character.isDigit(c) || c == '_');
+ return ((Character.isLetter(c) && Character.isUpperCase(c)) || Character.isDigit(c) || c == '_');
}
@Override
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 7b75091395c..58ede93f70c 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
@@ -24,37 +24,35 @@ import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
public class AutoconfPartitionScanner extends RuleBasedPartitionScanner {
-
+
public final static String AUTOCONF_MACRO = "autoconf_macro"; //$NON-NLS-1$
public final static String AUTOCONF_COMMENT = "autoconf_comment"; //$NON-NLS-1$
- final static String[] AUTOCONF_PARTITION_TYPES=
- new String[] { AUTOCONF_MACRO, AUTOCONF_COMMENT };
-
+ final static String[] AUTOCONF_PARTITION_TYPES = new String[] { AUTOCONF_MACRO, AUTOCONF_COMMENT };
+
/**
* Creates the partitioner and sets up the appropriate rules.
*/
public AutoconfPartitionScanner() {
super();
-
- List<IRule> rules= new ArrayList<>();
+
+ List<IRule> rules = new ArrayList<>();
Token macro = new Token(AUTOCONF_MACRO);
Token comment = new Token(AUTOCONF_COMMENT);
// Add rule for target bodies.
rules.add(new AutoconfMacroPartitionRule(macro));
-
rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
rules.add(new EndOfLineRule("#", comment, '\\')); //$NON-NLS-1$
-
+
// We want to process identifiers that might have macro
// names inside them.
rules.add(new AutoconfIdentifierRule(Token.UNDEFINED));
- IPredicateRule[] result= new IPredicateRule[rules.size()];
+ IPredicateRule[] result = new IPredicateRule[rules.size()];
rules.toArray(result);
setPredicateRules(result);
}
-
+
}
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 2bda1c4fca9..846f7a73423 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
@@ -25,38 +25,32 @@ public class AutoconfPartitioner extends FastPartitioner {
// TODO Auto-generated constructor stub
super(scanner, legalContentTypes);
}
-
+
public void connect(IDocument document, int blah) {
super.connect(document);
}
-
+
// 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) {
+ public ITypedRegion[] computePartitioning(int offset, int length, boolean includeZeroLength) {
ITypedRegion[] regions = super.computePartitioning(offset, length, includeZeroLength);
// Uncomment the following line to see partitioning.
-// printPartitions(regions);
+ // printPartitions(regions);
return regions;
}
-
- public void printPartitions(ITypedRegion[] partitions)
- {
- for (int i = 0; i < partitions.length; i++)
- {
- try
- {
+
+ public void printPartitions(ITypedRegion[] partitions) {
+ for (int i = 0; i < partitions.length; i++) {
+ try {
System.out.print("Partition type: " + partitions[i].getType() //$NON-NLS-1$
+ ", offset: " + partitions[i].getOffset() //$NON-NLS-1$
+ ", length: " + partitions[i].getLength() //$NON-NLS-1$
- +"\nText:\n" //$NON-NLS-1$
+ + "\nText:\n" //$NON-NLS-1$
+ super.fDocument.get(partitions[i].getOffset(), partitions[i].getLength())
+ "\n---------------------------\n\n\n"); //$NON-NLS-1$
- }
- catch (BadLocationException e)
- {
+ } catch (BadLocationException e) {
e.printStackTrace();
}
}
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 fd8f84df3d5..306c67bfe71 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
@@ -21,27 +21,26 @@ import org.eclipse.jface.text.reconciler.DirtyRegion;
import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
import org.eclipse.ui.texteditor.IDocumentProvider;
-
public class AutoconfReconcilingStrategy implements IReconcilingStrategy {
AutoconfContentOutlinePage outline;
-// int lastRegionOffset;
+ // int lastRegionOffset;
AutoconfEditor editor;
IDocumentProvider documentProvider;
-
+
public AutoconfReconcilingStrategy(AutoconfEditor editor) {
- outline= editor.getOutlinePage();
-// lastRegionOffset = Integer.MAX_VALUE;
+ outline = editor.getOutlinePage();
+ // lastRegionOffset = Integer.MAX_VALUE;
this.editor = editor;
documentProvider = editor.getDocumentProvider();
}
-
+
@Override
public void reconcile(IRegion partition) {
try {
AutoconfParser parser = editor.getAutoconfParser();
- ((AutoconfErrorHandler)parser.getErrorHandler()).removeAllExistingMarkers();
-
+ ((AutoconfErrorHandler) parser.getErrorHandler()).removeAllExistingMarkers();
+
editor.setRootElement(parser.parse(documentProvider.getDocument(editor.getEditorInput())));
outline.update();
} catch (Exception e) {
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 7acfbb04f07..311550a8d43 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
@@ -29,19 +29,17 @@ import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-
-public class AutoconfSourceViewerConfiguration extends
- TextSourceViewerConfiguration {
+public class AutoconfSourceViewerConfiguration extends TextSourceViewerConfiguration {
private ITextHover acHover;
private IAnnotationHover aaHover;
private AutoconfEditor fEditor;
-
+
public AutoconfSourceViewerConfiguration(IPreferenceStore prefs, AutoconfEditor editor) {
super(prefs);
fEditor = editor;
}
-
+
@Override
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
return AutoconfEditor.AUTOCONF_PARTITIONING;
@@ -50,7 +48,7 @@ public class AutoconfSourceViewerConfiguration extends
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
ContentAssistant assistant = new ContentAssistant();
-
+
IContentAssistProcessor macroContentAssistProcessor = new AutoconfMacroContentAssistProcessor(fEditor);
assistant.setContentAssistProcessor(macroContentAssistProcessor, AutoconfPartitionScanner.AUTOCONF_MACRO);
assistant.setContentAssistProcessor(macroContentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
@@ -59,38 +57,38 @@ public class AutoconfSourceViewerConfiguration extends
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
assistant.setInformationControlCreator(AutoconfTextHover.getInformationControlCreator());
-
+
return assistant;
}
-
+
@Override
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
- AutoconfPartitionScanner.AUTOCONF_MACRO,
- AutoconfPartitionScanner.AUTOCONF_COMMENT};
+ 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;
}
-
+
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
- MonoReconciler reconciler= new MonoReconciler(new AutoconfReconcilingStrategy(fEditor), false);
+ MonoReconciler reconciler = new MonoReconciler(new AutoconfReconcilingStrategy(fEditor), false);
reconciler.setDelay(1000);
reconciler.setProgressMonitor(new NullProgressMonitor());
return reconciler;
}
+
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
return new AutoconfPresentationReconciler();
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/IAutotoolsEditor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/IAutotoolsEditor.java
index ef1dc09dc3a..b0ab19b0766 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/IAutotoolsEditor.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/IAutotoolsEditor.java
@@ -13,13 +13,12 @@ package org.eclipse.cdt.autotools.ui.editors;
import org.eclipse.cdt.internal.autotools.ui.editors.automake.IReconcilingParticipant;
import org.eclipse.ui.texteditor.ITextEditor;
-
public interface IAutotoolsEditor extends ITextEditor {
-
+
/**
* Adds the given listener.
* Has no effect if an identical listener was not already registered.
- *
+ *
* @param listener The reconcile listener to be added
*/
void addReconcilingParticipant(IReconcilingParticipant listener);
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 7b77ba15de5..31a59f02742 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
@@ -49,11 +49,11 @@ public class InlineDataRule implements IRule {
protected boolean confirmDelimeter(ICharacterScanner scanner, char[] delimeter) {
int c = scanner.read();
StringBuilder buffer = new StringBuilder();
- buffer.append((char)c);
+ buffer.append((char) c);
for (int i = 1; i < delimeter.length; ++i) {
if (c == delimeter[i]) {
c = scanner.read();
- buffer.append((char)c);
+ buffer.append((char) c);
} else {
for (int j = buffer.length() - 1; j >= 0; j--)
scanner.unread();
@@ -63,6 +63,7 @@ public class InlineDataRule implements IRule {
scanner.unread();
return true;
}
+
@Override
public IToken evaluate(ICharacterScanner scanner) {
int c = scanner.read();
@@ -81,31 +82,29 @@ public class InlineDataRule implements IRule {
char[][] lineDelimeters = scanner.getLegalLineDelimiters();
StringBuilder endMarkerBuffer = new StringBuilder();
if (c == '-') {
- fBuffer.append((char)c);
+ fBuffer.append((char) c);
c = scanner.read();
} else if (c == '\'') {
- fBuffer.append((char)c);
+ fBuffer.append((char) c);
c = scanner.read();
}
-
- while (c != ICharacterScanner.EOF &&
- Character.isJavaIdentifierPart((char)c) &&
- c != '\'') {
- fBuffer.append((char)c);
- endMarkerBuffer.append((char)c);
+
+ while (c != ICharacterScanner.EOF && Character.isJavaIdentifierPart((char) c) && c != '\'') {
+ fBuffer.append((char) c);
+ endMarkerBuffer.append((char) c);
c = scanner.read();
}
-
+
if (c == '\'') {
- fBuffer.append((char)c);
+ fBuffer.append((char) c);
c = scanner.read();
}
-
+
if (endMarkerBuffer.length() == 0) {
unreadBuffer(scanner);
return Token.UNDEFINED;
}
-
+
// At this point we read until we find id by itself on its own line
boolean eol = false;
boolean finished = false;
@@ -157,7 +156,7 @@ public class InlineDataRule implements IRule {
/**
* Returns the characters in the buffer to the scanner.
- *
+ *
* @param scanner
* the scanner to be used
*/
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 0311151be1f..ebcc4572926 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
@@ -20,8 +20,7 @@ import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.rules.ITokenScanner;
public class MultilineRuleDamagerRepairer extends DefaultDamagerRepairer {
-
-
+
/**
* Creates a damager/repairer that uses the given scanner. The scanner may not be <code>null</code>
* and is assumed to return only token that carry text attributes.
@@ -41,5 +40,5 @@ public class MultilineRuleDamagerRepairer extends DefaultDamagerRepairer {
// rule. It is easiest to just reparse the whole partition.
return partition;
}
-
+
}
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 81d684a0b1a..a4c6420f95d 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
@@ -14,38 +14,47 @@
package org.eclipse.cdt.autotools.ui.editors;
public class ParseException extends Exception {
-
+
static final long serialVersionUID = 1;
String message;
int severity;
int lineNumber;
int startColumn;
int endColumn;
+
public int getEndColumn() {
return endColumn;
}
+
public void setEndColumn(int endColumn) {
this.endColumn = endColumn;
}
+
public int getLineNumber() {
return lineNumber;
}
+
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
+
@Override
public String getMessage() {
return message;
}
+
public void setMessage(String message) {
this.message = message;
}
+
public int getStartColumn() {
return startColumn;
}
+
public void setStartColumn(int startColumn) {
this.startColumn = startColumn;
}
+
public ParseException(String message, int lineNumber, int startColumn, int endColumn, int severity) {
super();
this.message = message;
@@ -54,9 +63,11 @@ public class ParseException extends Exception {
this.endColumn = endColumn;
this.severity = severity;
}
+
public int getSeverity() {
return severity;
}
+
public void setSeverity(int severity) {
this.severity = severity;
}
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 c044af9df5f..db93d1d5ba1 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
@@ -23,7 +23,7 @@ import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
public class RecursiveSingleLineRule extends SingleLineRule {
-
+
private List<IRule> rules;
private int evalIndex;
private int startIndex;
@@ -31,6 +31,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
private int endBoundary;
private String startSequence;
private String endSequence;
+
/**
* Creates a rule for the given starting and ending sequence
* which, if detected, will return the specified token.
@@ -72,7 +73,8 @@ public class RecursiveSingleLineRule extends SingleLineRule {
* @param breaksOnEOF indicates whether the end of the file successfully terminates this rule
* @since 2.1
*/
- public RecursiveSingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter, boolean breaksOnEOF) {
+ public RecursiveSingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter,
+ boolean breaksOnEOF) {
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF);
this.startSequence = startSequence;
this.endSequence = endSequence;
@@ -99,7 +101,8 @@ public class RecursiveSingleLineRule extends SingleLineRule {
* terminate the line, even if <code>breakOnEOL</code> is true
* @since 3.0
*/
- public RecursiveSingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter, boolean breaksOnEOF, boolean escapeContinuesLine) {
+ public RecursiveSingleLineRule(String startSequence, String endSequence, IToken token, char escapeCharacter,
+ boolean breaksOnEOF, boolean escapeContinuesLine) {
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF, escapeContinuesLine);
this.startSequence = startSequence;
this.endSequence = endSequence;
@@ -107,29 +110,29 @@ public class RecursiveSingleLineRule extends SingleLineRule {
startIndex = 0;
endIndex = 0;
}
-
+
public void addRule(SingleLineRule rule) {
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
// one.
if (evalIndex < rules.size()) {
- SingleLineRule x = (SingleLineRule)rules.get(evalIndex);
+ SingleLineRule x = (SingleLineRule) rules.get(evalIndex);
return x.getSuccessToken();
}
return super.getSuccessToken();
}
-
+
protected void backupScanner(ICharacterScanner scanner, int position) {
int count = scanner.getColumn() - position;
while (count-- > 0)
scanner.unread();
}
-
+
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
int column = scanner.getColumn();
@@ -153,8 +156,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
// Back up scanner to just after start sequence.
backupScanner(scanner, startIndex + startSequence.length());
return super.getSuccessToken();
- }
- else
+ } else
// Outer rule doesn't hold.
return Token.UNDEFINED;
}
@@ -163,12 +165,12 @@ public class RecursiveSingleLineRule extends SingleLineRule {
// At this point, we want to subdivide up the area covered by the
// outer rule into success tokens for internal areas separated by
// areas of the outer rule.
-
+
int start = scanner.getColumn();
column = start;
while (column < endBoundary) {
while (evalIndex < rules.size()) {
- SingleLineRule x = (SingleLineRule)rules.get(evalIndex);
+ SingleLineRule x = (SingleLineRule) rules.get(evalIndex);
IToken token = x.evaluate(scanner, false);
if (!token.isUndefined()) {
// Found internal token. If we had to read to get
@@ -190,7 +192,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
scanner.read();
++column;
}
-
+
// Outside internal area. Read until end of outer area and return
// outer token.
while (column++ < endIndex)
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 1946c5e3413..8e2be77f6b6 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
@@ -24,12 +24,13 @@ import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
public class RestrictedEndOfLineRule extends EndOfLineRule {
-
+
private List<IRule> rules;
private int startIndex;
private int endIndex;
private String startSequence;
private String restrictedChars;
+
/**
* Creates a rule for the given starting and ending sequence
* which, if detected, will return the specified token.
@@ -71,7 +72,8 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
* @param breaksOnEOF indicates whether the end of the file successfully terminates this rule
* @since 2.1
*/
- public RestrictedEndOfLineRule(String startSequence, String restrictedChars, IToken token, char escapeCharacter, boolean breaksOnEOF) {
+ public RestrictedEndOfLineRule(String startSequence, String restrictedChars, IToken token, char escapeCharacter,
+ boolean breaksOnEOF) {
super(startSequence, token, escapeCharacter, breaksOnEOF);
this.startSequence = startSequence;
this.restrictedChars = restrictedChars;
@@ -80,18 +82,16 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
endIndex = 0;
}
-
public void addRule(SingleLineRule rule) {
rules.add(rule);
}
-
-
+
protected void backupScanner(ICharacterScanner scanner, int position) {
int count = scanner.getColumn() - position;
while (count-- > 0)
scanner.unread();
}
-
+
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
int column = scanner.getColumn();
@@ -108,21 +108,19 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
endIndex = scanner.getColumn();
// Back up scanner to just after start sequence.
backupScanner(scanner, startIndex + startSequence.length());
- }
- else
+ } else
// Base rule doesn't hold.
return Token.UNDEFINED;
}
// At this point, we want to check for restricted chars in the
// token. If we find them, we stop there.
-
+
int start = scanner.getColumn();
column = start;
while (column < endIndex) {
int ch = scanner.read();
- if (ch == ICharacterScanner.EOF
- || restrictedChars.indexOf(ch) >= 0) {
+ if (ch == ICharacterScanner.EOF || restrictedChars.indexOf(ch) >= 0) {
scanner.unread();
return getSuccessToken();
}
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 9eb36fea630..64b16736ed9 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
@@ -32,13 +32,12 @@ import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-
public class AutoconfContentOutlinePage extends ContentOutlinePage {
private ITextEditor editor;
private IEditorInput input;
private LexicalSortingAction sortAction;
-
+
public AutoconfContentOutlinePage(AutoconfEditor editor) {
super();
this.editor = editor;
@@ -50,14 +49,14 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
}
protected ISelection updateSelection(ISelection sel) {
- ArrayList<AutoconfElement> newSelection= new ArrayList<>();
+ ArrayList<AutoconfElement> newSelection = new ArrayList<>();
if (sel instanceof IStructuredSelection) {
Iterator<?> iter = ((IStructuredSelection) sel).iterator();
- for (;iter.hasNext();) {
+ for (; iter.hasNext();) {
//ICElement elem= fInput.findEqualMember((ICElement)iter.next());
Object o = iter.next();
if (o instanceof AutoconfElement) {
- newSelection.add((AutoconfElement)o);
+ newSelection.add((AutoconfElement) o);
}
}
}
@@ -69,11 +68,9 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
//update the tree viewer state
final TreeViewer viewer = getTreeViewer();
- if (viewer != null)
- {
+ if (viewer != null) {
final Control control = viewer.getControl();
- if (control != null && !control.isDisposed())
- {
+ if (control != null && !control.isDisposed()) {
control.getDisplay().asyncExec(() -> {
if (!control.isDisposed()) {
ISelection sel = viewer.getSelection();
@@ -84,13 +81,13 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
}
}
}
-
+
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- TreeViewer viewer= getTreeViewer();
+ TreeViewer viewer = getTreeViewer();
viewer.setContentProvider(new AutoconfContentProvider(editor));
viewer.setLabelProvider(new AutoconfLabelProvider());
viewer.addSelectionChangedListener(this);
@@ -100,23 +97,21 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
}
sortAction.setTreeViewer(viewer);
}
-
+
/*
* Change in selection
*/
@Override
- public void selectionChanged(SelectionChangedEvent event)
- {
+ public void selectionChanged(SelectionChangedEvent event) {
super.selectionChanged(event);
-
+
//find out which item in tree viewer we have selected, and set highlight range accordingly
ISelection selection = event.getSelection();
if (selection.isEmpty()) {
editor.resetHighlightRange();
} else {
- AutoconfElement element = (AutoconfElement) ((IStructuredSelection) selection)
- .getFirstElement();
-
+ AutoconfElement element = (AutoconfElement) ((IStructuredSelection) selection).getFirstElement();
+
try {
int offset = element.getStartOffset();
int length = element.getEndOffset() - offset;
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 477e2ce53be..7d198314853 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
@@ -24,21 +24,20 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
-
public class AutoconfContentProvider implements ITreeContentProvider {
private IDocumentProvider documentProvider;
private AutoconfEditor editor;
protected final static String SECTION_POSITIONS = "section_positions";
protected IPositionUpdater positionUpdater = new DefaultPositionUpdater(SECTION_POSITIONS);
-
+
public AutoconfContentProvider(ITextEditor editor) {
if (editor instanceof AutoconfEditor) {
this.editor = (AutoconfEditor) editor;
}
this.documentProvider = editor.getDocumentProvider();
}
-
+
@Override
public void dispose() {
// TODO Auto-generated method stub
@@ -47,27 +46,20 @@ public class AutoconfContentProvider implements ITreeContentProvider {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (oldInput != null)
- {
+ if (oldInput != null) {
IDocument document = documentProvider.getDocument(oldInput);
- if (document != null)
- {
- try
- {
+ if (document != null) {
+ try {
document.removePositionCategory(SECTION_POSITIONS);
- }
- catch (BadPositionCategoryException x)
- {
+ } catch (BadPositionCategoryException x) {
}
document.removePositionUpdater(positionUpdater);
}
}
- if (newInput != null)
- {
+ if (newInput != null) {
IDocument document = documentProvider.getDocument(newInput);
- if (document != null)
- {
+ if (document != null) {
document.addPositionCategory(SECTION_POSITIONS);
document.addPositionUpdater(positionUpdater);
}
@@ -77,7 +69,7 @@ public class AutoconfContentProvider implements ITreeContentProvider {
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof AutoconfElement) {
- AutoconfElement element = (AutoconfElement)parentElement;
+ AutoconfElement element = (AutoconfElement) parentElement;
return element.getChildren();
}
return new Object[0];
@@ -91,8 +83,8 @@ public class AutoconfContentProvider implements ITreeContentProvider {
@Override
public boolean hasChildren(Object element) {
if (element instanceof AutoconfElement) {
- return ((AutoconfElement)element).hasChildren();
- }
+ return ((AutoconfElement) element).hasChildren();
+ }
return false;
}
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 54a18bb9915..d7f92b41c91 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
@@ -31,13 +31,12 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;
-
public class AutoconfLabelProvider implements ILabelProvider {
public AutoconfLabelProvider() {
super();
}
-
+
@Override
public void addListener(ILabelProviderListener listener) {
}
@@ -72,9 +71,9 @@ public class AutoconfLabelProvider implements ILabelProvider {
else if (element instanceof AutoconfWhileElement)
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE);
else if (element instanceof AutoconfUntilElement)
- return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE); // TODO
+ return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE); // TODO
else if (element instanceof AutoconfSelectElement)
- return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE); // TODO
+ return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_WHILE); // TODO
else if (element instanceof AutoconfMacroElement)
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_ACMACRO);
else if (element instanceof AutoconfMacroArgumentElement)
@@ -85,7 +84,7 @@ public class AutoconfLabelProvider implements ILabelProvider {
@Override
public String getText(Object element) {
if (element instanceof AutoconfElement) {
- AutoconfElement e = (AutoconfElement)element;
+ AutoconfElement e = (AutoconfElement) element;
String result;
String name = e.getName();
if (name.length() > 31)
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseConditionElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseConditionElement.java
index c19185c5721..e20bb4c4d5a 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseConditionElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseConditionElement.java
@@ -14,11 +14,11 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfCaseConditionElement extends AutoconfElement {
-
+
public AutoconfCaseConditionElement() {
super("");
}
-
+
public AutoconfCaseConditionElement(String name) {
super(name);
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseElement.java
index f4a0001be61..dfcb31bdf3d 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfCaseElement.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfCaseElement extends AutoconfElement {
-
+
public AutoconfCaseElement() {
super("case"); //$NON-NLS-1$
}
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 00143c5c8af..d0a18fa6aec 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
@@ -20,7 +20,7 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
public class AutoconfElement {
-
+
protected String name;
protected String var;
protected int startOffset;
@@ -28,18 +28,17 @@ public class AutoconfElement {
protected List<AutoconfElement> children;
protected AutoconfElement parent;
private IDocument document;
-
+
public AutoconfElement(String name) {
this(name, null);
}
-
+
public AutoconfElement(String name, String var) {
this.name = name;
this.var = var;
this.startOffset = 0;
this.children = new ArrayList<>();
}
-
@Override
public String toString() {
@@ -54,35 +53,35 @@ public class AutoconfElement {
}
return getClass().getSimpleName() + ": '" + source + "'"; //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
public void addChild(AutoconfElement element) {
children.add(element);
if (element.getParent() == null)
element.setParent(this);
}
-
+
public void addSibling(AutoconfElement element) {
parent.addChild(element);
}
-
+
public AutoconfElement getLastChild() {
if (hasChildren())
return children.get(children.size() - 1);
return null;
}
-
+
public AutoconfElement getParent() {
return parent;
}
-
+
public void setParent(AutoconfElement parent) {
this.parent = parent;
}
-
+
public AutoconfElement[] getChildren() {
return children.toArray(new AutoconfElement[children.size()]);
}
-
+
public boolean hasChildren() {
return !children.isEmpty();
}
@@ -90,40 +89,39 @@ public class AutoconfElement {
public String getName() {
return name;
}
-
+
public void setName(String string) {
this.name = string;
}
-
public String getVar() {
return var;
}
-
+
public void setVar(String value) {
var = value;
}
-
+
public void setDocument(IDocument document) {
this.document = document;
}
-
+
public IDocument getDocument() {
return document;
}
-
+
public void setStartOffset(int offset) {
this.startOffset = offset;
}
-
+
public int getStartOffset() {
return startOffset;
}
-
+
public void setEndOffset(int offset) {
this.endOffset = offset;
}
-
+
public int getEndOffset() {
return endOffset;
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElifElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElifElement.java
index 85a0446662e..78f503df25d 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElifElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElifElement.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfElifElement extends AutoconfElement {
-
+
public AutoconfElifElement() {
super("elif"); //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElseElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElseElement.java
index d847e5b7906..0587d20a2c4 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElseElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfElseElement.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfElseElement extends AutoconfElement {
-
+
public AutoconfElseElement() {
super("else"); //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfForElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfForElement.java
index db3b54b0b3d..b52b44c7a15 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfForElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfForElement.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfForElement extends AutoconfElement {
-
+
public AutoconfForElement() {
super("for"); //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfIfElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfIfElement.java
index 2b1cda67d14..1f31e481bfc 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfIfElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfIfElement.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfIfElement extends AutoconfElement {
-
+
public AutoconfIfElement() {
super("if"); //$NON-NLS-1$
}
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 790be81174b..672401fb43a 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() {
super(""); // //$NON-NLS-N$
}
+
public AutoconfMacroArgumentElement(String name) {
super(name);
}
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 3226a1b3a08..557c452a297 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
@@ -20,7 +20,7 @@ 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$
-
+
@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 e2be72d53aa..fc2258b8f5e 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
@@ -13,10 +13,11 @@
* Ed Swartz (NOKIA Inc) - support standalone parser
*******************************************************************************/
package org.eclipse.cdt.autotools.ui.editors.parser;
+
/**
* A call to a macro.
* <p>
- * Macro element now stores arguments as AutoconfMacroElement or AutoconfMacroArgument children
+ * Macro element now stores arguments as AutoconfMacroElement or AutoconfMacroArgument children
*
*/
public class AutoconfMacroElement extends AutoconfElement {
@@ -32,6 +33,7 @@ public class AutoconfMacroElement extends AutoconfElement {
else
return null;
}
+
public int getParameterCount() {
return children.size();
}
@@ -45,9 +47,9 @@ public class AutoconfMacroElement extends AutoconfElement {
* Children of his class should overwrite this and perform proper
* validation.
* @param verions Autoconf to be used to validate this macro.
- * @throws InvalidMacroException
+ * @throws InvalidMacroException
*/
- public void validate (String version) throws InvalidMacroException {}
+ public void validate(String version) throws InvalidMacroException {
+ }
-
}
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 952b30fdc0e..195bcbdd609 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
@@ -30,17 +30,14 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.texteditor.MarkerUtilities;
-
public class AutoconfOutlineErrorHandler {
-
- public static final String PARSE_ERROR_MARKER_ID = AutotoolsUIPlugin.PLUGIN_ID
- + ".outlineparsefileerror"; //$NON-NLS-1$
-
+
+ public static final String PARSE_ERROR_MARKER_ID = AutotoolsUIPlugin.PLUGIN_ID + ".outlineparsefileerror"; //$NON-NLS-1$
+
private IFile file;
private IDocument document;
-
- public AutoconfOutlineErrorHandler(IStorageEditorInput input, IDocument document)
- {
+
+ public AutoconfOutlineErrorHandler(IStorageEditorInput input, IDocument document) {
this.document = document;
IWorkspaceRoot root = CCorePlugin.getWorkspace().getRoot();
try {
@@ -60,17 +57,17 @@ public class AutoconfOutlineErrorHandler {
e.printStackTrace();
}
}
-
+
public IDocument getDocument() {
return document;
}
-
+
public void handleError(ParseException e) {
if (!file.exists())
return;
-
+
int lineNumber = e.getLineNumber();
-
+
Map<String, Object> map = new HashMap<>();
MarkerUtilities.setLineNumber(map, lineNumber);
MarkerUtilities.setMessage(map, e.getMessage());
@@ -85,10 +82,10 @@ public class AutoconfOutlineErrorHandler {
if (charEnd != null) {
map.put(IMarker.CHAR_END, charEnd);
}
-
+
// FIXME: add severity level
map.put(IMarker.SEVERITY, Integer.valueOf(e.getSeverity()));
-
+
try {
MarkerUtilities.createMarker(file, map, PARSE_ERROR_MARKER_ID);
} catch (CoreException ee) {
@@ -96,12 +93,12 @@ public class AutoconfOutlineErrorHandler {
}
return;
}
-
+
public void removeAllExistingMarkers() {
if (!file.exists())
return;
-
- try {
+
+ try {
file.deleteMarkers(PARSE_ERROR_MARKER_ID, true, IResource.DEPTH_ZERO);
} catch (CoreException e1) {
e1.printStackTrace();
@@ -111,8 +108,8 @@ public class AutoconfOutlineErrorHandler {
public void removeExistingMarkers(int offset, int length) {
if (!file.exists())
return;
-
- try {
+
+ try {
IMarker[] markers = file.findMarkers(PARSE_ERROR_MARKER_ID, true, IResource.DEPTH_ZERO);
// Delete all markers that start in the given document range.
for (int i = 0; i < markers.length; ++i) {
@@ -126,9 +123,9 @@ public class AutoconfOutlineErrorHandler {
e1.printStackTrace();
}
}
-
- private Integer getCharOffset(int lineNumber, int columnNumber) {
- try {
+
+ private Integer getCharOffset(int lineNumber, int columnNumber) {
+ try {
return Integer.valueOf(document.getLineOffset(lineNumber) + columnNumber);
} catch (BadLocationException e) {
e.printStackTrace();
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 35306243d01..02e26ddfa96 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
@@ -24,13 +24,12 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-
/**
- * Tokenizing autoconf parser, based on original work by Jeff Johnston
+ * Tokenizing autoconf parser, based on original work by Jeff Johnston
* @author eswartz
*/
public class AutoconfParser {
-
+
public static final String MISSING_SPECIFIER = "MissingSpecifier"; //$NON-NLS-1$
public static final String INVALID_SPECIFIER = "InvalidSpecifier"; //$NON-NLS-1$
public static final String INVALID_TERMINATION = "InvalidTermination"; //$NON-NLS-1$
@@ -47,37 +46,34 @@ public class AutoconfParser {
public static final String IMPROPER_CASE_CONDITION = "ImproperCaseCondition"; //$NON-NLS-1$
public static final String UNTERMINATED_CASE_CONDITION = "UnterminatedCaseCondition"; //$NON-NLS-1$
public static final String UNTERMINATED_INLINE_DOCUMENT = "UnterminatedInlineDocument"; //$NON-NLS-1$
- public static final String INCOMPLETE_INLINE_MARKER="IncompleteInlineMarker"; //$NON-NLS-1$
- public static final String MISSING_INLINE_MARKER="MissingInlineMarker"; //$NON-NLS-1$
+ public static final String INCOMPLETE_INLINE_MARKER = "IncompleteInlineMarker"; //$NON-NLS-1$
+ public static final String MISSING_INLINE_MARKER = "MissingInlineMarker"; //$NON-NLS-1$
public static final String UNMATCHED_RIGHT_PARENTHESIS = "UnmatchedRightParenthesis"; //$NON-NLS-1$
public static final String UNMATCHED_LEFT_PARENTHESIS = "UnmatchedLeftParenthesis"; //$NON-NLS-1$
-
+
private IAutoconfErrorHandler errorHandler;
private IAutoconfMacroValidator macroValidator;
private AutoconfTokenizer tokenizer;
private IAutoconfMacroDetector macroDetector;
-
- private static final String M4_BUILTINS =
- "define undefine defn pushdef popdef indir builtin ifdef ifelse shift reverse cond " + //$NON-NLS-1$
- "dumpdef traceon traceoff debugmode debugfile dnl changequote changecom changeword " + //$NON-NLS-1$
- "m4wrap " + //$NON-NLS-1$
- "include sinclude divert undivert divnum len index regexp substr translit patsubst " + //$NON-NLS-1$
- "format incr decr eval syscmd esyscmd sysval mkstemp maketemp errprint m4exit " + //$NON-NLS-1$
- "__file__ __line__ __program__ "; //$NON-NLS-1$
-
+
+ private static final String M4_BUILTINS = "define undefine defn pushdef popdef indir builtin ifdef ifelse shift reverse cond " //$NON-NLS-1$
+ + "dumpdef traceon traceoff debugmode debugfile dnl changequote changecom changeword " + "m4wrap "
+ + "include sinclude divert undivert divnum len index regexp substr translit patsubst "
+ + "format incr decr eval syscmd esyscmd sysval mkstemp maketemp errprint m4exit "
+ + "__file__ __line__ __program__ ";
+
private static List<String> m4builtins = new ArrayList<>();
static {
m4builtins.addAll(Arrays.asList(M4_BUILTINS.split(" "))); //$NON-NLS-1$
}
-
+
/**
- * Create a parser for autoconf-style sources.
+ * Create a parser for autoconf-style sources.
* @param errorHandler
* @param macroDetector
* @param macroValidator
*/
- public AutoconfParser(IAutoconfErrorHandler errorHandler,
- IAutoconfMacroDetector macroDetector,
+ public AutoconfParser(IAutoconfErrorHandler errorHandler, IAutoconfMacroDetector macroDetector,
IAutoconfMacroValidator macroValidator) {
this.errorHandler = errorHandler;
this.macroDetector = macroDetector;
@@ -107,22 +103,21 @@ public class AutoconfParser {
this.tokenizer = new AutoconfTokenizer(document, errorHandler);
if (useAutoconfQuotes)
tokenizer.setM4Quote("[", "]"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
AutoconfElement root = new AutoconfRootElement();
Token eof = parseTopLevel(root);
-
+
root.setStartOffset(0);
root.setDocument(document);
-
+
setSourceEnd(root, eof);
-
+
return root;
}
-
static class BlockEndCondition extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
private Token token;
@@ -130,16 +125,16 @@ public class AutoconfParser {
public BlockEndCondition(Token token) {
this.token = token;
}
-
+
public Token getToken() {
return token;
}
-
+
}
static class ExprEndCondition extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
private Token token;
@@ -147,11 +142,11 @@ public class AutoconfParser {
public ExprEndCondition(Token token) {
this.token = token;
}
-
+
public Token getToken() {
return token;
}
-
+
}
/**
@@ -168,22 +163,22 @@ public class AutoconfParser {
// don't terminate here; we may have constructs closed too early
Token token = tokenizer.peekToken();
if (token.getType() == ITokenConstants.EOF)
- return token;
+ return token;
}
}
}
-
+
/**
* Parse a block of nodes, which starts with an expression and contains
- * subnodes. Divide text into macro calls and recognized shell constructs.
+ * subnodes. Divide text into macro calls and recognized shell constructs.
* Anything else is not accounted for.
* @param parent
*/
protected void parseBlock(AutoconfElement parent, Token open, AutoconfElement block) throws BlockEndCondition {
parent.addChild(block);
-
+
setSourceStart(block, open);
-
+
// get the expression part
Token token;
try {
@@ -192,7 +187,7 @@ public class AutoconfParser {
setSourceEndBefore(block, e.getToken());
throw e;
}
-
+
// parse the block proper
if (token.getType() != ITokenConstants.EOF) {
while (true) {
@@ -211,10 +206,8 @@ public class AutoconfParser {
private Token parseBlockExpression(Token open, AutoconfElement block) throws BlockEndCondition {
Token token;
try {
- if (block instanceof AutoconfIfElement
- || block instanceof AutoconfElifElement
- || block instanceof AutoconfCaseElement
- || block instanceof AutoconfWhileElement) {
+ if (block instanceof AutoconfIfElement || block instanceof AutoconfElifElement
+ || block instanceof AutoconfCaseElement || block instanceof AutoconfWhileElement) {
token = parseExpression(block);
} else if (block instanceof AutoconfForElement) {
token = parseForExpression(block);
@@ -228,7 +221,7 @@ public class AutoconfParser {
setSourceEnd(block, e.getToken());
throw e;
}
-
+
// check for expected token
while (true) {
token = tokenizer.readToken();
@@ -237,24 +230,20 @@ public class AutoconfParser {
if (token.getType() != ITokenConstants.EOL)
break;
}
-
+
if (token.getType() == ITokenConstants.SH_DO) {
- checkBlockValidity(block, token,
- new Class[] { AutoconfForElement.class, AutoconfWhileElement.class },
+ checkBlockValidity(block, token, new Class[] { AutoconfForElement.class, AutoconfWhileElement.class },
INVALID_DO);
- }
- else if (token.getType() == ITokenConstants.SH_THEN) {
- checkBlockValidity(block, token,
- new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
+ } else if (token.getType() == ITokenConstants.SH_THEN) {
+ checkBlockValidity(block, token, new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
INVALID_THEN);
- }
- else {
+ } else {
String exp;
if (block instanceof AutoconfIfElement || block instanceof AutoconfElifElement)
exp = "then";
else
exp = "do";
-
+
handleError(token, AutoconfEditorMessages.getFormattedString(MISSING_SPECIFIER, exp));
// assume we're still in the block...
@@ -262,11 +251,11 @@ public class AutoconfParser {
}
return token;
}
-
+
/**
* Parse a case statement. Scoop up statements into case conditional blocks.
* <pre>
- * 'case' EXPR 'in'
+ * 'case' EXPR 'in'
* { EXPR ')' { STMTS } ';;' }
* 'esac'
* </pre>
@@ -275,9 +264,9 @@ public class AutoconfParser {
*/
protected void parseCaseBlock(AutoconfElement parent, Token open, AutoconfElement block) throws BlockEndCondition {
parent.addChild(block);
-
+
setSourceStart(block, open);
-
+
// get the case expression, terminating at 'in'
Token token;
try {
@@ -287,12 +276,12 @@ public class AutoconfParser {
setSourceEnd(block, e.getToken());
throw e;
}
-
+
block.setVar(getTokenSpanTextBetween(open, token));
-
+
// now get the statements, which are themselves blocks... just read statements
// that terminate with ';;' and stuff those into blocks.
-
+
while (true) {
AutoconfCaseConditionElement condition = new AutoconfCaseConditionElement();
@@ -306,34 +295,34 @@ public class AutoconfParser {
continue;
break;
}
-
+
if (token.getType() == ITokenConstants.SH_ESAC) {
break;
}
-
+
try {
Token start = token;
token = parseCaseExpression(condition);
condition.setName(getTokenSpanTextFromUpTo(start, token));
-
+
while (true) {
parseStatement(condition);
}
} catch (BlockEndCondition e) {
setSourceEnd(condition, e.getToken());
-
+
if (condition.getSource().length() > 0)
block.addChild(condition);
-
+
if (e.getToken().getType() != ITokenConstants.SH_CASE_CONDITION_END) {
token = e.getToken();
break;
}
}
}
-
+
setSourceEnd(block, token);
-
+
if (token.getType() != ITokenConstants.SH_ESAC) {
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, block.getName()));
}
@@ -344,7 +333,7 @@ public class AutoconfParser {
int endOffset = close.getOffset();
if (open.getDocument() != close.getDocument())
return open.getText();
-
+
String text;
try {
text = open.getDocument().get(startOffset, endOffset - startOffset).trim();
@@ -352,7 +341,7 @@ public class AutoconfParser {
text = open.getText();
// TODO: error
}
-
+
return text;
}
@@ -361,7 +350,7 @@ public class AutoconfParser {
int endOffset = close.getOffset();
if (open.getDocument() != close.getDocument())
return open.getText();
-
+
String text;
try {
text = open.getDocument().get(startOffset, endOffset - startOffset).trim();
@@ -369,9 +358,10 @@ public class AutoconfParser {
text = open.getText();
// TODO: error
}
-
+
return text;
}
+
private void setSourceStart(AutoconfElement block, Token open) {
int offset = open.getOffset();
block.setDocument(open.getDocument());
@@ -402,46 +392,45 @@ public class AutoconfParser {
* to validate the legality of block closing tokens.
*/
protected void parseStatement(AutoconfElement parent) throws BlockEndCondition {
-
+
boolean atStart = true;
-
+
while (true) {
Token token = tokenizer.readToken();
-
+
switch (token.getType()) {
// 0. Check EOF
case ITokenConstants.EOF:
AutoconfElement element = parent;
while (element != null && !(element instanceof AutoconfRootElement)) {
- handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, element.getName()));
+ handleError(token,
+ AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, element.getName()));
element = element.getParent();
}
throw new BlockEndCondition(token);
-
-
- // 1. Check for end of statement
+
+ // 1. Check for end of statement
case ITokenConstants.EOL:
case ITokenConstants.SEMI:
return;
-
-
+
// 2. Check macro expansions
case ITokenConstants.WORD:
checkMacro(parent, token);
atStart = false;
break;
-
+
// Check for shell constructs. These should appear at the start of a line
- // or after a semicolon. If they don't, just report an error and continue,
+ // or after a semicolon. If they don't, just report an error and continue,
// to be tolerant of our own lax parsing.
-
+
// 3.a) Check dollar variables
case ITokenConstants.SH_DOLLAR:
// skip the next token
atStart = false;
token = tokenizer.readToken();
continue;
-
+
// 3.b) Look for if/else/elif/fi constructs,
// being tolerant of nesting problems by allowing
// stranded else/elif nodes but reporting errors.
@@ -449,90 +438,76 @@ public class AutoconfParser {
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfIfElement());
break;
-
+
case ITokenConstants.SH_ELIF:
checkLineStart(token, atStart);
- checkBlockValidity(
- parent, token,
- new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
+ checkBlockValidity(parent, token, new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
INVALID_ELIF);
parseBlock(parent, token, new AutoconfElifElement());
token = tokenizer.peekToken();
throw new BlockEndCondition(token);
-
+
case ITokenConstants.SH_ELSE:
checkLineStart(token, atStart);
- checkBlockValidity(
- parent, token,
- new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
+ checkBlockValidity(parent, token, new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
INVALID_ELSE);
parseBlock(parent, token, new AutoconfElseElement());
token = tokenizer.peekToken();
throw new BlockEndCondition(token);
-
+
case ITokenConstants.SH_FI:
checkLineStart(token, atStart);
- checkBlockValidity(
- parent, token,
+ checkBlockValidity(parent, token,
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class, AutoconfElseElement.class },
INVALID_FI);
throw new BlockEndCondition(token);
-
-
- // 4. Look for for/while loops
+
+ // 4. Look for for/while loops
case ITokenConstants.SH_FOR:
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfForElement());
break;
-
+
case ITokenConstants.SH_WHILE:
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfWhileElement());
break;
-
+
case ITokenConstants.SH_UNTIL:
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfUntilElement());
break;
-
+
case ITokenConstants.SH_SELECT:
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfSelectElement());
break;
-
+
case ITokenConstants.SH_DONE:
checkLineStart(token, atStart);
- checkBlockValidity(
- parent, token,
- new Class[] { AutoconfForElement.class, AutoconfWhileElement.class,
- AutoconfUntilElement.class, AutoconfSelectElement.class },
- INVALID_DONE);
+ checkBlockValidity(parent, token, new Class[] { AutoconfForElement.class, AutoconfWhileElement.class,
+ AutoconfUntilElement.class, AutoconfSelectElement.class }, INVALID_DONE);
throw new BlockEndCondition(token);
-
- // 5. Look for case statements
+
+ // 5. Look for case statements
case ITokenConstants.SH_CASE:
checkLineStart(token, atStart);
parseCaseBlock(parent, token, new AutoconfCaseElement());
break;
-
+
case ITokenConstants.SH_CASE_CONDITION_END:
- checkBlockValidity(
- parent, token,
- new Class[] { AutoconfCaseConditionElement.class },
+ checkBlockValidity(parent, token, new Class[] { AutoconfCaseConditionElement.class },
IMPROPER_CASE_CONDITION);
throw new BlockEndCondition(token);
-
+
case ITokenConstants.SH_ESAC:
checkLineStart(token, atStart);
- checkBlockValidity(
- parent, token,
+ checkBlockValidity(parent, token,
// note: we don't strictly recurse here, so accept either parent
- new Class[] { AutoconfCaseElement.class, AutoconfCaseConditionElement.class },
- INVALID_ESAC);
+ new Class[] { AutoconfCaseElement.class, AutoconfCaseConditionElement.class }, INVALID_ESAC);
throw new BlockEndCondition(token);
-
-
- // 6. Check for HERE documents
+
+ // 6. Check for HERE documents
case ITokenConstants.SH_HERE:
case ITokenConstants.SH_HERE_DASH:
@@ -558,15 +533,16 @@ public class AutoconfParser {
Token token = tokenizer.readToken();
if (token.getType() == ITokenConstants.EOL || token.getType() == ITokenConstants.EOF) {
handleError(token, AutoconfEditorMessages.getString(INCOMPLETE_INLINE_MARKER));
-
+
} else {
String hereTag = token.getText();
-
+
boolean atEOL = false;
while (true) {
token = tokenizer.readToken();
if (token.getType() == ITokenConstants.EOF) {
- handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
+ handleError(token,
+ AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
break;
} else if (token.getType() == ITokenConstants.EOL) {
atEOL = true;
@@ -574,7 +550,8 @@ public class AutoconfParser {
if (atEOL && token.getText().equals(hereTag)) {
// only the end if it is also followed by EOL without any whitespace
Token eol = tokenizer.readToken();
- if (eol.getType() == ITokenConstants.EOL && eol.getOffset() == token.getOffset() + token.getLength()) {
+ if (eol.getType() == ITokenConstants.EOL
+ && eol.getOffset() == token.getOffset() + token.getLength()) {
break;
}
}
@@ -596,22 +573,22 @@ public class AutoconfParser {
* to validate the legality of block closing tokens.
*/
protected Token parseExpression(AutoconfElement parent) throws BlockEndCondition {
-
+
while (true) {
Token token = tokenizer.readToken();
-
+
// 0. Ignore comments (tokenizer skipped them!)
-
+
switch (token.getType()) {
// 1. Check EOF
case ITokenConstants.EOF:
throw new BlockEndCondition(token);
-
- // 2. Check macro expansions
+
+ // 2. Check macro expansions
case ITokenConstants.WORD:
token = checkMacro(parent, token);
break;
-
+
// 3. Check expression terminators
case ITokenConstants.SEMI:
case ITokenConstants.EOL:
@@ -621,22 +598,21 @@ public class AutoconfParser {
case ITokenConstants.SH_DOLLAR:
token = tokenizer.readToken();
break;
-
+
case ITokenConstants.SH_IN:
// in 'for' or 'select, an 'in' may occur before 'do'
- if (!(parent instanceof AutoconfForElement)
- && !(parent instanceof AutoconfSelectElement))
+ if (!(parent instanceof AutoconfForElement) && !(parent instanceof AutoconfSelectElement))
return token;
// fall through
-
- // 5. Abort on unexpected tokens
+
+ // 5. Abort on unexpected tokens
case ITokenConstants.SH_DO:
case ITokenConstants.SH_THEN:
handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
tokenizer.unreadToken(token);
// close enough...
return token;
-
+
case ITokenConstants.SH_ESAC:
case ITokenConstants.SH_CASE:
case ITokenConstants.SH_CASE_CONDITION_END:
@@ -664,47 +640,49 @@ public class AutoconfParser {
protected Token parseForExpression(AutoconfElement parent) throws BlockEndCondition {
while (true) {
Token token = tokenizer.readToken();
-
+
// 0. Ignore comments (tokenizer skipped them!)
-
+
// 1. Check EOF
if (token.getType() == ITokenConstants.EOF) {
throw new BlockEndCondition(token);
}
-
+
// 2. Check macro expansions
else if (token.getType() == ITokenConstants.WORD) {
token = checkMacro(parent, token);
}
-
+
// 3. Check expression terminators -- not ';' here, but 'do'
else if (token.getType() == ITokenConstants.SH_DO) {
tokenizer.unreadToken(token);
return tokenizer.peekToken();
}
-
+
// 4. Abort on unexpected tokens
- else switch (token.getType()) {
- case ITokenConstants.SH_THEN:
- handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
- tokenizer.unreadToken(token);
- // close enough...
- //throw new ExprEndCondition(token);
- return token;
-
- case ITokenConstants.SH_ESAC:
- case ITokenConstants.SH_CASE:
- case ITokenConstants.SH_CASE_CONDITION_END:
- case ITokenConstants.SH_FOR:
- case ITokenConstants.SH_IF:
- case ITokenConstants.SH_ELIF:
- case ITokenConstants.SH_ELSE:
- case ITokenConstants.SH_FI:
- case ITokenConstants.SH_DONE:
- handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
- tokenizer.unreadToken(token);
- throw new BlockEndCondition(token);
- }
+ else
+ switch (token.getType()) {
+ case ITokenConstants.SH_THEN:
+ handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
+ tokenizer.unreadToken(token);
+ // close enough...
+ //throw new ExprEndCondition(token);
+ return token;
+
+ case ITokenConstants.SH_ESAC:
+ case ITokenConstants.SH_CASE:
+ case ITokenConstants.SH_CASE_CONDITION_END:
+ case ITokenConstants.SH_FOR:
+ case ITokenConstants.SH_IF:
+ case ITokenConstants.SH_ELIF:
+ case ITokenConstants.SH_ELSE:
+ case ITokenConstants.SH_FI:
+ case ITokenConstants.SH_DONE:
+ handleError(token,
+ AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
+ tokenizer.unreadToken(token);
+ throw new BlockEndCondition(token);
+ }
}
}
@@ -719,57 +697,58 @@ public class AutoconfParser {
protected Token parseCaseExpression(AutoconfElement parent) throws BlockEndCondition {
while (true) {
Token token = tokenizer.readToken();
-
+
// 0. Ignore comments (tokenizer skipped them!)
-
+
// 1. Check EOF
if (token.getType() == ITokenConstants.EOF) {
throw new BlockEndCondition(token);
}
-
+
// 2. Check macro expansions
else if (token.getType() == ITokenConstants.WORD) {
token = checkMacro(parent, token);
}
-
+
// 3. Check expression terminators
else if (parent instanceof AutoconfCaseElement && token.getType() == ITokenConstants.SH_IN) {
return token;
- }
- else if (parent instanceof AutoconfCaseConditionElement && token.getType() == ITokenConstants.RPAREN) {
+ } else if (parent instanceof AutoconfCaseConditionElement && token.getType() == ITokenConstants.RPAREN) {
return token;
}
-
+
// 4. Abort on unexpected tokens
- else switch (token.getType()) {
- case ITokenConstants.SEMI:
- case ITokenConstants.SH_IN:
- case ITokenConstants.RPAREN:
- case ITokenConstants.SH_DO:
- case ITokenConstants.SH_THEN:
- if (parent instanceof AutoconfCaseElement)
- handleError(token, AutoconfEditorMessages.getString(INVALID_IN));
- else
- handleError(token, AutoconfEditorMessages.getString(IMPROPER_CASE_CONDITION));
- // close enough...
- return token;
-
- case ITokenConstants.SH_ESAC:
- case ITokenConstants.SH_CASE:
- case ITokenConstants.SH_CASE_CONDITION_END:
- case ITokenConstants.SH_FOR:
- case ITokenConstants.SH_IF:
- case ITokenConstants.SH_ELIF:
- case ITokenConstants.SH_ELSE:
- case ITokenConstants.SH_FI:
- case ITokenConstants.SH_DONE:
- handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
- tokenizer.unreadToken(token);
- throw new BlockEndCondition(token);
- }
+ else
+ switch (token.getType()) {
+ case ITokenConstants.SEMI:
+ case ITokenConstants.SH_IN:
+ case ITokenConstants.RPAREN:
+ case ITokenConstants.SH_DO:
+ case ITokenConstants.SH_THEN:
+ if (parent instanceof AutoconfCaseElement)
+ handleError(token, AutoconfEditorMessages.getString(INVALID_IN));
+ else
+ handleError(token, AutoconfEditorMessages.getString(IMPROPER_CASE_CONDITION));
+ // close enough...
+ return token;
+
+ case ITokenConstants.SH_ESAC:
+ case ITokenConstants.SH_CASE:
+ case ITokenConstants.SH_CASE_CONDITION_END:
+ case ITokenConstants.SH_FOR:
+ case ITokenConstants.SH_IF:
+ case ITokenConstants.SH_ELIF:
+ case ITokenConstants.SH_ELSE:
+ case ITokenConstants.SH_FI:
+ case ITokenConstants.SH_DONE:
+ handleError(token,
+ AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
+ tokenizer.unreadToken(token);
+ throw new BlockEndCondition(token);
+ }
}
}
-
+
/**
* Check a given close block token against the current parent by checking that
* the parent's class is one of classes, If a match happens,
@@ -779,17 +758,13 @@ public class AutoconfParser {
* @param token
* @param classes
*/
- private void checkBlockValidity(
- AutoconfElement parent,
- Token token,
- Class<?>[] classes,
- String errorMessage) {
+ private void checkBlockValidity(AutoconfElement parent, Token token, Class<?>[] classes, String errorMessage) {
for (int i = 0; i < classes.length; i++) {
if (classes[i].isInstance(parent)) {
return;
}
}
-
+
// not a match
handleError(token, AutoconfEditorMessages.getFormattedString(errorMessage, parent.getName(), token.getText()));
}
@@ -797,11 +772,11 @@ public class AutoconfParser {
/**
* Creates the appropriate macro type object depending on the
* macro name.
- *
+ *
* @return
*/
- private AutoconfMacroElement createMacroElement (String name){
- if (name.equals("AC_INIT")){ //$NON-NLS-1$
+ private AutoconfMacroElement createMacroElement(String name) {
+ if (name.equals("AC_INIT")) { //$NON-NLS-1$
return new AcInitElement(name);
}
return new AutoconfMacroElement(name);
@@ -809,14 +784,14 @@ public class AutoconfParser {
/**
* Check whether the given token is part of a macro, and parse it as such
- * if necessary.
+ * if necessary.
* @param parent
* @param token
* @return Token last read for the macro call
*/
private Token checkMacro(AutoconfElement parent, Token token) {
String name = token.getText();
-
+
boolean hasArguments = tokenizer.peekToken().getType() == ITokenConstants.LPAREN;
if (macroDetector != null && macroDetector.isMacroIdentifier(name)) {
// ok
@@ -827,10 +802,10 @@ public class AutoconfParser {
} else {
return token;
}
-
+
AutoconfMacroElement macro = createMacroElement(name);
- token = parseMacro(macro, token);
-
+ token = parseMacro(macro, token);
+
// handle special macros here
if ("dnl".equals(name)) { //$NON-NLS-1$
// consume to EOL
@@ -839,13 +814,13 @@ public class AutoconfParser {
if (token.getType() == ITokenConstants.EOF || token.getType() == ITokenConstants.EOL)
break;
}
-
+
// ignore macro entirely
macro = null;
} else if ("changequote".equals(name)) { //$NON-NLS-1$
// change quote delimiters
validateMacroParameterCount(macro, token, 2);
-
+
// GNU behavior for invalid argument count
String parm0 = "`"; //$NON-NLS-1$
String parm1 = "'"; //$NON-NLS-1$
@@ -853,12 +828,12 @@ public class AutoconfParser {
parm0 = macro.getParameter(0);
if (macro.getParameterCount() >= 2)
parm1 = macro.getParameter(1);
-
+
tokenizer.setM4Quote(parm0, parm1);
- } else if ("changecom".equals(name)) { //$NON-NLS-1$
+ } else if ("changecom".equals(name)) { //$NON-NLS-1$
// change comment delimiters
validateMacroParameterCount(macro, token, 2);
-
+
// GNU behavior for invalid argument count
String parm0 = "#"; //$NON-NLS-1$
String parm1 = "\n"; //$NON-NLS-1$
@@ -866,50 +841,49 @@ public class AutoconfParser {
parm0 = macro.getParameter(0);
if (macro.getParameterCount() >= 2)
parm1 = macro.getParameter(1);
-
+
tokenizer.setM4Comment(parm0, parm1);
}
-
+
if (macro != null) {
parent.addChild(macro);
}
-
+
// now validate that the macro is properly terminated
- if (!(parent instanceof AutoconfMacroArgumentElement)
- && !(parent instanceof AutoconfMacroElement)
+ if (!(parent instanceof AutoconfMacroArgumentElement) && !(parent instanceof AutoconfMacroElement)
&& !(parent instanceof AutoconfForElement)) {
Token peek = tokenizer.peekToken();
if (peek.getType() == ITokenConstants.RPAREN) {
- handleError(peek, AutoconfEditorMessages.getString(UNMATCHED_RIGHT_PARENTHESIS));
+ handleError(peek, AutoconfEditorMessages.getString(UNMATCHED_RIGHT_PARENTHESIS));
}
}
-
+
return token;
}
private void validateMacroParameterCount(AutoconfMacroElement macro, Token token, int count) {
if (macro.getParameterCount() < count) {
- handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooFew",
- macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$
+ handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooFew", macro.getName(),
+ Integer.valueOf(2))); //$NON-NLS-1$
} else if (macro.getParameterCount() > count) {
- handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooMany",
- macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$
+ handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooMany", macro.getName(),
+ Integer.valueOf(2))); //$NON-NLS-1$
}
}
/**
* Start parsing a macro call at a suspected macro expansion location.
* @param macro
- * @param line the line containing the start of the
+ * @param line the line containing the start of the
* @param parent
* @return last token parsed
*/
protected Token parseMacro(AutoconfMacroElement macro, Token macroName) {
setSourceStart(macro, macroName);
-
+
// parse any arguments
tokenizer.setM4Context(true);
-
+
Token token = tokenizer.readToken();
if (token.getType() == ITokenConstants.LPAREN) {
token = parseMacroArguments(macro);
@@ -918,9 +892,9 @@ public class AutoconfParser {
tokenizer.unreadToken(token);
setSourceEnd(macro, macroName);
}
-
+
tokenizer.setM4Context(false);
-
+
// validate macro arguments?
if (macroValidator != null) {
try {
@@ -931,7 +905,7 @@ public class AutoconfParser {
handleError(e);
}
}
-
+
return token;
}
@@ -939,7 +913,7 @@ public class AutoconfParser {
* Parse the arguments for the given macro. These are not interpreted as
* shell constructs but just as text with possibly more macro expansions
* inside.
- *
+ *
* @param macro
* @return final token (')')
*
@@ -949,31 +923,30 @@ public class AutoconfParser {
Token argStart = null;
Token argEnd = null;
Token token;
-
+
// When parsing, we want to ignore the whitespace around the arguments.
// So, instead of taking the source range "between" a parenthesis and a comma,
// track the exact tokens forming the start and end of an argument, defaulting
// to the borders of the parentheses and commas if no text is included.
-
+
StringBuilder argBuffer = new StringBuilder();
AutoconfMacroArgumentElement arg = new AutoconfMacroArgumentElement();
while (true) {
token = tokenizer.readToken();
-
+
if (token.getType() == ITokenConstants.EOL) {
if (argBuffer.length() > 0)
argBuffer.append(token.getText());
continue;
}
-
- if (token.getType() == ITokenConstants.COMMA
- || token.getType() == ITokenConstants.RPAREN
+
+ if (token.getType() == ITokenConstants.COMMA || token.getType() == ITokenConstants.RPAREN
|| token.getType() == ITokenConstants.EOF) {
arg.setName(argBuffer.toString());
argBuffer.setLength(0);
-
+
if (argStart != null && argEnd != null) {
setSourceStart(arg, argStart);
setSourceEnd(arg, argEnd);
@@ -985,15 +958,15 @@ public class AutoconfParser {
setSourceStart(arg, token);
setSourceEndBefore(arg, token);
}
-
+
macro.addChild(arg);
-
+
if (token.getType() != ITokenConstants.COMMA)
break;
-
+
argStart = null;
argEnd = null;
-
+
arg = new AutoconfMacroArgumentElement();
} else {
@@ -1001,35 +974,35 @@ public class AutoconfParser {
argStart = token;
}
argEnd = token;
-
+
if (argBuffer.length() > 0 && token.followsSpace())
argBuffer.append(' ');
argBuffer.append(token.getText());
-
+
// handle nested macro calls in arguments
if (token.getType() == ITokenConstants.WORD) {
argEnd = checkMacro(arg, token);
}
}
}
-
+
if (token.getType() != ITokenConstants.RPAREN) {
- handleError(token, AutoconfEditorMessages.getString(UNMATCHED_LEFT_PARENTHESIS));
+ handleError(token, AutoconfEditorMessages.getString(UNMATCHED_LEFT_PARENTHESIS));
}
-
+
// note: moved 15-char truncation to AutoconfLabelProvider
AutoconfElement[] children = macro.getChildren();
if (children.length > 0)
macro.setVar(children[0].getVar());
-
+
return token;
}
-
+
/** @since 2.0 */
protected void handleError(Token token, String message) {
handleMessage(token, message, IMarker.SEVERITY_ERROR);
}
-
+
/** @since 2.0 */
protected void handleWarning(Token token, String message) {
handleMessage(token, message, IMarker.SEVERITY_WARNING);
@@ -1049,13 +1022,8 @@ public class AutoconfParser {
} catch (BadLocationException e) {
// Don't care if we blow up trying to issue marker
}
- errorHandler.handleError(new ParseException(
- message,
- token.getOffset(),
- token.getOffset() + token.getLength(),
- lineNumber,
- startColumn, endColumn,
- severity));
+ errorHandler.handleError(new ParseException(message, token.getOffset(),
+ token.getOffset() + token.getLength(), lineNumber, startColumn, endColumn, severity));
}
}
@@ -1063,9 +1031,9 @@ public class AutoconfParser {
* Figure out the error location and create a marker and message for it.
* @param exception
*/
- protected void handleError (InvalidMacroException exception) {
+ protected void handleError(InvalidMacroException exception) {
AutoconfElement element = exception.getBadElement();
-
+
if (errorHandler != null) {
int lineNumber = 0;
int startColumn = 0;
@@ -1078,13 +1046,8 @@ public class AutoconfParser {
} catch (BadLocationException e) {
// Don't care if we blow up trying to issue marker
}
- errorHandler.handleError(new ParseException(
- exception.getMessage(),
- element.getStartOffset(),
- element.getEndOffset(),
- lineNumber,
- startColumn, endColumn,
- IMarker.SEVERITY_ERROR));
+ errorHandler.handleError(new ParseException(exception.getMessage(), element.getStartOffset(),
+ element.getEndOffset(), lineNumber, startColumn, endColumn, IMarker.SEVERITY_ERROR));
}
}
@@ -1092,4 +1055,3 @@ public class AutoconfParser {
return errorHandler;
}
}
-
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfRootElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfRootElement.java
index 18a9853f78f..50c17aa8bb5 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfRootElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfRootElement.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfRootElement extends AutoconfElement {
-
+
public AutoconfRootElement() {
super(""); //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfSelectElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfSelectElement.java
index 6035e561389..2514cc25d84 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfSelectElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfSelectElement.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfSelectElement extends AutoconfElement {
-
+
public AutoconfSelectElement() {
super("select"); //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfTokenizer.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfTokenizer.java
index 2a56cf6a6d0..4cbb147f526 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfTokenizer.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfTokenizer.java
@@ -19,7 +19,6 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-
/**
* This tokenizer traverses autotools-style text (m4 or configure.ac) to support the
* autoconf parser. It tracks the current context (m4 macro call or shell commands)
@@ -47,7 +46,7 @@ public class AutoconfTokenizer {
public static final String UNMATCHED_RIGHT_QUOTE = "UnmatchedRightQuote"; //$NON-NLS-1$
public static final String UNMATCHED_LEFT_QUOTE = "UnmatchedLeftQuote"; //$NON-NLS-1$
public static final String UNMATCHED_CLOSE_COMMENT = "UnmatchedCloseComment"; //$NON-NLS-1$
-
+
private IDocument document;
private int offset;
private String m4OpenQuote;
@@ -66,18 +65,18 @@ public class AutoconfTokenizer {
throw new IllegalArgumentException();
this.document = document;
this.errorHandler = errorHandler;
-
+
this.chars = document.get().toCharArray();
this.offset = 0;
-
+
this.eofToken = new Token(ITokenConstants.EOF, "", document, chars.length, 0);
-
+
this.m4OpenQuote = "`"; //$NON-NLS-1$
this.m4CloseQuote = "'"; //$NON-NLS-1$
this.m4OpenComment = "#"; //$NON-NLS-1$
this.m4CloseComment = "\n"; //$NON-NLS-1$
}
-
+
/**
* Tell whether the tokenizer considers itself to be in an m4 context.
* This determines what kinds of tokens it returns.
@@ -86,7 +85,7 @@ public class AutoconfTokenizer {
public boolean isM4Context() {
return isM4Context;
}
-
+
/**
* Switch the tokenizer into or out of m4 context.
* @return
@@ -94,8 +93,8 @@ public class AutoconfTokenizer {
public void setM4Context(boolean flag) {
isM4Context = flag;
}
-
- /**
+
+ /**
* Set the m4 quote delimiters
*/
public void setM4Quote(String open, String close) {
@@ -103,14 +102,14 @@ public class AutoconfTokenizer {
this.m4CloseQuote = close;
}
- /**
+ /**
* Set the m4 comment delimiters
*/
public void setM4Comment(String open, String close) {
this.m4OpenComment = open;
this.m4CloseComment = close;
}
-
+
/** Push back the given token. This allows the tokenizer to restart from its start position,
* potentially in a different context. */
public void unreadToken(Token token) {
@@ -118,14 +117,14 @@ public class AutoconfTokenizer {
throw new IllegalStateException();
offset = token.getOffset();
}
-
+
/** Read the next token. Returns an EOF token at EOF. */
public Token readToken() {
if (offset >= chars.length)
return eofToken;
-
+
char ch = chars[offset];
-
+
// skip whitespace (but not EOL)
while (isWhitespace(ch)) {
offset++;
@@ -134,7 +133,7 @@ public class AutoconfTokenizer {
ch = chars[offset];
}
- // in shell mode, strip comments up to eol
+ // in shell mode, strip comments up to eol
if (!isM4Context && ch == '#') {
while (offset < chars.length) {
ch = chars[offset];
@@ -142,7 +141,7 @@ public class AutoconfTokenizer {
break;
offset++;
}
-
+
// keep inside doc if we didn't find that EOL
if (offset >= chars.length)
offset--;
@@ -150,7 +149,7 @@ public class AutoconfTokenizer {
startOffset = offset;
StringBuilder buffer = new StringBuilder();
-
+
// check EOL
if (ch == '\r' || ch == '\n') {
buffer.append(ch);
@@ -160,12 +159,12 @@ public class AutoconfTokenizer {
}
return makeToken(ITokenConstants.EOL, buffer.toString());
}
-
+
// TODO: this parser always uses fixed logic for identifier reading, ignoring m4's "changeword"
if (isLeadIdentifierChar(ch)) {
return parseWord(ch);
}
-
+
// check comments and quotes
if (isM4Context) {
if (lookAhead(m4OpenComment)) {
@@ -179,17 +178,17 @@ public class AutoconfTokenizer {
offset++;
}
if (!found) {
- handleError(startOffset, offset, AutoconfEditorMessages.getFormattedString(UNMATCHED_CLOSE_COMMENT,
+ handleError(startOffset, offset, AutoconfEditorMessages.getFormattedString(UNMATCHED_CLOSE_COMMENT,
m4CloseComment.equals("\n") ? "newline" : m4CloseComment)); //$NON-NLS-1$
}
return makeToken(ITokenConstants.M4_COMMENT);
}
-
+
if (lookAhead(m4OpenQuote)) {
return parseQuote();
}
}
-
+
// check shell punctuation
if (!isM4Context) {
if (ch == ';' && offset + 1 < chars.length && chars[offset + 1] == ';') {
@@ -229,7 +228,7 @@ public class AutoconfTokenizer {
return parseString(ITokenConstants.SH_STRING_BACKTICK, ch);
}
}
-
+
// check common punctuation
if (ch == ';') {
offset++;
@@ -247,7 +246,7 @@ public class AutoconfTokenizer {
offset++;
return makeToken(ITokenConstants.RPAREN);
}
-
+
// unknown text
offset++;
return makeToken(ITokenConstants.TEXT);
@@ -255,7 +254,7 @@ public class AutoconfTokenizer {
private Token parseWord(char ch) {
StringBuilder buffer = new StringBuilder();
-
+
buffer.append(ch);
offset++;
do {
@@ -267,9 +266,9 @@ public class AutoconfTokenizer {
buffer.append(ch);
offset++;
} while (true);
-
+
String text = buffer.toString();
-
+
if (!isM4Context) {
// detect sh tokens
if ("case".equals(text))
@@ -301,16 +300,16 @@ public class AutoconfTokenizer {
if ("fi".equals(text))
return makeToken(ITokenConstants.SH_FI, text);
}
-
+
// other identifier-looking word
return makeToken(ITokenConstants.WORD, text);
}
-
+
private Token parseQuote() {
- // read text, honoring nested quotes, but don't put the outermost quotes in the token
-
+ // read text, honoring nested quotes, but don't put the outermost quotes in the token
+
StringBuilder buffer = new StringBuilder();
-
+
int quoteLevel = 1;
// keep reading until the close quote
while (offset < chars.length) {
@@ -327,22 +326,24 @@ public class AutoconfTokenizer {
offset++;
}
}
-
+
if (quoteLevel > 0) {
- handleError(startOffset, offset, AutoconfEditorMessages.getFormattedString(UNMATCHED_LEFT_QUOTE, m4CloseQuote));
+ handleError(startOffset, offset,
+ AutoconfEditorMessages.getFormattedString(UNMATCHED_LEFT_QUOTE, m4CloseQuote));
} else if (quoteLevel < 0) {
- handleError(startOffset, offset, AutoconfEditorMessages.getFormattedString(UNMATCHED_RIGHT_QUOTE, m4OpenQuote));
+ handleError(startOffset, offset,
+ AutoconfEditorMessages.getFormattedString(UNMATCHED_RIGHT_QUOTE, m4OpenQuote));
}
-
+
return makeToken(ITokenConstants.M4_STRING, buffer.toString());
}
private Token parseString(int type, char terminal) {
startOffset = offset;
offset++;
-
+
StringBuilder buffer = new StringBuilder();
-
+
char ch = 0;
while (offset < chars.length) {
ch = chars[offset++];
@@ -361,12 +362,11 @@ public class AutoconfTokenizer {
if (ch != terminal) {
handleError(startOffset, offset, AutoconfEditorMessages.getFormattedString(UNTERMINATED_STRING, "" + ch));
}
-
+
return makeToken(type, buffer.toString());
}
- private void handleError(int start, int end,
- String message) {
+ private void handleError(int start, int end, String message) {
if (errorHandler != null) {
int lineNumber = 0;
int startColumn = 0;
@@ -379,16 +379,12 @@ public class AutoconfTokenizer {
} catch (BadLocationException e) {
// Don't care if we blow up trying to issue marker
}
- errorHandler.handleError(new ParseException(
- message,
- start, end,
- lineNumber,
- startColumn, endColumn,
+ errorHandler.handleError(new ParseException(message, start, end, lineNumber, startColumn, endColumn,
IMarker.SEVERITY_ERROR));
}
}
- /**
+ /**
* Look ahead for the given string. If found, return true, and have
* offset updated. Otherwise, return false with offset unchanged.
* @param keyword
@@ -413,9 +409,8 @@ public class AutoconfTokenizer {
}
private Token makeToken(int type) {
- return new Token(type,
- new String(chars, startOffset, offset - startOffset),
- document, startOffset, offset - startOffset);
+ return new Token(type, new String(chars, startOffset, offset - startOffset), document, startOffset,
+ offset - startOffset);
}
private Token makeToken(int type, String text) {
@@ -427,9 +422,9 @@ public class AutoconfTokenizer {
}
private boolean isLeadIdentifierChar(char ch) {
- return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || ch == '_';
+ return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || ch == '_';
}
-
+
public Token peekToken() {
Token token = readToken();
unreadToken(token);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfUntilElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfUntilElement.java
index 7d0b65f79b9..8e15431f83d 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfUntilElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfUntilElement.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfUntilElement extends AutoconfElement {
-
+
public AutoconfUntilElement() {
super("until"); //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfWhileElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfWhileElement.java
index d381f6f4b88..bca12536dc8 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfWhileElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/AutoconfWhileElement.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class AutoconfWhileElement extends AutoconfElement {
-
+
public AutoconfWhileElement() {
super("while"); //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfErrorHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfErrorHandler.java
index 6ebc42bae7c..619715cf554 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfErrorHandler.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfErrorHandler.java
@@ -14,7 +14,6 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
-
/**
* Clients implement this interface to handle errors encountered while parsing.
* @author eswartz
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroDetector.java
index 8b770f09aad..a89ab17546f 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroDetector.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroDetector.java
@@ -14,9 +14,8 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
-
/**
- * Clients implement this interface to identify what identifiers represent
+ * Clients implement this interface to identify what identifiers represent
* macros for the autoconf tree.
* @author eswartz
*
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroValidator.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroValidator.java
index 2e6ea331a04..a6935dc6ebe 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroValidator.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IAutoconfMacroValidator.java
@@ -14,7 +14,6 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
-
/**
* Clients implement this interface to validate macro calls.
* @author eswartz
@@ -25,7 +24,7 @@ public interface IAutoconfMacroValidator {
/**
* Validate the given macro call.
* @param element macro call, never <code>null</code>
- * @throws ParseException if the call doesn't match the expected number of elements
+ * @throws ParseException if the call doesn't match the expected number of elements
*/
void validateMacroCall(AutoconfMacroElement element) throws ParseException, InvalidMacroException;
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IMacroDetector.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IMacroDetector.java
index b96ffad8c81..bae2539cb9c 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IMacroDetector.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/IMacroDetector.java
@@ -15,7 +15,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
/**
- * Clients implement this interface to detect whether a given identifier
+ * Clients implement this interface to detect whether a given identifier
* represents a known or potential macro in m4 or configure.ac text.
* @author eswartz
*
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ITokenConstants.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ITokenConstants.java
index 20c61eb6ab8..9e2a8ed0c29 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ITokenConstants.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/ITokenConstants.java
@@ -16,7 +16,7 @@ public interface ITokenConstants {
int EOF = 0;
/** end of line */
int EOL = 1;
-
+
/** an open parenthesis */
int LPAREN = 2;
/** a close parenthesis */
@@ -36,7 +36,7 @@ public interface ITokenConstants {
int M4_STRING = 21;
/** an m4 comment (as determined by changecomment, NOT dnl) */
int M4_COMMENT = 22;
-
+
/** the sh 'if' token */
int SH_IF = 40;
/** the sh 'then' token */
@@ -47,7 +47,7 @@ public interface ITokenConstants {
int SH_ELIF = 43;
/** the sh 'fi' token */
int SH_FI = 44;
-
+
/** the sh 'while' token */
int SH_WHILE = 45;
/** the sh 'for' token */
@@ -61,7 +61,7 @@ public interface ITokenConstants {
/** the sh 'done' token */
int SH_DONE = 50;
/** the sh 'case' token */
-
+
int SH_CASE = 51;
/** the sh 'in' token */
int SH_IN = 52;
@@ -72,7 +72,7 @@ public interface ITokenConstants {
/** the sh '$' token */
int SH_DOLLAR = 60;
-
+
/** the sh '{' token */
int SH_LBRACE = 61;
/** the sh '}' token */
@@ -81,7 +81,7 @@ public interface ITokenConstants {
int SH_LBRACKET = 63;
/** the sh ']' token */
int SH_RBRACKET = 64;
-
+
/** the sh '<<' token */
int SH_HERE = 65;
/** the sh '<<-' token */
@@ -93,5 +93,4 @@ public interface ITokenConstants {
/** an sh backtick-quoted string */
int SH_STRING_BACKTICK = 69;
-
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/InvalidMacroException.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/InvalidMacroException.java
index cf6fee8076b..77c62b99878 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/InvalidMacroException.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/autotools/ui/editors/parser/InvalidMacroException.java
@@ -14,8 +14,8 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
-public class InvalidMacroException extends Exception {
-
+public class InvalidMacroException extends Exception {
+
private static final long serialVersionUID = 1L;
private AutoconfElement badElement;
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 22bdddd29ce..cc5036e5dd1 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
@@ -14,7 +14,7 @@
package org.eclipse.cdt.autotools.ui.editors.parser;
public class ParseException extends Exception {
-
+
static final long serialVersionUID = 1;
String message;
int severity;
@@ -23,34 +23,42 @@ public class ParseException extends Exception {
int endColumn;
private int startOffset;
private int endOffset;
+
public int getEndColumn() {
return endColumn;
}
+
public void setEndColumn(int endColumn) {
this.endColumn = endColumn;
}
+
public int getLineNumber() {
return lineNumber;
}
+
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
+
@Override
public String getMessage() {
return message;
}
+
public void setMessage(String message) {
this.message = message;
}
+
public int getStartColumn() {
return startColumn;
}
+
public void setStartColumn(int startColumn) {
this.startColumn = startColumn;
}
- public ParseException(String message,
- int startOffset, int endOffset,
- int lineNumber, int startColumn, int endColumn, int severity) {
+
+ public ParseException(String message, int startOffset, int endOffset, int lineNumber, int startColumn,
+ int endColumn, int severity) {
super();
this.message = message;
this.startOffset = startOffset;
@@ -60,15 +68,19 @@ public class ParseException extends Exception {
this.endColumn = endColumn;
this.severity = severity;
}
+
public int getSeverity() {
return severity;
}
+
public void setSeverity(int severity) {
this.severity = severity;
}
+
public int getStartOffset() {
return startOffset;
}
+
public int getEndOffset() {
return endOffset;
}
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 6550bf3fe89..16044448c6a 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
@@ -19,12 +19,12 @@ import org.eclipse.jface.text.IDocument;
/**
* A single token parsed from an autotools-style file. This represents m4 and sh
* tokens. Punctuation characters shared by both are not in a namespace.
- *
+ *
* @author eswartz
*
*/
public class Token implements ITokenConstants {
- /** Type:
+ /** Type:
* @see ITokenConstants
*/
final int type;
@@ -52,7 +52,7 @@ public class Token implements ITokenConstants {
this.offset = offset;
this.length = length;
}
-
+
@Override
public String toString() {
return text;
@@ -73,7 +73,7 @@ public class Token implements ITokenConstants {
public int getOffset() {
return offset;
}
-
+
public int getLength() {
return length;
}
@@ -84,5 +84,5 @@ public class Token implements ITokenConstants {
return false;
return (" \t\r\n\f".indexOf(text[offset - 1]) >= 0);
}
-
+
}
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 c238f1ff893..26abd638a68 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,12 +15,11 @@ package org.eclipse.cdt.internal.autotools.ui;
import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
-public abstract class AbstractAutotoolsCPropertyTab extends
- 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/AutotoolsConsole.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AutotoolsConsole.java
index 37d46335760..382c4920027 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AutotoolsConsole.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AutotoolsConsole.java
@@ -17,7 +17,7 @@ package org.eclipse.cdt.internal.autotools.ui;
public class AutotoolsConsole extends Console {
private static final String CONTEXT_MENU_ID = "CAutotoolsConsole"; //$NON-NLS-1$
private static final String CONSOLE_NAME = ConsoleMessages.getString("AutotoolsConsole.name"); //$NON-NLS-1$
-
+
public AutotoolsConsole() {
super(CONSOLE_NAME, CONTEXT_MENU_ID);
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AutotoolsUIPluginImages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AutotoolsUIPluginImages.java
index de1b58732f8..ebdde999fa7 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AutotoolsUIPluginImages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/AutotoolsUIPluginImages.java
@@ -25,12 +25,11 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
-
/**
* Bundle of all images used by the C plugin.
*/
public class AutotoolsUIPluginImages {
-
+
// The plugin registry
private static ImageRegistry imageRegistry = new ImageRegistry(CUIPlugin.getStandardDisplay());
@@ -39,41 +38,41 @@ public class AutotoolsUIPluginImages {
static {
try {
- fgIconBaseURL= new URL(AutotoolsUIPlugin.getDefault().getBundle().getEntry("/"), "icons/" ); //$NON-NLS-1$ //$NON-NLS-2$
+ fgIconBaseURL = new URL(AutotoolsUIPlugin.getDefault().getBundle().getEntry("/"), "icons/"); //$NON-NLS-1$ //$NON-NLS-2$
} catch (MalformedURLException e) {
CUIPlugin.log(e);
}
- }
- private static final String NAME_PREFIX= AutotoolsUIPlugin.PLUGIN_ID + '.';
- private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length();
-
- public static final String T_OBJ= "ac16/"; //$NON-NLS-1$
- public static final String T_BUILD= "elcl16/"; //$NON-NLS-1$
-
- public static final String IMG_OBJS_IF= NAME_PREFIX + "if_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJS_ELSE= NAME_PREFIX + "else_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJS_ELIF= NAME_PREFIX + "elif_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJS_CASE= NAME_PREFIX + "case_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJS_CONDITION= NAME_PREFIX + "condition_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJS_FOR= NAME_PREFIX + "for_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJS_WHILE= NAME_PREFIX + "while_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJS_ACMACRO= NAME_PREFIX + "acmacro_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJS_AMMACRO= NAME_PREFIX + "ammacro_obj.gif"; //$NON-NLS-1$
+ }
+ private static final String NAME_PREFIX = AutotoolsUIPlugin.PLUGIN_ID + '.';
+ private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
+
+ public static final String T_OBJ = "ac16/"; //$NON-NLS-1$
+ public static final String T_BUILD = "elcl16/"; //$NON-NLS-1$
+
+ public static final String IMG_OBJS_IF = NAME_PREFIX + "if_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ELSE = NAME_PREFIX + "else_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ELIF = NAME_PREFIX + "elif_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_CASE = NAME_PREFIX + "case_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_CONDITION = NAME_PREFIX + "condition_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_FOR = NAME_PREFIX + "for_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_WHILE = NAME_PREFIX + "while_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_ACMACRO = NAME_PREFIX + "acmacro_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_AMMACRO = NAME_PREFIX + "ammacro_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_ACMACRO_ARG = NAME_PREFIX + "acmacro_arg_obj.gif"; //$NON-NLS-1$
public static final String IMG_BUILD_CONFIG = NAME_PREFIX + "build_configs.gif"; //$NON-NLS-1$
public static final String IMG_CFG_CATEGORY = NAME_PREFIX + "config_category.gif"; //$NON-NLS-1$
public static final String IMG_CFG_TOOL = NAME_PREFIX + "config_tool.gif"; //$NON-NLS-1$
- public static final ImageDescriptor DESC_OBJS_IF= createManaged(T_OBJ, IMG_OBJS_IF);
- public static final ImageDescriptor DESC_OBJS_ELSE= createManaged(T_OBJ, IMG_OBJS_ELSE);
- public static final ImageDescriptor DESC_OBJS_ELIF= createManaged(T_OBJ, IMG_OBJS_ELIF);
- public static final ImageDescriptor DESC_OBJS_CASE= createManaged(T_OBJ, IMG_OBJS_CASE);
+ public static final ImageDescriptor DESC_OBJS_IF = createManaged(T_OBJ, IMG_OBJS_IF);
+ public static final ImageDescriptor DESC_OBJS_ELSE = createManaged(T_OBJ, IMG_OBJS_ELSE);
+ public static final ImageDescriptor DESC_OBJS_ELIF = createManaged(T_OBJ, IMG_OBJS_ELIF);
+ public static final ImageDescriptor DESC_OBJS_CASE = createManaged(T_OBJ, IMG_OBJS_CASE);
public static final ImageDescriptor DESC_OBJS_CONDITION = createManaged(T_OBJ, IMG_OBJS_CONDITION);
- public static final ImageDescriptor DESC_OBJS_FOR= createManaged(T_OBJ, IMG_OBJS_FOR);
- public static final ImageDescriptor DESC_OBJS_WHILE= createManaged(T_OBJ, IMG_OBJS_WHILE);
- public static final ImageDescriptor DESC_OBJS_ACMACRO= createManaged(T_OBJ, IMG_OBJS_ACMACRO);
- public static final ImageDescriptor DESC_OBJS_AMMACRO= createManaged(T_OBJ, IMG_OBJS_AMMACRO);
- public static final ImageDescriptor DESC_OBJS_ACMACRO_ARG= createManaged(T_OBJ, IMG_OBJS_ACMACRO_ARG);
+ public static final ImageDescriptor DESC_OBJS_FOR = createManaged(T_OBJ, IMG_OBJS_FOR);
+ public static final ImageDescriptor DESC_OBJS_WHILE = createManaged(T_OBJ, IMG_OBJS_WHILE);
+ public static final ImageDescriptor DESC_OBJS_ACMACRO = createManaged(T_OBJ, IMG_OBJS_ACMACRO);
+ public static final ImageDescriptor DESC_OBJS_AMMACRO = createManaged(T_OBJ, IMG_OBJS_AMMACRO);
+ public static final ImageDescriptor DESC_OBJS_ACMACRO_ARG = createManaged(T_OBJ, IMG_OBJS_ACMACRO_ARG);
public static final ImageDescriptor DESC_BUILD_CONFIG = createManaged(T_BUILD, IMG_BUILD_CONFIG);
public static final ImageDescriptor DESC_CFG_CATEGORY = createManaged(T_BUILD, IMG_CFG_CATEGORY);
public static final ImageDescriptor DESC_CFG_TOOL = createManaged(T_BUILD, IMG_CFG_TOOL);
@@ -81,23 +80,24 @@ public class AutotoolsUIPluginImages {
private static ImageDescriptor createManaged(String prefix, String name) {
return createManaged(imageRegistry, prefix, name);
}
-
+
private static ImageDescriptor createManaged(ImageRegistry registry, String prefix, String name) {
- ImageDescriptor result= ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
+ ImageDescriptor result = ImageDescriptor
+ .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
registry.put(name, result);
return result;
}
-
+
public static Image get(String key) {
return imageRegistry.get(key);
}
-
+
private static ImageDescriptor create(String prefix, String name) {
return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
}
-
+
private static URL makeIconFileURL(String prefix, String name) {
- StringBuilder buffer= new StringBuilder(prefix);
+ StringBuilder buffer = new StringBuilder(prefix);
buffer.append(name);
try {
return new URL(fgIconBaseURL, buffer.toString());
@@ -106,15 +106,15 @@ public class AutotoolsUIPluginImages {
return null;
}
}
-
+
/**
* Sets all available image descriptors for the given action.
- */
+ */
public static void setImageDescriptors(IAction action, String type, String relPath) {
- if (relPath.startsWith(NAME_PREFIX))
- relPath= relPath.substring(NAME_PREFIX_LENGTH);
+ if (relPath.startsWith(NAME_PREFIX))
+ relPath = relPath.substring(NAME_PREFIX_LENGTH);
action.setDisabledImageDescriptor(create("d" + type, relPath)); //$NON-NLS-1$
-// action.setHoverImageDescriptor(create("c" + type, relPath)); //$NON-NLS-1$
+ // action.setHoverImageDescriptor(create("c" + type, relPath)); //$NON-NLS-1$
action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$
// We are still not sure about this, let see TF results first.
@@ -123,10 +123,10 @@ public class AutotoolsUIPluginImages {
//ImageDescriptor desc = getImageRegistry().getDescriptor(relPath);
//if(desc == null) {
// desc = createManaged(T + "c" + type, relPath);
- //}
+ //}
//action.setImageDescriptor(desc);
}
-
+
/**
* Helper method to access the image registry from the CUIPlugin class.
*/
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CBuildStepsConsole.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CBuildStepsConsole.java
index 9887ceb4240..e58ae573c5f 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CBuildStepsConsole.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CBuildStepsConsole.java
@@ -14,11 +14,10 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui;
-
public class CBuildStepsConsole extends Console {
private static final String CONTEXT_MENU_ID = "CAutotoolsBuildStepsConsole"; //$NON-NLS-1$
private static final String CONSOLE_NAME = ConsoleMessages.getString("BuildStepsConsole.name"); //$NON-NLS-1$
-
+
public CBuildStepsConsole() {
super(CONSOLE_NAME, CONTEXT_MENU_ID);
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CConfigureConsole.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CConfigureConsole.java
index 2a0ddd738e9..8817ae5415a 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CConfigureConsole.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CConfigureConsole.java
@@ -13,11 +13,10 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui;
-
public class CConfigureConsole extends Console {
private static final String CONTEXT_MENU_ID = "CAutotoolsConfigureConsole"; //$NON-NLS-1$
private static final String CONSOLE_NAME = ConsoleMessages.getString("ConfigureConsole.name"); //$NON-NLS-1$
-
+
public CConfigureConsole() {
super(CONSOLE_NAME, CONTEXT_MENU_ID);
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CWordFinder.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CWordFinder.java
index 598e98b35cf..e26396d81cb 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CWordFinder.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/CWordFinder.java
@@ -18,18 +18,17 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-
/**
* This is a helper class for the text editor to be able to determine, given a
* particular offset in a document, various candidates segments for things like
* context help, proposals and hovering.
*/
public class CWordFinder {
-
+
private static final char CBRACE_L = '{';
private static final char CBRACE_R = '}';
- private static final char BRACE_R = ')';
-
+ private static final char BRACE_R = ')';
+
/**
* This method determines for a given offset into a given document what the
* region is which defines the current word. A word is defined as the set of
@@ -38,7 +37,7 @@ public class CWordFinder {
* int b) --> word = afunction afunction!(int a, int b) --> word = afunction
* afunction(!int a, int b) --> word = length 0 afunction(int a,! int b) -->
* word = length 0 afunction(!) --> word = length 0
- *
+ *
* @param document
* The document to be examined
* @param offset
@@ -93,7 +92,7 @@ public class CWordFinder {
/**
* This method will determine the region for the name of the function within
* which the current offset is contained.
- *
+ *
* @param document
* The document to be examined
* @param offset
@@ -206,16 +205,16 @@ public class CWordFinder {
}
/**
- * This method will determine whether current offset is contained
- * in any function's body or it's outside it.
- *
+ * This method will determine whether current offset is contained
+ * in any function's body or it's outside it.
+ *
* @param document
* The document to be examined
* @param offset
* The offset into the document
- * @return
- * <code>true</code> if there is no function body around offset
- * <code>false</code> otherwise
+ * @return
+ * <code>true</code> if there is no function body around offset
+ * <code>false</code> otherwise
*/
public static boolean isGlobal(IDocument document, int offset) {
try {
@@ -233,54 +232,58 @@ public class CWordFinder {
if (bracketcount-- == 0) {
do {
c = document.getChar(pos--);
- if (c == BRACE_R) return false;
+ if (c == BRACE_R)
+ return false;
} while (Character.isWhitespace(c));
// container block seems to be not a function or statement body
- pos++; // step back one symbol
- bracketcount = 0; // let's search for upper block
+ pos++; // step back one symbol
+ bracketcount = 0; // let's search for upper block
}
}
}
-
- } catch (BadLocationException x) { /* Ignore */ }
- // return true in case of unknown result or exception
+
+ } catch (BadLocationException x) {
+ /* Ignore */ }
+ // return true in case of unknown result or exception
return true;
}
-
+
/**
* Searches for line feed symbols in string.
* First met '\r' or '\n' is treated as LF symbol
- *
+ *
* @param s
* string to search in.
* @return number of LFs met.
*/
- public static int countLFs (String s) {
+ public static int countLFs(String s) {
int counter = 0;
char lf = 0;
char c;
- for (int i=0; i<s.length(); i++) {
+ for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
if (lf == 0) {
if (c == '\n' || c == '\r') {
lf = c;
counter++;
}
- } else if (lf == c) counter++;
+ } else if (lf == c)
+ counter++;
}
return counter;
}
/**
- * Checks whether the string contains any C-block delimiters ( { } )
- *
- * @param s
+ * Checks whether the string contains any C-block delimiters ( { } )
+ *
+ * @param s
* text to check
* @return true if curled brace found.
*/
- public static boolean hasCBraces (String s) {
- if (s.indexOf(CBRACE_L) > -1 || s.indexOf(CBRACE_R) > -1) return true;
- else return false;
+ public static boolean hasCBraces(String s) {
+ if (s.indexOf(CBRACE_L) > -1 || s.indexOf(CBRACE_R) > -1)
+ return true;
+ else
+ 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 621ce903ebf..3c2ecf8523f 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
@@ -23,18 +23,17 @@ import org.eclipse.core.runtime.CoreException;
public class Console implements IConsole {
IProject project;
IBuildConsoleManager fConsoleManager;
-
+
public Console(String consoleName, String contextId) {
- fConsoleManager = CUIPlugin.getDefault().getConsoleManager(consoleName,
- contextId);
+ fConsoleManager = CUIPlugin.getDefault().getConsoleManager(consoleName, contextId);
}
-
+
@Override
- public void start(IProject project ) {
+ public void start(IProject project) {
this.project = project;
fConsoleManager.getConsole(project).start(project);
}
-
+
/**
* @throws CoreException
* @see org.eclipse.cdt.core.resources.IConsole#getOutputStream()
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ConsoleMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ConsoleMessages.java
index 07927521d85..c0f0c003686 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ConsoleMessages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ConsoleMessages.java
@@ -25,6 +25,7 @@ public class ConsoleMessages {
private ConsoleMessages() {
}
+
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
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 6ac746ed74b..4b01e367c1b 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
@@ -31,7 +31,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
IMakeBuilderInfo fBuildInfo;
boolean useBuildInfo = false;
Preferences fPrefs;
-
+
public ErrorParserBlock(Preferences preferences) {
super();
fPrefs = preferences;
@@ -44,7 +44,8 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
Composite composite = ControlFactory.createComposite(parent, 1);
setControl(composite);
ControlFactory.createEmptySpace(composite);
- ControlFactory.createLabel(composite, MakeUIMessages.getResourceString("ErrorParserBlock.label.missingBuilderInformation")); //$NON-NLS-1$
+ ControlFactory.createLabel(composite,
+ MakeUIMessages.getResourceString("ErrorParserBlock.label.missingBuilderInformation")); //$NON-NLS-1$
return;
}
super.createControl(parent);
@@ -77,19 +78,18 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
}
}
-
@Override
protected void saveErrorParsers(String[] parserIDs) throws CoreException {
fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, MakeBuilder.BUILDER_ID, false);
fBuildInfo.setErrorParsers(parserIDs);
}
-
+
@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);
@@ -98,7 +98,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
fBuildInfo = MakeCorePlugin.createBuildInfo(getContainer().getProject(), MakeBuilder.BUILDER_ID);
} catch (CoreException e) {
}
- useBuildInfo = true;
+ useBuildInfo = true;
}
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/FileRelevance.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/FileRelevance.java
index d7a4cb61867..87ca1fab560 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/FileRelevance.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/FileRelevance.java
@@ -25,13 +25,13 @@ import org.eclipse.core.resources.ResourceAttributes;
* from multiple files for the same file-system location.
*/
public class FileRelevance {
- private static final int PREFERRED_PROJECT = 0x40;
- private static final int CDT_PROJECT = 0x20;
- private static final int ON_SOURCE_ROOT = 0x10;
+ private static final int PREFERRED_PROJECT = 0x40;
+ private static final int CDT_PROJECT = 0x20;
+ private static final int ON_SOURCE_ROOT = 0x10;
// Penalty for undesirable attributes
- private static final int LINK_PENALTY = 1;
- private static final int INACCESSIBLE_SHIFT = 4;
+ private static final int LINK_PENALTY = 1;
+ private static final int INACCESSIBLE_SHIFT = 4;
/**
* Compute a relevance for the given file. The higher the score the more relevant the
@@ -45,16 +45,16 @@ public class FileRelevance {
* @return integer representing file relevance. Larger numbers are more relevant
*/
public static int getRelevance(IFile f, IProject preferredProject) {
- int result= 0;
- IProject p= f.getProject();
+ int result = 0;
+ IProject p = f.getProject();
if (p.equals(preferredProject))
- result+= PREFERRED_PROJECT;
+ result += PREFERRED_PROJECT;
if (CoreModel.hasCNature(p)) {
- result+= CDT_PROJECT;
- ICProject cproject= CoreModel.getDefault().create(p);
+ result += CDT_PROJECT;
+ ICProject cproject = CoreModel.getDefault().create(p);
if (cproject.isOnSourceRoot(f))
- result+= ON_SOURCE_ROOT;
+ result += ON_SOURCE_ROOT;
}
if (!f.isAccessible())
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 c0ebbbcbe3a..bbc32258d31 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
@@ -14,7 +14,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui;
-
import java.io.IOException;
import java.io.PushbackReader;
import java.io.Reader;
@@ -27,21 +26,19 @@ import org.eclipse.jface.text.TextPresentation;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
-
/**
- * Reads the text contents from a reader of HTML contents and translates
+ * Reads the text contents from a reader of HTML contents and translates
* the tags or cut them out.
*/
public class HTML2TextReader extends SubstitutionTextReader {
-
-
- private static final String LINE_DELIM= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ private static final String LINE_DELIM = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
private static final Map<String, String> fgEntityLookup;
private static final Set<String> fgTags;
-
+
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$
@@ -51,73 +48,74 @@ public class HTML2TextReader extends SubstitutionTextReader {
fgTags.add("dd"); //$NON-NLS-1$
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$
fgEntityLookup.put("amp", "&"); //$NON-NLS-1$ //$NON-NLS-2$
fgEntityLookup.put("circ", "^"); //$NON-NLS-1$ //$NON-NLS-2$
fgEntityLookup.put("tilde", "~"); //$NON-NLS-2$ //$NON-NLS-1$
- fgEntityLookup.put("quot", "\""); //$NON-NLS-1$ //$NON-NLS-2$
+ fgEntityLookup.put("quot", "\""); //$NON-NLS-1$ //$NON-NLS-2$
}
-
- private int fCounter= 0;
+
+ private int fCounter = 0;
private TextPresentation fTextPresentation;
- private int fBold= 0;
- private int fStartOffset= -1;
- private boolean fInParagraph= false;
+ private int fBold = 0;
+ private int fStartOffset = -1;
+ private boolean fInParagraph = false;
/**
* Transforms the html text from the reader to formatted text.
- * @param presentation If not <code>null</code>, formattings will be applied to
+ * @param presentation If not <code>null</code>, formattings will be applied to
* the presentation.
*/
public HTML2TextReader(Reader reader, TextPresentation presentation) {
super(new PushbackReader(reader));
- fTextPresentation= presentation;
+ fTextPresentation = presentation;
}
-
+
@Override
public int read() throws IOException {
- int c= super.read();
+ int c = super.read();
if (c != -1)
- ++ fCounter;
+ ++fCounter;
return c;
}
-
+
protected void startBold() {
if (fBold == 0)
- fStartOffset= fCounter;
- ++ fBold;
+ fStartOffset = fCounter;
+ ++fBold;
}
-
+
protected void stopBold() {
- -- fBold;
+ --fBold;
if (fBold == 0) {
if (fTextPresentation != null) {
- fTextPresentation.addStyleRange(new StyleRange(fStartOffset, fCounter - fStartOffset, null, null, SWT.BOLD));
+ fTextPresentation
+ .addStyleRange(new StyleRange(fStartOffset, fCounter - fStartOffset, null, null, SWT.BOLD));
}
- fStartOffset= -1;
+ fStartOffset = -1;
}
}
-
+
@Override
protected String computeSubstitution(int c) throws IOException {
if (c == '<')
- return processHTMLTag();
+ return processHTMLTag();
else if (c == '&')
return processEntity();
-
+
return null;
}
private String html2Text(String html) {
-
- String tag= html;
+
+ String tag = html;
if ('/' == tag.charAt(0))
- tag= tag.substring(1);
-
+ tag = tag.substring(1);
+
if (!fgTags.contains(tag))
return ""; //$NON-NLS-1$
@@ -125,135 +123,135 @@ public class HTML2TextReader extends SubstitutionTextReader {
startBold();
return ""; //$NON-NLS-1$
}
-
+
if ("h5".equals(html) || "dt".equals(html)) { //$NON-NLS-1$ //$NON-NLS-2$
startBold();
return ""; //$NON-NLS-1$
}
-
+
if ("dl".equals(html)) //$NON-NLS-1$
return LINE_DELIM;
-
+
if ("dd".equals(html)) //$NON-NLS-1$
return "\t"; //$NON-NLS-1$
-
+
if ("li".equals(html)) //$NON-NLS-1$
return LINE_DELIM + "\t" + "-"; //$NON-NLS-1$ //$NON-NLS-2$
-
+
if ("/b".equals(html)) { //$NON-NLS-1$
stopBold();
return ""; //$NON-NLS-1$
}
- if ("p".equals(html)) { //$NON-NLS-1$
- fInParagraph= true;
+ if ("p".equals(html)) { //$NON-NLS-1$
+ fInParagraph = true;
return LINE_DELIM;
}
if ("br".equals(html)) //$NON-NLS-1$
return LINE_DELIM;
-
- if ("/p".equals(html)) { //$NON-NLS-1$
- boolean inParagraph= fInParagraph;
- fInParagraph= false;
+
+ if ("/p".equals(html)) { //$NON-NLS-1$
+ boolean inParagraph = fInParagraph;
+ fInParagraph = false;
return inParagraph ? "" : LINE_DELIM; //$NON-NLS-1$
}
-
+
if ("/h5".equals(html) || "/dt".equals(html)) { //$NON-NLS-1$ //$NON-NLS-2$
stopBold();
return LINE_DELIM;
}
-
+
if ("/dd".equals(html)) //$NON-NLS-1$
return LINE_DELIM;
-
+
return ""; //$NON-NLS-1$
}
-
+
/*
* A '<' has been read. Process a html tag
- */
+ */
private String processHTMLTag() throws IOException {
-
- StringBuilder buf= new StringBuilder();
+
+ StringBuilder buf = new StringBuilder();
int ch;
- do {
-
- ch= nextChar();
-
+ do {
+
+ ch = nextChar();
+
while (ch != -1 && ch != '>') {
buf.append(Character.toLowerCase((char) ch));
- ch= nextChar();
- if (ch == '"'){
+ ch = nextChar();
+ if (ch == '"') {
buf.append(Character.toLowerCase((char) ch));
- ch= nextChar();
- while (ch != -1 && ch != '"'){
+ ch = nextChar();
+ while (ch != -1 && ch != '"') {
buf.append(Character.toLowerCase((char) ch));
- ch= nextChar();
- }
+ ch = nextChar();
+ }
}
- if (ch == '<'){
+ if (ch == '<') {
unread(ch);
return '<' + buf.toString();
- }
+ }
}
-
+
if (ch == -1)
return null;
-
- int tagLen= buf.length();
- // needs special treatment for comments
+
+ int tagLen = buf.length();
+ // needs special treatment for comments
if ((tagLen >= 3 && "!--".equals(buf.substring(0, 3))) //$NON-NLS-1$
- && !(tagLen >= 5 && "--!".equals(buf.substring(tagLen - 3)))) { //$NON-NLS-1$
+ && !(tagLen >= 5 && "--!".equals(buf.substring(tagLen - 3)))) { //$NON-NLS-1$
// unfinished comment
buf.append(ch);
} else {
break;
}
} while (true);
-
+
return html2Text(buf.toString());
}
-
+
private void unread(int ch) throws IOException {
((PushbackReader) getReader()).unread(ch);
}
-
+
protected String entity2Text(String symbol) {
if (symbol.length() > 1 && symbol.charAt(0) == '#') {
int ch;
try {
if (symbol.charAt(1) == 'x') {
- ch= Integer.parseInt(symbol.substring(2), 16);
+ ch = Integer.parseInt(symbol.substring(2), 16);
} else {
- ch= Integer.parseInt(symbol.substring(1), 10);
+ ch = Integer.parseInt(symbol.substring(1), 10);
}
- return "" + (char)ch; //$NON-NLS-1$
+ return "" + (char) ch; //$NON-NLS-1$
} catch (NumberFormatException e) {
}
} else {
- String str= fgEntityLookup.get(symbol);
+ String str = fgEntityLookup.get(symbol);
if (str != null) {
return str;
}
}
return "&" + symbol; // not found //$NON-NLS-1$
}
-
+
/*
* A '&' has been read. Process a entity
- */
+ */
private String processEntity() throws IOException {
- StringBuilder buf= new StringBuilder();
- int ch= nextChar();
- while (Character.isLetterOrDigit((char)ch) || ch == '#') {
+ StringBuilder buf = new StringBuilder();
+ int ch = nextChar();
+ while (Character.isLetterOrDigit((char) ch) || ch == '#') {
buf.append((char) ch);
- ch= nextChar();
+ ch = nextChar();
}
-
- if (ch == ';')
+
+ if (ch == ';')
return entity2Text(buf.toString());
-
+
buf.insert(0, '&');
if (ch != -1)
buf.append((char) ch);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java
index 3b261ef496b..068a5973443 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/HTMLPrinter.java
@@ -17,78 +17,77 @@ package org.eclipse.cdt.internal.autotools.ui;
import java.io.IOException;
import java.io.Reader;
-
/**
* Provides a set of convenience methods for creating HTML pages.
*/
public class HTMLPrinter {
-
+
private HTMLPrinter() {
}
-
+
private static String replace(String text, char c, String s) {
-
- int previous= 0;
- int current= text.indexOf(c, previous);
-
+
+ int previous = 0;
+ int current = text.indexOf(c, previous);
+
if (current == -1)
return text;
-
+
StringBuilder buffer = new StringBuilder();
while (current > -1) {
buffer.append(text.substring(previous, current));
buffer.append(s);
- previous= current + 1;
- current= text.indexOf(c, previous);
+ previous = current + 1;
+ current = text.indexOf(c, previous);
}
buffer.append(text.substring(previous));
-
+
return buffer.toString();
}
-
+
public static String convertToHTMLContent(String content) {
- content= replace(content, '<', "&lt;"); //$NON-NLS-1$
+ content = replace(content, '<', "&lt;"); //$NON-NLS-1$
return replace(content, '>', "&gt;"); //$NON-NLS-1$
}
-
+
public static String read(Reader rd) {
-
+
StringBuilder buffer = new StringBuilder();
- char[] readBuffer= new char[2048];
-
+ char[] readBuffer = new char[2048];
+
try {
- int n= rd.read(readBuffer);
+ int n = rd.read(readBuffer);
while (n > 0) {
buffer.append(readBuffer, 0, n);
- n= rd.read(readBuffer);
+ n = rd.read(readBuffer);
}
return buffer.toString();
} catch (IOException x) {
}
-
+
return null;
}
public static void insertPageProlog(StringBuilder buffer, int position) {
buffer.insert(position, "<html><body text=\"#000000\" bgcolor=\"#FFFF88\"><font size=-1>"); //$NON-NLS-1$
}
-
+
public static void addPageProlog(StringBuilder buffer) {
insertPageProlog(buffer, buffer.length());
}
-
+
public static void addPageEpilog(StringBuilder buffer) {
buffer.append("</font></body></html>"); //$NON-NLS-1$
}
-
+
public static void startBulletList(StringBuilder buffer) {
buffer.append("<ul>"); //$NON-NLS-1$
}
-
+
public static void endBulletList(StringBuilder buffer) {
buffer.append("</ul>"); //$NON-NLS-1$
}
-
+
public static void addBullet(StringBuilder buffer, String bullet) {
if (bullet != null) {
buffer.append("<li>"); //$NON-NLS-1$
@@ -96,7 +95,7 @@ public class HTMLPrinter {
buffer.append("</li>"); //$NON-NLS-1$
}
}
-
+
public static void addSmallHeader(StringBuilder buffer, String header) {
if (header != null) {
buffer.append("<h5>"); //$NON-NLS-1$
@@ -104,16 +103,15 @@ public class HTMLPrinter {
buffer.append("</h5>"); //$NON-NLS-1$
}
}
-
+
public static void addParagraph(StringBuilder buffer, String paragraph) {
if (paragraph != null) {
buffer.append("<p>"); //$NON-NLS-1$
buffer.append(paragraph);
}
}
-
- public static void addParagraph(StringBuilder buffer,
- Reader paragraphReader) {
+
+ public static void addParagraph(StringBuilder buffer, Reader paragraphReader) {
if (paragraphReader != null)
addParagraph(buffer, read(paragraphReader));
}
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 9e6dcd6cad9..eb69f51324d 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
@@ -27,97 +27,98 @@ import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Display;
-
public class HTMLTextPresenter implements DefaultInformationControl.IInformationPresenter {
-
- private static final String LINE_DELIM= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
+ private static final String LINE_DELIM = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
private int fCounter;
private boolean fEnforceUpperLineLimit;
-
+
public HTMLTextPresenter(boolean enforceUpperLineLimit) {
super();
- fEnforceUpperLineLimit= enforceUpperLineLimit;
+ fEnforceUpperLineLimit = enforceUpperLineLimit;
}
-
+
public HTMLTextPresenter() {
this(true);
}
-
+
protected Reader createReader(String hoverInfo, TextPresentation presentation) {
return new HTML2TextReader(new StringReader(hoverInfo), presentation);
}
-
+
protected void adaptTextPresentation(TextPresentation presentation, int offset, int insertLength) {
-
- int yoursStart= offset;
-
+
+ int yoursStart = offset;
+
Iterator<StyleRange> e = presentation.getAllStyleRangeIterator();
while (e.hasNext()) {
-
- StyleRange range= e.next();
-
- int myStart= range.start;
- int myEnd= range.start + range.length -1;
- myEnd= Math.max(myStart, myEnd);
-
+
+ StyleRange range = e.next();
+
+ int myStart = range.start;
+ int myEnd = range.start + range.length - 1;
+ myEnd = Math.max(myStart, myEnd);
+
if (myEnd < yoursStart)
continue;
-
+
if (myStart < yoursStart)
range.length += insertLength;
else
range.start += insertLength;
}
}
-
+
private void append(StringBuilder buffer, String string, TextPresentation presentation) {
-
- int length= string.length();
+
+ int length = string.length();
buffer.append(string);
-
+
if (presentation != null)
adaptTextPresentation(presentation, fCounter, length);
-
+
fCounter += length;
}
-
+
private String getIndent(String line) {
- int length= line.length();
-
- int i= 0;
- while (i < length && Character.isWhitespace(line.charAt(i))) ++i;
-
+ int length = line.length();
+
+ int i = 0;
+ while (i < length && Character.isWhitespace(line.charAt(i)))
+ ++i;
+
return (i == length ? line : line.substring(0, i)) + " "; //$NON-NLS-1$
}
-
+
@Override
- public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight) {
-
+ public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth,
+ int maxHeight) {
+
if (hoverInfo == null)
return null;
-
- GC gc= new GC(display);
+
+ GC gc = new GC(display);
try {
-
- StringBuilder buffer= new StringBuilder();
- int maxNumberOfLines= Math.round((float)maxHeight / gc.getFontMetrics().getHeight());
-
- fCounter= 0;
- LineBreakingReader reader= new LineBreakingReader(createReader(hoverInfo, presentation), gc, maxWidth);
-
- boolean lastLineFormatted= false;
- String lastLineIndent= null;
-
- String line=reader.readLine();
- boolean lineFormatted= reader.isFormattedLine();
- boolean firstLineProcessed= false;
-
+
+ StringBuilder buffer = new StringBuilder();
+ int maxNumberOfLines = Math.round((float) maxHeight / gc.getFontMetrics().getHeight());
+
+ fCounter = 0;
+ LineBreakingReader reader = new LineBreakingReader(createReader(hoverInfo, presentation), gc, maxWidth);
+
+ boolean lastLineFormatted = false;
+ String lastLineIndent = null;
+
+ String line = reader.readLine();
+ boolean lineFormatted = reader.isFormattedLine();
+ boolean firstLineProcessed = false;
+
while (line != null) {
-
+
if (fEnforceUpperLineLimit && maxNumberOfLines <= 0)
break;
-
+
if (firstLineProcessed) {
if (!lastLineFormatted)
append(buffer, LINE_DELIM, null);
@@ -127,62 +128,61 @@ public class HTMLTextPresenter implements DefaultInformationControl.IInformation
append(buffer, lastLineIndent, presentation);
}
}
-
+
append(buffer, line, null);
- firstLineProcessed= true;
-
- lastLineFormatted= lineFormatted;
+ firstLineProcessed = true;
+
+ lastLineFormatted = lineFormatted;
if (!lineFormatted)
- lastLineIndent= null;
+ lastLineIndent = null;
else if (lastLineIndent == null)
- lastLineIndent= getIndent(line);
-
- line= reader.readLine();
- lineFormatted= reader.isFormattedLine();
-
+ lastLineIndent = getIndent(line);
+
+ line = reader.readLine();
+ lineFormatted = reader.isFormattedLine();
+
maxNumberOfLines--;
}
-
+
if (line != null) {
append(buffer, LINE_DELIM, lineFormatted ? presentation : null);
append(buffer, (""), presentation); //$NON-NLS-1$
}
-
+
return trim(buffer, presentation);
-
+
} catch (IOException e) {
-
+
AutotoolsUIPlugin.log(e);
return null;
-
+
} finally {
gc.dispose();
}
}
-
+
private String trim(StringBuilder buffer, TextPresentation presentation) {
-
- int length= buffer.length();
-
- int end= length -1;
+
+ int length = buffer.length();
+
+ int end = length - 1;
while (end >= 0 && Character.isWhitespace(buffer.charAt(end)))
- -- end;
-
+ --end;
+
if (end == -1)
return ""; //$NON-NLS-1$
-
- if (end < length -1)
+
+ if (end < length - 1)
buffer.delete(end + 1, length);
else
- end= length;
-
- int start= 0;
+ end = length;
+
+ int start = 0;
while (start < end && Character.isWhitespace(buffer.charAt(start)))
- ++ start;
-
+ ++start;
+
buffer.delete(0, start);
presentation.setResultWindow(new Region(start, buffer.length()));
return buffer.toString();
}
}
-
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LineBreakingReader.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LineBreakingReader.java
index e6bcbe06c12..54e0a1dc31c 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LineBreakingReader.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LineBreakingReader.java
@@ -25,89 +25,92 @@ import org.eclipse.swt.graphics.GC;
* Not a real reader. Could change if requested
*/
public class LineBreakingReader {
-
+
private BufferedReader fReader;
private GC fGC;
private int fMaxWidth;
-
+
private String fLine;
private int fOffset;
-
+
private BreakIterator fLineBreakIterator;
+
private int findNextBreakOffset(int currOffset) {
- int currWidth= 0;
- int nextOffset= fLineBreakIterator.following(currOffset);
+ int currWidth = 0;
+ int nextOffset = fLineBreakIterator.following(currOffset);
while (nextOffset != BreakIterator.DONE) {
- String word= fLine.substring(currOffset, nextOffset);
- int wordWidth= fGC.textExtent(word).x;
- int nextWidth= wordWidth + currWidth;
+ String word = fLine.substring(currOffset, nextOffset);
+ int wordWidth = fGC.textExtent(word).x;
+ int nextWidth = wordWidth + currWidth;
if (nextWidth > fMaxWidth) {
if (currWidth > 0) {
return currOffset;
}
return nextOffset;
}
- currWidth= nextWidth;
- currOffset= nextOffset;
- nextOffset= fLineBreakIterator.next();
+ currWidth = nextWidth;
+ currOffset = nextOffset;
+ nextOffset = fLineBreakIterator.next();
}
return nextOffset;
}
+
private int findWordBegin(int idx) {
while (idx < fLine.length() && Character.isWhitespace(fLine.charAt(idx))) {
idx++;
}
return idx;
}
+
/**
* Creates a reader that breaks an input text to fit in a given width.
* @param reader Reader of the input text
* @param gc The graphic context that defines the currently used font sizes
- * @param maxLineWidth The max width (pixes) where the text has to fit in
+ * @param maxLineWidth The max width (pixes) where the text has to fit in
*/
public LineBreakingReader(Reader reader, GC gc, int maxLineWidth) {
- fReader= new BufferedReader(reader);
- fGC= gc;
- fMaxWidth= maxLineWidth;
- fOffset= 0;
- fLine= null;
- fLineBreakIterator= BreakIterator.getLineInstance();
+ fReader = new BufferedReader(reader);
+ fGC = gc;
+ fMaxWidth = maxLineWidth;
+ fOffset = 0;
+ fLine = null;
+ fLineBreakIterator = BreakIterator.getLineInstance();
}
-
+
public boolean isFormattedLine() {
return fLine != null;
}
-
+
/**
* Reads the next line. The lengths of the line will not exceed the gived maximum
* width.
*/
public String readLine() throws IOException {
if (fLine == null) {
- String line= fReader.readLine();
+ String line = fReader.readLine();
if (line == null) {
return null;
}
-
- int lineLen= fGC.textExtent(line).x;
+
+ int lineLen = fGC.textExtent(line).x;
if (lineLen < fMaxWidth) {
return line;
}
- fLine= line;
+ fLine = line;
fLineBreakIterator.setText(line);
- fOffset= 0;
+ fOffset = 0;
}
- int breakOffset= findNextBreakOffset(fOffset);
+ int breakOffset = findNextBreakOffset(fOffset);
String res;
if (breakOffset != BreakIterator.DONE) {
- res= fLine.substring(fOffset, breakOffset);
- fOffset= findWordBegin(breakOffset);
+ res = fLine.substring(fOffset, breakOffset);
+ fOffset = findWordBegin(breakOffset);
if (fOffset == fLine.length()) {
- fLine= null;
+ fLine = null;
}
} else {
- res= fLine.substring(fOffset);
- fLine= null;
+ res = fLine.substring(fOffset);
+ fLine = null;
}
return res;
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LocationAdapter.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LocationAdapter.java
index 0260281dd8e..bb9e174631e 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LocationAdapter.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/LocationAdapter.java
@@ -10,7 +10,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui;
import java.io.File;
@@ -27,10 +27,13 @@ import org.eclipse.core.runtime.IPath;
* Provides common functionality for URI and IPath
*/
abstract class LocationAdapter<T> {
-
+
public abstract String extractName(T location);
+
public abstract IFile[] platformsFindFilesForLocation(T location);
+
public abstract String getCanonicalPath(T location);
+
public abstract T getLocation(IFile file);
public static final LocationAdapter<IPath> PATH = new LocationAdapter<IPath>() {
@@ -50,7 +53,7 @@ abstract class LocationAdapter<T> {
@Override
public String getCanonicalPath(IPath location) {
- final File file= location.toFile();
+ final File file = location.toFile();
try {
return file.getCanonicalPath();
} catch (IOException e) {
@@ -68,9 +71,9 @@ abstract class LocationAdapter<T> {
public static final LocationAdapter<URI> URI = new LocationAdapter<URI>() {
@Override
public String extractName(URI location) {
- String path= location.getPath();
- int idx= path.lastIndexOf('/');
- return path.substring(idx+1);
+ String path = location.getPath();
+ int idx = path.lastIndexOf('/');
+ return path.substring(idx + 1);
}
@Override
@@ -80,10 +83,10 @@ abstract class LocationAdapter<T> {
@Override
public String getCanonicalPath(URI location) {
- if (!"file".equals(location.getScheme())) //$NON-NLS-1$
+ if (!"file".equals(location.getScheme())) //$NON-NLS-1$
return null;
- String path= location.getPath();
+ String path = location.getPath();
try {
return new File(path).getCanonicalPath();
} catch (IOException e) {
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIImages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIImages.java
index 29281d9e479..24e70d4430a 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIImages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIImages.java
@@ -22,8 +22,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
-
-
public class MakeUIImages {
/**
@@ -45,7 +43,7 @@ public class MakeUIImages {
private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
public static final String OBJ = "obj16/"; //$NON-NLS-1$
- public static final String T_TOOL= "tool16/"; //$NON-NLS-1$
+ public static final String T_TOOL = "tool16/"; //$NON-NLS-1$
public static final String T_LCL = "lcl16/"; //$NON-NLS-1$
// For the build image
@@ -73,7 +71,8 @@ public class MakeUIImages {
public static final ImageDescriptor DESC_MAKEFILE_TARGET_RULE = createManaged(OBJ, IMG_OBJS_MAKEFILE_TARGET_RULE);
public static final String IMG_OBJS_MAKEFILE_INFERENCE_RULE = NAME_PREFIX + "irule_obj.gif"; //$NON-NLS-1$
- public static final ImageDescriptor DESC_MAKEFILE_INFERENCE_RULE = createManaged(OBJ, IMG_OBJS_MAKEFILE_INFERENCE_RULE);
+ public static final ImageDescriptor DESC_MAKEFILE_INFERENCE_RULE = createManaged(OBJ,
+ IMG_OBJS_MAKEFILE_INFERENCE_RULE);
public static final String IMG_OBJS_MAKEFILE_RELATION = NAME_PREFIX + "relation_obj.gif"; //$NON-NLS-1$
public static final ImageDescriptor DESC_MAKEFILE_RELATION = createManaged(OBJ, IMG_OBJS_MAKEFILE_RELATION);
@@ -90,17 +89,18 @@ public class MakeUIImages {
public static final String IMG_OBJS_ENV_VAR = NAME_PREFIX + "envvar_obj.gif"; //$NON-NLS-1$
public static final ImageDescriptor DESC_ENV_VAR = createManaged(OBJ, IMG_OBJS_ENV_VAR);
- public static final String IMG_TOOLS_ALPHA_SORTING= NAME_PREFIX + "alphab_sort_co.gif"; //$NON-NLS-1$
- public static final String IMG_TOOLS_MAKEFILE_SEGMENT_EDIT= NAME_PREFIX + "segment_edit.gif"; //$NON-NLS-1$
+ public static final String IMG_TOOLS_ALPHA_SORTING = NAME_PREFIX + "alphab_sort_co.gif"; //$NON-NLS-1$
+ public static final String IMG_TOOLS_MAKEFILE_SEGMENT_EDIT = NAME_PREFIX + "segment_edit.gif"; //$NON-NLS-1$
- public static final String IMG_MENU_OPEN_INCLUDE= NAME_PREFIX + "open_include.gif"; //$NON-NLS-1$
+ public static final String IMG_MENU_OPEN_INCLUDE = NAME_PREFIX + "open_include.gif"; //$NON-NLS-1$
private static ImageDescriptor createManaged(String prefix, String name) {
return createManaged(imageRegistry, prefix, name);
}
private static ImageDescriptor createManaged(ImageRegistry registry, String prefix, String name) {
- ImageDescriptor result = ImageDescriptor.createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
+ ImageDescriptor result = ImageDescriptor
+ .createFromURL(makeIconFileURL(prefix, name.substring(NAME_PREFIX_LENGTH)));
registry.put(name, result);
return result;
}
@@ -130,7 +130,7 @@ public class MakeUIImages {
public static void setImageDescriptors(IAction action, String type, String relPath) {
relPath = relPath.substring(NAME_PREFIX_LENGTH);
action.setDisabledImageDescriptor(create("d" + type + "/", relPath)); //$NON-NLS-1$ //$NON-NLS-2$
-// action.setHoverImageDescriptor(create("e" + type + "/", relPath)); //$NON-NLS-1$ //$NON-NLS-2$
+ // action.setHoverImageDescriptor(create("e" + type + "/", relPath)); //$NON-NLS-1$ //$NON-NLS-2$
action.setImageDescriptor(create("e" + type + "/", relPath)); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIMessages.java
index 0ca08b98250..2e27b5e0b5b 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIMessages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MakeUIMessages.java
@@ -25,6 +25,7 @@ public class MakeUIMessages {
private MakeUIMessages() {
}
+
public static String getResourceString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
@@ -32,7 +33,7 @@ public class MakeUIMessages {
return '!' + key + '!';
}
}
-
+
/**
* Returns the plugin's resource bundle,
*/
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MessageLine.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MessageLine.java
index 2fd2a76b673..becc1a1ba5f 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MessageLine.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/MessageLine.java
@@ -19,10 +19,9 @@ import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
-
/**
- * A message line. It distinguishes between "normal" messages and errors.
- * Setting an error message hides a currently displayed message until
+ * A message line. It distinguishes between "normal" messages and errors.
+ * Setting an error message hides a currently displayed message until
* <code>clearErrorMessage</code> is called.
*/
public class MessageLine {
@@ -32,7 +31,7 @@ public class MessageLine {
private Color fNormalMsgAreaBackground;
private boolean hasErrorMessage;
-
+
private CLabel clabel;
/**
@@ -47,14 +46,13 @@ public class MessageLine {
*/
public MessageLine(Composite parent, int style) {
clabel = new CLabel(parent, style);
- fNormalMsgAreaBackground= clabel.getBackground();
+ fNormalMsgAreaBackground = clabel.getBackground();
}
-
/**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
+ * Display the given error message. A currently displayed message
+ * is saved and will be redisplayed when the error message is cleared.
+ */
public void setErrorMessage(String message) {
if (message != null && message.length() > 0) {
hasErrorMessage = true;
@@ -64,16 +62,16 @@ public class MessageLine {
return;
}
hasErrorMessage = false;
- clabel.setText(fMessage);
+ clabel.setText(fMessage);
clabel.setImage(null);
- clabel.setBackground(fNormalMsgAreaBackground);
+ clabel.setBackground(fNormalMsgAreaBackground);
}
public void setMessage(String message) {
fMessage = message;
clabel.setText(message);
}
-
+
public boolean hasErrorMessage() {
return hasErrorMessage;
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/OptionalMessageDialog.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/OptionalMessageDialog.java
index 1906c6f97bf..29b0b9ec240 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/OptionalMessageDialog.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/OptionalMessageDialog.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Anton Leherbauer (Wind River Systems)
@@ -32,18 +32,18 @@ import org.eclipse.swt.widgets.Shell;
/**
* This is a <code>MessageDialog</code> which allows the user
* to choose that the dialog isn't shown again the next time.
- */
+ */
public class OptionalMessageDialog extends MessageDialog {
// String constants for widgets
- private static final String CHECKBOX_TEXT= MakeUIMessages.getResourceString("OptionalMessageDialog_dontShowAgain"); //$NON-NLS-1$
+ private static final String CHECKBOX_TEXT = MakeUIMessages.getResourceString("OptionalMessageDialog_dontShowAgain"); //$NON-NLS-1$
// Dialog store id constants
- private static final String STORE_ID= "OptionalMessageDialog.hide."; //$NON-NLS-1$
+ private static final String STORE_ID = "OptionalMessageDialog.hide."; //$NON-NLS-1$
private static final String KEY_DETAIL = ".detail"; //$NON-NLS-1$
- public static final int NOT_SHOWN= IDialogConstants.CLIENT_ID + 1;
- public static final int NO_DETAIL= -1;
-
+ public static final int NOT_SHOWN = IDialogConstants.CLIENT_ID + 1;
+ public static final int NO_DETAIL = -1;
+
private Button fHideDialogCheckBox;
private String fId;
@@ -51,89 +51,92 @@ public class OptionalMessageDialog extends MessageDialog {
* Opens the dialog but only if the user hasn't choosen to hide it.
* Returns <code>NOT_SHOWN</code> if the dialog was not shown.
*/
- public static int open(String id, Shell parent, String title, Image titleImage, String message, int dialogType, String[] buttonLabels, int defaultButtonIndex) {
+ public static int open(String id, Shell parent, String title, Image titleImage, String message, int dialogType,
+ String[] buttonLabels, int defaultButtonIndex) {
if (!isDialogEnabled(id))
return OptionalMessageDialog.NOT_SHOWN;
-
- MessageDialog dialog= new OptionalMessageDialog(id, parent, title, titleImage, message, dialogType, buttonLabels, defaultButtonIndex);
+
+ MessageDialog dialog = new OptionalMessageDialog(id, parent, title, titleImage, message, dialogType,
+ buttonLabels, defaultButtonIndex);
return dialog.open();
}
- protected OptionalMessageDialog(String id, Shell parent, String title, Image titleImage, String message, int dialogType, String[] buttonLabels, int defaultButtonIndex) {
+ protected OptionalMessageDialog(String id, Shell parent, String title, Image titleImage, String message,
+ int dialogType, String[] buttonLabels, int defaultButtonIndex) {
super(parent, title, titleImage, message, dialogType, buttonLabels, defaultButtonIndex);
- fId= id;
+ fId = id;
}
@Override
protected Control createCustomArea(Composite parent) {
- Composite composite= new Composite(parent, SWT.NONE);
- GridLayout layout= new GridLayout();
- layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- fHideDialogCheckBox= new Button(composite, SWT.CHECK | SWT.LEFT);
+
+ fHideDialogCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT);
fHideDialogCheckBox.setText(CHECKBOX_TEXT);
fHideDialogCheckBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- setDialogEnabled(fId, !((Button)e.widget).getSelection());
+ setDialogEnabled(fId, !((Button) e.widget).getSelection());
}
});
applyDialogFont(fHideDialogCheckBox);
return fHideDialogCheckBox;
}
-
+
//--------------- Configuration handling --------------
-
+
/**
* Returns this dialog
- *
+ *
* @return the settings to be used
*/
private static IDialogSettings getDialogSettings() {
- IDialogSettings settings= CUIPlugin.getDefault().getDialogSettings();
- settings= settings.getSection(STORE_ID);
+ IDialogSettings settings = CUIPlugin.getDefault().getDialogSettings();
+ settings = settings.getSection(STORE_ID);
if (settings == null)
- settings= CUIPlugin.getDefault().getDialogSettings().addNewSection(STORE_ID);
+ settings = CUIPlugin.getDefault().getDialogSettings().addNewSection(STORE_ID);
return settings;
}
-
+
/**
* Answers whether the optional dialog is enabled and should be shown.
*/
public static boolean isDialogEnabled(String key) {
- IDialogSettings settings= getDialogSettings();
+ IDialogSettings settings = getDialogSettings();
return !settings.getBoolean(key);
}
-
+
/**
* Sets a detail for the dialog.
*/
public static void setDialogDetail(String key, int detail) {
- IDialogSettings settings= getDialogSettings();
- settings.put(key+KEY_DETAIL, detail);
+ IDialogSettings settings = getDialogSettings();
+ settings.put(key + KEY_DETAIL, detail);
}
/**
* Returns the detail for this dialog, or NO_DETAIL, if none.
*/
public static int getDialogDetail(String key) {
- IDialogSettings settings= getDialogSettings();
+ IDialogSettings settings = getDialogSettings();
try {
- return settings.getInt(key+KEY_DETAIL);
+ return settings.getInt(key + KEY_DETAIL);
} catch (NumberFormatException e) {
return NO_DETAIL;
}
}
-
+
/**
* Sets whether the optional dialog is enabled and should be shown.
*/
public static void setDialogEnabled(String key, boolean isEnabled) {
- IDialogSettings settings= getDialogSettings();
+ IDialogSettings settings = getDialogSettings();
settings.put(key, !isEnabled);
}
@@ -141,7 +144,7 @@ public class OptionalMessageDialog extends MessageDialog {
* Clears all remembered information about hidden dialogs
*/
public static void clearAllRememberedStates() {
- IDialogSettings settings= CUIPlugin.getDefault().getDialogSettings();
+ IDialogSettings settings = CUIPlugin.getDefault().getDialogSettings();
settings.addNewSection(STORE_ID);
}
}
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 8dd51ee18f2..93c1e3387d6 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
@@ -10,7 +10,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui;
import java.net.URI;
@@ -25,23 +25,23 @@ import org.eclipse.core.runtime.IPath;
* Allows for looking up resources by location or name.
*/
public class ResourceLookup {
- private static ResourceLookupTree lookupTree= new ResourceLookupTree();
+ private static ResourceLookupTree lookupTree = new ResourceLookupTree();
public static void startup() {
lookupTree.startup();
}
-
+
public static void shutdown() {
lookupTree.shutdown();
}
-
+
/**
- * Searches for files with the given location suffix.
- *
- * At this point the method works for sources and headers (no other content types), only.
- * This is done to use less memory and can be changed if necessary.
+ * Searches for files with the given location suffix.
+ *
+ * At this point the method works for sources and headers (no other content types), only.
+ * This is done to use less memory and can be changed if necessary.
* For linked resource files, the name of the link target is relevant.
- *
+ *
* @param locationSuffix the suffix to match, always used as relative path.
* @param projects the projects to search
* @param ignoreCase whether or not to ignore case when comparing the suffix.
@@ -49,10 +49,10 @@ public class ResourceLookup {
public static IFile[] findFilesByName(IPath locationSuffix, IProject[] projects, boolean ignoreCase) {
return lookupTree.findFilesByName(locationSuffix, projects, ignoreCase);
}
-
+
/**
* Uses a lookup-tree that finds resources for locations using the canonical representation
- * of the path.
+ * of the path.
*/
public static IFile[] findFilesForLocationURI(URI location) {
return lookupTree.findFilesForLocationURI(location);
@@ -60,7 +60,7 @@ public class ResourceLookup {
/**
* Uses a lookup-tree that finds resources for locations using the canonical representation
- * of the path. The method does not work for files where the name (last segment) of the
+ * of the path. The method does not work for files where the name (last segment) of the
* resources differs from the name of the location.
*/
public static IFile[] findFilesForLocation(IPath location) {
@@ -70,7 +70,7 @@ public class ResourceLookup {
/**
* Uses {@link #findFilesForLocationURI(URI)} and selects the most relevant file
* from the result. Files form the first project, from cdt-projects and those on source
- * roots are preferred, see {@link FileRelevance}.
+ * roots are preferred, see {@link FileRelevance}.
* @param location an URI for the location of the files to search for.
* @param preferredProject a project to be preferred over others, or <code>null</code>.
* @return a file for the location in one of the given projects, or <code>null</code>.
@@ -83,7 +83,7 @@ public class ResourceLookup {
/**
* Uses {@link #findFilesForLocation(IPath)} and selects the most relevant file
* from the result. Files form the preferred project, from cdt-projects and those on source
- * roots are preferred, see {@link FileRelevance}.
+ * roots are preferred, see {@link FileRelevance}.
* @param location a path for the location of the files to search for.
* @param preferredProject a project to be preferred over others, or <code>null</code>.
* @return a file for the location or <code>null</code>.
@@ -100,17 +100,16 @@ public class ResourceLookup {
if (files.length == 1)
return files[0];
- IFile best= null;
- int bestRelevance= -1;
+ IFile best = null;
+ int bestRelevance = -1;
for (int i = 0; i < files.length; i++) {
IFile file = files[i];
- int relevance= FileRelevance.getRelevance(file, preferredProject);
- if (best == null || relevance > bestRelevance ||
- (relevance == bestRelevance &&
- best.getFullPath().toString().compareTo(file.getFullPath().toString()) > 0)) {
- bestRelevance= relevance;
- best= file;
+ int relevance = FileRelevance.getRelevance(file, preferredProject);
+ if (best == null || relevance > bestRelevance || (relevance == bestRelevance
+ && best.getFullPath().toString().compareTo(file.getFullPath().toString()) > 0)) {
+ bestRelevance = relevance;
+ best = file;
}
}
return best;
@@ -138,19 +137,21 @@ public class ResourceLookup {
});
}
- /**
+ /**
* For testing, only.
*/
public static void dump() {
lookupTree.dump();
}
- /**
+
+ /**
* For testing, only.
*/
public static void unrefNodeMap() {
lookupTree.unrefNodeMap();
}
- /**
+
+ /**
* For testing, only.
*/
public static void simulateNodeMapCollection() {
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 81e159c8348..6afc3d967f7 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
@@ -10,7 +10,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui;
import java.lang.ref.SoftReference;
@@ -52,66 +52,67 @@ import org.eclipse.core.runtime.jobs.Job;
/**
* Allows for looking up resources by location or name. When using this class 100 bytes per resource
- * are needed. Therefore the support is limited to header-files int non-cdt projects and all files
+ * are needed. Therefore the support is limited to header-files int non-cdt projects and all files
* except non-cdt-files in CDT projects.
*
* The information for a project is initialized when first requested and then it is kept up to date
* using a resource change listener. No memory is used, as long as the class is not used.
* When information is not used for more than 10 minutes, the data-structures will be held via a weak
* reference, only and are subject to garbage collection.
- *
+ *
* The node map stores a map from hash-code of file-names to nodes.
* A node contains the name of a file plus a link to the parent resource. From that we can compute
* the resource path and obtain further information via the resource.
*/
class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisitor, IResourceProxyVisitor {
private static final int UNREF_DELAY = 10 * 60000; // 10 min
-
+
private static final boolean VISIT_CHILDREN = true;
private static final boolean SKIP_CHILDREN = false;
private static final IFile[] NO_FILES = new IFile[0];
- private static final int TRIGGER_RECALC=
- IResourceDelta.TYPE | IResourceDelta.REPLACED |
- IResourceDelta.LOCAL_CHANGED | IResourceDelta.OPEN;
-
+ private static final int TRIGGER_RECALC = IResourceDelta.TYPE | IResourceDelta.REPLACED
+ | IResourceDelta.LOCAL_CHANGED | IResourceDelta.OPEN;
+
private static class Extensions {
private final boolean fInvert;
private final Set<String> fExtensions;
+
Extensions(Set<String> extensions, boolean invert) {
- fInvert= invert;
- fExtensions= extensions;
+ fInvert = invert;
+ fExtensions = extensions;
}
+
boolean isRelevant(String filename) {
// accept all files without extension
- final int idx= filename.lastIndexOf('.');
+ final int idx = filename.lastIndexOf('.');
if (idx < 0)
return true;
-
- return fExtensions.contains(filename.substring(idx+1).toUpperCase()) != fInvert;
+
+ return fExtensions.contains(filename.substring(idx + 1).toUpperCase()) != fInvert;
}
}
-
+
private static class Node {
final Node fParent;
final char[] fResourceName;
final boolean fHasFileLocationName;
final boolean fIsFileLinkTarget;
-
+
boolean fDeleted;
boolean fHasChildren;
int fCanonicHash;
-
+
Node(Node parent, char[] name, boolean hasFileLocationName, boolean isFileLinkTarget) {
- fParent= parent;
- fResourceName= name;
- fHasFileLocationName= hasFileLocationName;
- fIsFileLinkTarget= isFileLinkTarget;
+ fParent = parent;
+ fResourceName = name;
+ fHasFileLocationName = hasFileLocationName;
+ fIsFileLinkTarget = isFileLinkTarget;
if (parent != null)
- parent.fHasChildren= true;
+ parent.fHasChildren = true;
}
}
-
- private final Object fLock= new Object();
+
+ private final Object fLock = new Object();
private final Job fUnrefJob;
private SoftReference<Map<Integer, Object>> fNodeMapRef;
private Map<Integer, Object> fNodeMap;
@@ -122,10 +123,11 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
private Node fRootNode;
private boolean fNeedCleanup;
private Node fLastFolderNode;
-
+
public ResourceLookupTree() {
- fRootNode= new Node(null, CharArrayUtils.EMPTY, false, false) {};
- fFileExtensions= new HashMap<>();
+ fRootNode = new Node(null, CharArrayUtils.EMPTY, false, false) {
+ };
+ fFileExtensions = new HashMap<>();
fUnrefJob = Job.create("Timer", monitor -> {
unrefNodeMap();
return Status.OK_STATUS;
@@ -141,8 +143,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
public void shutdown() {
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
synchronized (fLock) {
- fNodeMap= null;
- fNodeMapRef= null;
+ fNodeMap = null;
+ fNodeMapRef = null;
fFileExtensions.clear();
}
}
@@ -152,16 +154,16 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
*/
@Override
public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta delta= event.getDelta();
+ IResourceDelta delta = event.getDelta();
synchronized (fLock) {
if (fNodeMapRef == null)
return;
- boolean unsetMap= false;
+ boolean unsetMap = false;
if (fNodeMap == null) {
- fNodeMap= fNodeMapRef.get();
+ fNodeMap = fNodeMapRef.get();
if (fNodeMap == null)
return;
- unsetMap= true;
+ unsetMap = true;
}
try {
delta.accept(this);
@@ -170,39 +172,39 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
} finally {
if (fNeedCleanup)
cleanup();
- fCurrentExtensions= null;
- fNeedCleanup= false;
+ fCurrentExtensions = null;
+ fNeedCleanup = false;
if (unsetMap)
- fNodeMap= null;
+ fNodeMap = null;
}
}
}
-
+
/**
* Handles resource change notifications by visiting the delta.
*/
@Override
public boolean visit(IResourceDelta delta) {
assert Thread.holdsLock(fLock);
-
- final IResource res= delta.getResource();
+
+ final IResource res = delta.getResource();
if (res instanceof IWorkspaceRoot)
return VISIT_CHILDREN;
-
+
if (res instanceof IProject) {
// project not yet handled
final String name = res.getName();
- final Extensions exts= fFileExtensions.get(name);
+ final Extensions exts = fFileExtensions.get(name);
if (exts == null)
return SKIP_CHILDREN;
-
+
switch (delta.getKind()) {
- case IResourceDelta.ADDED: // new projects should not yet be part of the tree
+ case IResourceDelta.ADDED: // new projects should not yet be part of the tree
case IResourceDelta.REMOVED:
fFileExtensions.remove(name);
remove(res);
return SKIP_CHILDREN;
-
+
case IResourceDelta.CHANGED:
if ((delta.getFlags() & (TRIGGER_RECALC | IResourceDelta.DESCRIPTION)) != 0) {
fFileExtensions.remove(name);
@@ -211,16 +213,16 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
}
break;
}
- fCurrentExtensions= exts;
+ fCurrentExtensions = exts;
return VISIT_CHILDREN;
}
-
+
// file or folder
switch (delta.getKind()) {
case IResourceDelta.ADDED:
add(res);
return SKIP_CHILDREN;
-
+
case IResourceDelta.CHANGED:
if ((delta.getFlags() & TRIGGER_RECALC) != 0) {
remove(res);
@@ -228,36 +230,35 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
return SKIP_CHILDREN;
}
return VISIT_CHILDREN;
-
+
case IResourceDelta.REMOVED:
-
+
remove(res);
return SKIP_CHILDREN;
}
return VISIT_CHILDREN;
}
-
/**
* Add a resource to the tree.
*/
private void add(IResource res) {
assert Thread.holdsLock(fLock);
-
+
if (res instanceof IFile) {
final String resName = res.getName();
- String linkedName= null;
+ String linkedName = null;
if (res.isLinked()) {
- URI uri= res.getLocationURI();
+ URI uri = res.getLocationURI();
if (uri != null) {
- linkedName= LocationAdapter.URI.extractName(uri);
+ linkedName = LocationAdapter.URI.extractName(uri);
if (linkedName.length() > 0 && fCurrentExtensions.isRelevant(linkedName)) {
if (linkedName.equals(resName)) {
createFileNode(res.getFullPath(), null);
} else {
createFileNode(res.getFullPath(), linkedName);
}
- }
+ }
}
} else if (fCurrentExtensions.isRelevant(resName)) {
createFileNode(res.getFullPath(), null);
@@ -270,7 +271,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
}
}
}
-
+
/**
* Add a resource tree by using a resource proxy visitor.
*/
@@ -279,8 +280,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
if (proxy.getType() == IResource.FILE) {
if (fCurrentExtensions.isRelevant(proxy.getName())) {
if (proxy.isLinked()) {
- IResource res= proxy.requestResource();
- if (res instanceof IFile) {
+ IResource res = proxy.requestResource();
+ if (res instanceof IFile) {
add(res);
}
return true;
@@ -291,17 +292,16 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
return true;
}
-
public void unrefNodeMap() {
synchronized (fLock) {
- fNodeMap= null;
+ fNodeMap = null;
}
}
public void simulateNodeMapCollection() {
synchronized (fLock) {
- fNodeMap= null;
- fNodeMapRef= new SoftReference<>(null);
+ fNodeMap = null;
+ fNodeMapRef = new SoftReference<>(null);
}
}
@@ -310,36 +310,36 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
*/
private void initializeProjects(IProject[] projects) {
assert Thread.holdsLock(fLock);
-
+
if (fNodeMap == null) {
if (fNodeMapRef != null) {
- fNodeMap= fNodeMapRef.get();
+ fNodeMap = fNodeMapRef.get();
}
if (fNodeMap == null) {
fFileExtensions.clear();
- fNodeMap= new HashMap<>();
- fNodeMapRef= new SoftReference<>(fNodeMap);
+ fNodeMap = new HashMap<>();
+ fNodeMapRef = new SoftReference<>(fNodeMap);
}
}
fUnrefJob.cancel();
- fUnrefJob.schedule(UNREF_DELAY);
+ fUnrefJob.schedule(UNREF_DELAY);
for (IProject project : projects) {
if (project.isOpen() && !fFileExtensions.containsKey(project.getName())) {
- Extensions ext= fDefaultExtensions;
+ Extensions ext = fDefaultExtensions;
try {
if (project.hasNature(CProjectNature.C_NATURE_ID)) {
- ext= fCDTProjectExtensions;
+ ext = fCDTProjectExtensions;
}
} catch (CoreException e) {
AutotoolsUIPlugin.log(e);
// treat as non-cdt project
}
- fCurrentExtensions= ext;
+ fCurrentExtensions = ext;
add(project);
fFileExtensions.put(project.getName(), ext);
- fCurrentExtensions= null;
+ fCurrentExtensions = null;
}
}
}
@@ -348,44 +348,44 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
* Initializes file-extensions and node map
*/
private void initFileExtensions() {
-
+
if (fDefaultExtensions == null) {
- HashSet<String> cdtContentTypes= new HashSet<>();
- String[] registeredContentTypes= CoreModel.getRegistedContentTypeIds();
+ HashSet<String> cdtContentTypes = new HashSet<>();
+ String[] registeredContentTypes = CoreModel.getRegistedContentTypeIds();
cdtContentTypes.addAll(Arrays.asList(registeredContentTypes));
- final IContentTypeManager ctm= Platform.getContentTypeManager();
- final IContentType[] ctts= ctm.getAllContentTypes();
- Set<String> result= new HashSet<>();
+ final IContentTypeManager ctm = Platform.getContentTypeManager();
+ final IContentType[] ctts = ctm.getAllContentTypes();
+ Set<String> result = new HashSet<>();
outer: for (IContentType ctt : ctts) {
- IContentType basedOn= ctt;
+ IContentType basedOn = ctt;
while (basedOn != null) {
- if (cdtContentTypes.contains(basedOn.getId()))
+ if (cdtContentTypes.contains(basedOn.getId()))
continue outer;
- basedOn= basedOn.getBaseType();
+ basedOn = basedOn.getBaseType();
}
// this is a non-cdt content type
addFileSpecs(ctt, result);
}
- fCDTProjectExtensions= new Extensions(result, true);
+ fCDTProjectExtensions = new Extensions(result, true);
- result= new HashSet<>();
+ result = new HashSet<>();
for (IContentType ctt : ctts) {
- IContentType basedOn= ctt;
+ IContentType basedOn = ctt;
while (basedOn != null) {
if (cdtContentTypes.contains(basedOn.getId())) {
addFileSpecs(ctt, result);
break;
}
- basedOn= basedOn.getBaseType();
+ basedOn = basedOn.getBaseType();
}
}
- fDefaultExtensions= new Extensions(result, false);
+ fDefaultExtensions = new Extensions(result, false);
}
}
private void addFileSpecs(IContentType ctt, Set<String> result) {
- String[] fspecs= ctt.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ String[] fspecs = ctt.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
for (String fspec : fspecs) {
result.add(fspec.toUpperCase());
}
@@ -395,8 +395,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
* Inserts a node for the given path.
*/
private void createFileNode(IPath fullPath, String fileLink) {
- final String[] segments= fullPath.segments();
- final boolean isFileLinkTarget= fileLink != null;
+ final String[] segments = fullPath.segments();
+ final boolean isFileLinkTarget = fileLink != null;
final char[][] charArraySegments = toCharArrayArray(segments, fileLink);
createNode(charArraySegments, charArraySegments.length, true, isFileLinkTarget);
}
@@ -405,13 +405,13 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
final int segmentLen = segments.length;
char[][] chsegs;
if (fileLink != null) {
- chsegs= new char[segmentLen+1][];
- chsegs[segmentLen]= fileLink.toCharArray();
+ chsegs = new char[segmentLen + 1][];
+ chsegs[segmentLen] = fileLink.toCharArray();
} else {
- chsegs= new char[segmentLen][];
+ chsegs = new char[segmentLen][];
}
for (int i = 0; i < segmentLen; i++) {
- chsegs[i]= segments[i].toCharArray();
+ chsegs[i] = segments[i].toCharArray();
}
return chsegs;
}
@@ -419,9 +419,10 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
/**
* Inserts a node for the given path.
*/
- private Node createNode(char[][] segments, int segmentCount, boolean hasFileLocationName, boolean isFileLinkTarget) {
+ private Node createNode(char[][] segments, int segmentCount, boolean hasFileLocationName,
+ boolean isFileLinkTarget) {
assert Thread.holdsLock(fLock);
-
+
if (segmentCount == 0)
return fRootNode;
@@ -429,56 +430,56 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
if (isNodeForSegments(fLastFolderNode, segments, segmentCount, isFileLinkTarget))
return fLastFolderNode;
}
-
- final char[] name= segments[segmentCount-1];
- final int hash= hashCode(name);
-
+
+ final char[] name = segments[segmentCount - 1];
+ final int hash = hashCode(name);
+
// search for existing node
- Object obj= fNodeMap.get(hash);
+ Object obj = fNodeMap.get(hash);
- Node[] nodes= null;
- int len= 0;
+ Node[] nodes = null;
+ int len = 0;
if (obj != null) {
if (obj instanceof Node) {
- Node node= (Node) obj;
+ Node node = (Node) obj;
if (isNodeForSegments(node, segments, segmentCount, isFileLinkTarget)) {
if (!hasFileLocationName)
- fLastFolderNode= node;
+ fLastFolderNode = node;
return node;
}
- nodes= new Node[]{node, null};
+ nodes = new Node[] { node, null };
fNodeMap.put(hash, nodes);
- len= 1;
+ len = 1;
} else {
- nodes= (Node[]) obj;
- for (len=0; len < nodes.length; len++) {
+ nodes = (Node[]) obj;
+ for (len = 0; len < nodes.length; len++) {
Node node = nodes[len];
- if (node == null)
+ if (node == null)
break;
if (isNodeForSegments(node, segments, segmentCount, isFileLinkTarget)) {
if (!hasFileLocationName)
- fLastFolderNode= node;
+ fLastFolderNode = node;
return node;
}
}
}
- }
- final Node parent= createNode(segments, segmentCount-1, false, false);
- Node node= new Node(parent, name, hasFileLocationName, isFileLinkTarget);
+ }
+ final Node parent = createNode(segments, segmentCount - 1, false, false);
+ Node node = new Node(parent, name, hasFileLocationName, isFileLinkTarget);
if (nodes == null) {
fNodeMap.put(hash, node);
- } else {
+ } else {
if (len == nodes.length) {
- Node[] newNodes= new Node[len+2];
+ Node[] newNodes = new Node[len + 2];
System.arraycopy(nodes, 0, newNodes, 0, len);
- nodes= newNodes;
+ nodes = newNodes;
fNodeMap.put(hash, nodes);
}
- nodes[len]= node;
+ nodes[len] = node;
}
-
+
if (!hasFileLocationName)
- fLastFolderNode= node;
+ fLastFolderNode = node;
return node;
}
@@ -487,60 +488,60 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
*/
private boolean isNodeForSegments(Node node, char[][] segments, int segmentLength, boolean isFileLinkTarget) {
assert Thread.holdsLock(fLock);
-
+
if (node.fIsFileLinkTarget != isFileLinkTarget)
return false;
-
- while(segmentLength > 0 && node != null) {
+
+ while (segmentLength > 0 && node != null) {
if (!CharArrayUtils.equals(segments[--segmentLength], node.fResourceName))
return false;
- node= node.fParent;
+ node = node.fParent;
}
return node == fRootNode;
}
-
+
/**
* Remove a resource from the tree
*/
private void remove(IResource res) {
assert Thread.holdsLock(fLock);
-
- final char[] name= res.getName().toCharArray();
- final int hash= hashCode(name);
-
- Object obj= fNodeMap.get(hash);
+
+ final char[] name = res.getName().toCharArray();
+ final int hash = hashCode(name);
+
+ Object obj = fNodeMap.get(hash);
if (obj == null)
return;
-
- final IPath fullPath= res.getFullPath();
- final int segmentCount= fullPath.segmentCount();
+
+ final IPath fullPath = res.getFullPath();
+ final int segmentCount = fullPath.segmentCount();
if (segmentCount == 0)
return;
-
- final char[][]segments= toCharArrayArray(fullPath.segments(), null);
+
+ final char[][] segments = toCharArrayArray(fullPath.segments(), null);
if (obj instanceof Node) {
- final Node node= (Node) obj;
+ final Node node = (Node) obj;
if (!node.fDeleted && isNodeForSegments(node, segments, segmentCount, false)) {
- node.fDeleted= true;
+ node.fDeleted = true;
if (node.fHasChildren)
- fNeedCleanup= true;
+ fNeedCleanup = true;
fNodeMap.remove(hash);
}
} else {
- final Node[] nodes= (Node[]) obj;
- for (int i= 0; i < nodes.length; i++) {
+ final Node[] nodes = (Node[]) obj;
+ for (int i = 0; i < nodes.length; i++) {
Node node = nodes[i];
if (node == null)
return;
if (!node.fDeleted && isNodeForSegments(node, segments, segmentCount, false)) {
remove(nodes, i);
- if (nodes[0] == null)
+ if (nodes[0] == null)
fNodeMap.remove(hash);
- node.fDeleted= true;
+ node.fDeleted = true;
if (node.fHasChildren)
- fNeedCleanup= true;
+ fNeedCleanup = true;
return;
}
@@ -549,65 +550,65 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
}
private void remove(Node[] nodes, int i) {
- int idx= lastValid(nodes, i);
- if (idx > 0) {
- nodes[i]= nodes[idx];
- nodes[idx]= null;
- }
+ int idx = lastValid(nodes, i);
+ if (idx > 0) {
+ nodes[i] = nodes[idx];
+ nodes[idx] = null;
+ }
}
private int lastValid(Node[] nodes, int left) {
- int right= nodes.length-1;
- while (left < right) {
- int mid= (left+right+1)/2; // ==> mid > left
- if (nodes[mid] == null)
- right= mid-1;
- else
- left= mid;
- }
+ int right = nodes.length - 1;
+ while (left < right) {
+ int mid = (left + right + 1) / 2; // ==> mid > left
+ if (nodes[mid] == null)
+ right = mid - 1;
+ else
+ left = mid;
+ }
return right;
}
private void cleanup() {
assert Thread.holdsLock(fLock);
- fLastFolderNode= null;
-
+ fLastFolderNode = null;
+
for (Iterator<Object> iterator = fNodeMap.values().iterator(); iterator.hasNext();) {
- Object obj= iterator.next();
+ Object obj = iterator.next();
if (obj instanceof Node) {
if (isDeleted((Node) obj)) {
iterator.remove();
}
} else {
- Node[] nodes= (Node[]) obj;
- int j= 0;
+ Node[] nodes = (Node[]) obj;
+ int j = 0;
for (int i = 0; i < nodes.length; i++) {
final Node node = nodes[i];
if (node == null) {
- if (j==0) {
+ if (j == 0) {
iterator.remove();
- }
+ }
break;
}
if (!isDeleted(node)) {
if (i != j) {
- nodes[j]= node;
- nodes[i]= null;
+ nodes[j] = node;
+ nodes[i] = null;
}
j++;
} else {
- nodes[i]= null;
+ nodes[i] = null;
}
}
}
}
}
-
+
private boolean isDeleted(Node node) {
- while(node != null) {
+ while (node != null) {
if (node.fDeleted)
return true;
- node= node.fParent;
+ node = node.fParent;
}
return false;
}
@@ -616,10 +617,10 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
* Computes a case insensitive hash-code for file names.
*/
private int hashCode(char[] name) {
- int h= 0;
+ int h = 0;
final int len = name.length;
for (int i = 0; i < len; i++) {
- h = 31*h + Character.toUpperCase(name[i]);
+ h = 31 * h + Character.toUpperCase(name[i]);
}
return h;
}
@@ -649,30 +650,30 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
*/
public <T> IFile[] findFilesForLocation(T location, LocationAdapter<T> adapter) {
initFileExtensions();
- String name= adapter.extractName(location);
- Node[] candidates= null;
+ String name = adapter.extractName(location);
+ Node[] candidates = null;
synchronized (fLock) {
initializeProjects(ResourcesPlugin.getWorkspace().getRoot().getProjects());
- Object obj= fNodeMap.get(hashCode(name.toCharArray()));
+ Object obj = fNodeMap.get(hashCode(name.toCharArray()));
if (obj != null) {
- candidates= convert(obj);
- IFile[] result= extractMatchesForLocation(candidates, location, adapter);
+ candidates = convert(obj);
+ IFile[] result = extractMatchesForLocation(candidates, location, adapter);
if (result.length > 0)
return result;
}
- }
-
+ }
+
// fall back to platform functionality
return adapter.platformsFindFilesForLocation(location);
}
private Node[] convert(Object obj) {
if (obj instanceof Node)
- return new Node[] {(Node) obj};
+ return new Node[] { (Node) obj };
- final Node[] nodes= (Node[]) obj;
- final int len= lastValid(nodes, -1)+1;
- final Node[] result= new Node[len];
+ final Node[] nodes = (Node[]) obj;
+ final int len = lastValid(nodes, -1) + 1;
+ final Node[] result = new Node[len];
System.arraycopy(nodes, 0, result, 0, len);
return result;
}
@@ -681,79 +682,79 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
* Returns an array of files for the given name. Search is limited to the supplied projects.
*/
public IFile[] findFilesByName(IPath relativeLocation, IProject[] projects, boolean ignoreCase) {
- final int segCount= relativeLocation.segmentCount();
+ final int segCount = relativeLocation.segmentCount();
if (segCount < 1)
return NO_FILES;
-
- final String name= relativeLocation.lastSegment();
+
+ final String name = relativeLocation.lastSegment();
Node[] candidates;
initFileExtensions();
synchronized (fLock) {
initializeProjects(projects);
- Object obj= fNodeMap.get(hashCode(name.toCharArray()));
+ Object obj = fNodeMap.get(hashCode(name.toCharArray()));
if (obj == null) {
return NO_FILES;
}
- candidates= convert(obj);
- }
- String suffix= relativeLocation.toString();
- while(suffix.startsWith("../")) { //$NON-NLS-1$
- suffix= suffix.substring(3);
+ candidates = convert(obj);
+ }
+ String suffix = relativeLocation.toString();
+ while (suffix.startsWith("../")) { //$NON-NLS-1$
+ suffix = suffix.substring(3);
}
- Set<String> prjset= new HashSet<>();
+ Set<String> prjset = new HashSet<>();
for (IProject prj : projects) {
prjset.add(prj.getName());
}
return extractMatchesForName(candidates, name, suffix, ignoreCase, prjset);
}
-
+
/**
* Selects the actual matches for the list of candidate nodes.
*/
- private IFile[] extractMatchesForName(Node[] candidates, String name, String suffix, boolean ignoreCase, Set<String> prjSet) {
- final char[] n1= name.toCharArray();
+ private IFile[] extractMatchesForName(Node[] candidates, String name, String suffix, boolean ignoreCase,
+ Set<String> prjSet) {
+ final char[] n1 = name.toCharArray();
final int namelen = n1.length;
- int resultIdx= 0;
-
+ int resultIdx = 0;
+
if (ignoreCase) {
for (int j = 0; j < namelen; j++) {
- n1[j]= Character.toUpperCase(n1[j]);
+ n1[j] = Character.toUpperCase(n1[j]);
}
}
- final int suffixLen= suffix.length();
- final IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- IFile[] result= null;
+ final int suffixLen = suffix.length();
+ final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IFile[] result = null;
outer: for (int i = 0; i < candidates.length; i++) {
final Node node = candidates[i];
if (node.fHasFileLocationName && checkProject(node, prjSet)) {
- final char[] n2= node.fResourceName;
+ final char[] n2 = node.fResourceName;
if (namelen == n2.length) {
for (int j = 0; j < n2.length; j++) {
- final char c= ignoreCase ? Character.toUpperCase(n2[j]) : n2[j];
- if (c != n1[j])
+ final char c = ignoreCase ? Character.toUpperCase(n2[j]) : n2[j];
+ if (c != n1[j])
continue outer;
}
- final IFile file= root.getFile(createPath(node));
- final URI loc= file.getLocationURI();
+ final IFile file = root.getFile(createPath(node));
+ final URI loc = file.getLocationURI();
if (loc != null) {
- String path= loc.getPath();
- final int len= path.length();
- if (len >= suffixLen &&
- suffix.regionMatches(ignoreCase, 0, path, len-suffixLen, suffixLen)) {
- if (result == null)
- result= new IFile[candidates.length-i];
- result[resultIdx++]= root.getFile(createPath(node));
- }
+ String path = loc.getPath();
+ final int len = path.length();
+ if (len >= suffixLen && suffix.regionMatches(ignoreCase, 0, path, len - suffixLen, suffixLen)) {
+ if (result == null)
+ result = new IFile[candidates.length - i];
+ result[resultIdx++] = root.getFile(createPath(node));
+ }
}
}
}
}
- if (result==null)
+ if (result == null)
return NO_FILES;
-
+
if (resultIdx < result.length) {
- IFile[] copy= new IFile[resultIdx];
+ IFile[] copy = new IFile[resultIdx];
System.arraycopy(result, 0, copy, 0, resultIdx);
return copy;
}
@@ -761,13 +762,13 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
}
private boolean checkProject(Node node, Set<String> prjSet) {
- while(true) {
- final Node n= node.fParent;
+ while (true) {
+ final Node n = node.fParent;
if (n == fRootNode)
break;
if (n == null)
return false;
- node= n;
+ node = n;
}
return prjSet.contains(new String(node.fResourceName));
}
@@ -781,47 +782,47 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
return createPath(node.fParent).append(new String(node.fResourceName));
}
-
+
/**
* Selects the actual matches from the list of candidates
*/
private <T> IFile[] extractMatchesForLocation(Node[] candidates, T location, LocationAdapter<T> adapter) {
- final IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- final String searchPath= adapter.getCanonicalPath(location);
- IFile[] result= null;
- int resultIdx= 0;
+ final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ final String searchPath = adapter.getCanonicalPath(location);
+ IFile[] result = null;
+ int resultIdx = 0;
for (int i = 0; i < candidates.length; i++) {
final Node node = candidates[i];
if (node.fHasFileLocationName) {
- final IFile file= root.getFile(createPath(node));
- final T loc= adapter.getLocation(file);
+ final IFile file = root.getFile(createPath(node));
+ final T loc = adapter.getLocation(file);
if (loc != null) {
if (!loc.equals(location)) {
- if (searchPath == null)
+ if (searchPath == null)
continue;
-
+
if (node.fCanonicHash != 0 && node.fCanonicHash != searchPath.hashCode())
continue;
-
- final String candPath= adapter.getCanonicalPath(loc);
+
+ final String candPath = adapter.getCanonicalPath(loc);
if (candPath == null)
continue;
-
- node.fCanonicHash= candPath.hashCode();
+
+ node.fCanonicHash = candPath.hashCode();
if (!candPath.equals(searchPath))
continue;
}
- if (result == null)
- result= new IFile[candidates.length-i];
- result[resultIdx++]= root.getFile(createPath(node));
+ if (result == null)
+ result = new IFile[candidates.length - i];
+ result[resultIdx++] = root.getFile(createPath(node));
}
}
}
- if (result==null)
+ if (result == null)
return NO_FILES;
-
+
if (resultIdx < result.length) {
- IFile[] copy= new IFile[resultIdx];
+ IFile[] copy = new IFile[resultIdx];
System.arraycopy(result, 0, copy, 0, resultIdx);
return copy;
}
@@ -830,10 +831,10 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
@SuppressWarnings("nls")
public void dump() {
- List<String> lines= new ArrayList<>();
+ List<String> lines = new ArrayList<>();
synchronized (fLock) {
for (Iterator<Object> iterator = fNodeMap.values().iterator(); iterator.hasNext();) {
- Node[] nodes= convert(iterator.next());
+ Node[] nodes = convert(iterator.next());
for (int i = 0; i < nodes.length; i++) {
final Node node = nodes[i];
if (node == null) {
@@ -856,7 +857,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
private String toString(Node node) {
if (node == fRootNode)
return "";
-
+
return toString(node.fParent) + "/" + new String(node.fResourceName);
}
}
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 98c87c08884..225294de002 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
@@ -17,51 +17,49 @@ package org.eclipse.cdt.internal.autotools.ui;
import java.io.IOException;
import java.io.Reader;
-
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++) {
- int ch= read();
+ int end = off + len;
+ for (int i = off; i < end; i++) {
+ int ch = read();
if (ch == -1) {
if (i == off) {
return -1;
}
return i - off;
}
- cbuf[i]= (char)ch;
+ cbuf[i] = (char) ch;
}
return len;
- }
-
+ }
+
/**
* @see Reader#ready()
- */
- @Override
+ */
+ @Override
public boolean ready() throws IOException {
return true;
}
-
+
/**
* Gets the content as a String
*/
public String getString() throws IOException {
- StringBuilder buf= new StringBuilder();
+ StringBuilder buf = new StringBuilder();
int ch;
- while ((ch= read()) != -1) {
- buf.append((char)ch);
+ while ((ch = read()) != -1) {
+ buf.append((char) ch);
}
return buf.toString();
}
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 e14ef2e72e9..7a42f82937e 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
@@ -14,120 +14,117 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui;
-
import java.io.IOException;
import java.io.Reader;
-
/**
* Reads the text contents from a reader and computes for each character
- * a potential substitution. The substitution may eat more characters than
+ * a potential substitution. The substitution may eat more characters than
* only the one passed into the computation routine.
*/
public abstract class SubstitutionTextReader extends SingleCharReader {
-
- protected static final String LINE_DELIM= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
+ protected static final String LINE_DELIM = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
private Reader fReader;
private boolean fWasWhiteSpace;
private int fCharAfterWhiteSpace;
-
+
private boolean fReadFromBuffer;
private StringBuilder fBuffer;
private int fIndex;
-
protected SubstitutionTextReader(Reader reader) {
- fReader= reader;
- fBuffer= new StringBuilder();
- fIndex= 0;
- fReadFromBuffer= false;
- fCharAfterWhiteSpace= -1;
- fWasWhiteSpace= true;
+ fReader = reader;
+ fBuffer = new StringBuilder();
+ fIndex = 0;
+ fReadFromBuffer = false;
+ fCharAfterWhiteSpace = -1;
+ fWasWhiteSpace = true;
}
-
+
/**
- * Implement to compute the substitution for the given character and
+ * Implement to compute the substitution for the given character and
* if necessary subsequent characters. Use <code>nextChar</code>
* to read subsequent characters.
*/
protected abstract String computeSubstitution(int c) throws IOException;
-
+
/**
* Returns the internal reader.
*/
protected Reader getReader() {
return fReader;
}
-
+
/**
* Returns the next character.
*/
protected int nextChar() throws IOException {
- fReadFromBuffer= (fBuffer.length() > 0);
+ fReadFromBuffer = (fBuffer.length() > 0);
if (fReadFromBuffer) {
- char ch= fBuffer.charAt(fIndex++);
+ char ch = fBuffer.charAt(fIndex++);
if (fIndex >= fBuffer.length()) {
fBuffer.setLength(0);
- fIndex= 0;
+ fIndex = 0;
}
return ch;
}
- int ch= fCharAfterWhiteSpace;
+ int ch = fCharAfterWhiteSpace;
if (ch == -1) {
- ch= fReader.read();
+ ch = fReader.read();
}
- if (Character.isWhitespace((char)ch)) {
+ if (Character.isWhitespace((char) ch)) {
do {
- ch= fReader.read();
- } while (Character.isWhitespace((char)ch));
+ ch = fReader.read();
+ } while (Character.isWhitespace((char) ch));
if (ch != -1) {
- fCharAfterWhiteSpace= ch;
+ fCharAfterWhiteSpace = ch;
return ' ';
}
} else {
- fCharAfterWhiteSpace= -1;
+ fCharAfterWhiteSpace = -1;
}
return ch;
}
-
+
@Override
public int read() throws IOException {
int c;
do {
-
- c= nextChar();
+
+ c = nextChar();
while (!fReadFromBuffer) {
- String s= computeSubstitution(c);
+ String s = computeSubstitution(c);
if (s == null)
break;
if (s.length() > 0)
fBuffer.insert(0, s);
- c= nextChar();
+ c = nextChar();
}
-
+
} while (fWasWhiteSpace && (c == ' '));
-
- fWasWhiteSpace= (c == ' ' || c == '\r' || c == '\n');
+
+ fWasWhiteSpace = (c == ' ' || c == '\r' || c == '\n');
return c;
}
-
- @Override
+
+ @Override
public boolean ready() throws IOException {
return fReader.ready();
}
-
+
@Override
public void close() throws IOException {
fReader.close();
}
-
+
@Override
public void reset() throws IOException {
fReader.reset();
- fWasWhiteSpace= true;
- fCharAfterWhiteSpace= -1;
+ fWasWhiteSpace = true;
+ fCharAfterWhiteSpace = -1;
fBuffer.setLength(0);
- fIndex= 0;
+ fIndex = 0;
}
}
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 52ad6b5294a..6cdec5f7c93 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
@@ -61,7 +61,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
public abstract class AbstractAutotoolsHandler extends AbstractHandler {
-
+
private IContainer fContainer;
protected abstract void run(Shell activeShell);
@@ -69,7 +69,7 @@ public abstract class AbstractAutotoolsHandler extends AbstractHandler {
protected Object execute1(ExecutionEvent event) {
ISelection k = HandlerUtil.getCurrentSelection(event);
if (!k.isEmpty() && k instanceof IStructuredSelection) {
- Object obj = ((IStructuredSelection)k).getFirstElement();
+ Object obj = ((IStructuredSelection) k).getFirstElement();
IContainer container = getContainer(obj);
if (container != null) {
setSelectedContainer(container);
@@ -84,32 +84,32 @@ public abstract class AbstractAutotoolsHandler extends AbstractHandler {
IContainer fContainer = null;
if (obj instanceof Collection) {
- Collection<Object> c = (Collection<Object>)obj;
+ Collection<Object> c = (Collection<Object>) obj;
Object[] objArray = c.toArray();
if (objArray.length > 0)
obj = objArray[0];
}
if (obj instanceof ICElement) {
- if ( obj instanceof ICContainer || obj instanceof ICProject) {
+ if (obj instanceof ICContainer || obj instanceof ICProject) {
fContainer = (IContainer) ((ICElement) obj).getUnderlyingResource();
} else {
- obj = ((ICElement)obj).getResource();
- if ( obj != null) {
- fContainer = ((IResource)obj).getParent();
+ obj = ((ICElement) obj).getResource();
+ if (obj != null) {
+ fContainer = ((IResource) obj).getParent();
}
}
} else if (obj instanceof IResource) {
if (obj instanceof IContainer) {
fContainer = (IContainer) obj;
} else {
- fContainer = ((IResource)obj).getParent();
+ fContainer = ((IResource) obj).getParent();
}
} else {
fContainer = null;
}
return fContainer;
}
-
+
public final String SHELL_COMMAND = "sh"; //$NON-NLS-1$
protected void showError(String title, String content) {
@@ -118,7 +118,7 @@ public abstract class AbstractAutotoolsHandler extends AbstractHandler {
/**
* Separate targets to array from a string.
- *
+ *
* @param rawArgList
* @return targets in string[] array. if targets are not formatted properly,
* returns null
@@ -261,7 +261,7 @@ public abstract class AbstractAutotoolsHandler extends AbstractHandler {
}
return cwd;
}
-
+
protected void executeConsoleCommand(final String actionName, final String command, final List<String> argumentList,
final IPath execDir) {
// We need to use a workspace root scheduling rule because adding
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 98353e63921..c9a38cfd3cd 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
@@ -47,8 +47,7 @@ public class AutomakeHandler extends AbstractAutotoolsHandler {
TwoInputDialog optionDialog = new TwoInputDialog(activeShell, cwd,
InvokeMessages.getString("InvokeAutomakeAction.windowTitle.options"), //$NON-NLS-1$
InvokeMessages.getString("InvokeAutomakeAction.message.options.otherOptions"), //$NON-NLS-1$
- InvokeMessages
- .getString("InvokeAutomakeAction.message.options.makeTargets"), //$NON-NLS-1$
+ InvokeMessages.getString("InvokeAutomakeAction.message.options.makeTargets"), //$NON-NLS-1$
DEFAULT_OPTION, null);
optionDialog.open();
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeMessages.java
index ebe4b2e7056..f1e8cd49e04 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeMessages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeMessages.java
@@ -20,8 +20,7 @@ import java.util.ResourceBundle;
public class InvokeMessages {
private static final String BUNDLE_NAME = InvokeMessages.class.getName();
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
private InvokeMessages() {
}
@@ -29,7 +28,7 @@ public class InvokeMessages {
/**
* Returns the string from the resource bundle,
* or 'key' if not found.
- *
+ *
* @param key the message key
* @return the resource bundle message
*/
@@ -40,17 +39,17 @@ public class InvokeMessages {
return '!' + key + '!';
}
}
-
+
/**
* Returns the formatted string from the resource bundle,
* or 'key' if not found.
- *
+ *
* @param key the message key
* @param args an array of substituition strings
* @return the resource bundle message
*/
public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getString(key), (Object[])args);
+ return MessageFormat.format(getString(key), (Object[]) args);
}
}
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 d7fedbb7ab0..edc47b4f791 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
@@ -24,12 +24,11 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
public class SingleInputDialog extends InputDialog {
-
+
private String firstMessage;
- public SingleInputDialog(Shell parentShell, String firstMessage, String dialogTitle,
- String dialogMessage, String initialValue,
- IInputValidator validator) {
+ public SingleInputDialog(Shell parentShell, String firstMessage, String dialogTitle, String dialogMessage,
+ String initialValue, IInputValidator validator) {
super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
this.firstMessage = firstMessage;
@@ -43,8 +42,7 @@ public class SingleInputDialog extends InputDialog {
CLabel label0 = new CLabel(composite, SWT.WRAP);
label0.setText(firstMessage);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL
- | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label0.setLayoutData(data);
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 00a216bdf21..659f5d90fa6 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
@@ -32,12 +32,11 @@ public class TwoInputDialog extends InputDialog {
private String secondValue;
private String secondMessage;
-
+
private String firstMessage;
- public TwoInputDialog(Shell parentShell, String firstMessage, String dialogTitle,
- String dialogMessage, String secondMessage, String initialValue,
- IInputValidator validator) {
+ public TwoInputDialog(Shell parentShell, String firstMessage, String dialogTitle, String dialogMessage,
+ String secondMessage, String initialValue, IInputValidator validator) {
super(parentShell, dialogTitle, dialogMessage, initialValue, validator);
this.firstMessage = firstMessage;
@@ -64,19 +63,16 @@ public class TwoInputDialog extends InputDialog {
label0.setText(firstMessage);
Label label = new Label(composite, SWT.WRAP);
label.setText(secondMessage);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL
- | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label0.setLayoutData(data);
label0.setFont(parent.getFont());
label.setLayoutData(data);
label.setFont(parent.getFont());
-
secondText = new Text(composite, SWT.SINGLE | SWT.BORDER);
- secondText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL));
+ secondText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
secondText.addModifyListener(e -> validateInput());
// remove error message dialog from focusing.
@@ -88,7 +84,7 @@ public class TwoInputDialog extends InputDialog {
/**
* Returns the text area.
- *
+ *
* @return the text area
*/
protected Text getSecondText() {
@@ -97,7 +93,7 @@ public class TwoInputDialog extends InputDialog {
/**
* Returns the string typed into this input dialog.
- *
+ *
* @return the input string
*/
public String getSecondValue() {
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/ContainsFilter.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/ContainsFilter.java
index fe7bc5ba156..9d2d57d4932 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/ContainsFilter.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/ContainsFilter.java
@@ -25,37 +25,35 @@ import org.eclipse.jface.viewers.ViewerFilter;
*/
public class ContainsFilter extends ViewerFilter {
- private String lookFor;
+ private String lookFor;
- public void setLookFor(String lookFor) {
- this.lookFor = lookFor;
- }
+ public void setLookFor(String lookFor) {
+ this.lookFor = lookFor;
+ }
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (!(viewer instanceof TreeViewer)) {
- return true;
- }
- TreeViewer treeViewer = (TreeViewer) viewer;
- String currentLabel = ((ILabelProvider) treeViewer.getLabelProvider())
- .getText(element);
- if (lookFor == null) {
- return true;
- }
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (!(viewer instanceof TreeViewer)) {
+ return true;
+ }
+ TreeViewer treeViewer = (TreeViewer) viewer;
+ String currentLabel = ((ILabelProvider) treeViewer.getLabelProvider()).getText(element);
+ if (lookFor == null) {
+ return true;
+ }
if (currentLabel != null && currentLabel.toLowerCase().contains(lookFor)) {
- return true;
- }
- return hasUnfilteredChild(treeViewer, element);
- }
+ return true;
+ }
+ return hasUnfilteredChild(treeViewer, element);
+ }
- private boolean hasUnfilteredChild(TreeViewer viewer, Object element) {
- Object[] children = ((ITreeContentProvider) viewer.getContentProvider())
- .getChildren(element);
- for (Object child :children) {
- if (select(viewer, element, child)) {
- return true;
- }
- }
- return false;
- }
+ private boolean hasUnfilteredChild(TreeViewer viewer, Object element) {
+ Object[] children = ((ITreeContentProvider) viewer.getContentProvider()).getChildren(element);
+ for (Object child : children) {
+ if (select(viewer, element, child)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/LexicalSortingAction.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/LexicalSortingAction.java
index cd340ff3b64..0ee2c64f9ad 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/LexicalSortingAction.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/LexicalSortingAction.java
@@ -22,27 +22,25 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerComparator;
+public class LexicalSortingAction extends Action {
+ private static final String ACTION_NAME = "LexicalSortingAction"; //$NON-NLS-1$
+ private static final String DIALOG_STORE_KEY = ACTION_NAME + ".sort"; //$NON-NLS-1$
-public class LexicalSortingAction extends Action {
-
- private static final String ACTION_NAME= "LexicalSortingAction"; //$NON-NLS-1$
- private static final String DIALOG_STORE_KEY= ACTION_NAME + ".sort"; //$NON-NLS-1$
-
private LexicalCSorter fSorter;
private TreeViewer fTreeViewer;
-
+
public LexicalSortingAction() {
super(CUIPlugin.getResourceString(ACTION_NAME + ".label")); //$NON-NLS-1$
-
+
setDescription(CUIPlugin.getResourceString(ACTION_NAME + ".description")); //$NON-NLS-1$
setToolTipText(CUIPlugin.getResourceString(ACTION_NAME + ".tooltip")); //$NON-NLS-1$
-
+
MakeUIImages.setImageDescriptors(this, MakeUIImages.T_TOOL, MakeUIImages.IMG_TOOLS_ALPHA_SORTING);
-
- fSorter= new LexicalCSorter();
+
+ fSorter = new LexicalCSorter();
}
-
+
public void setTreeViewer(TreeViewer treeViewer) {
fTreeViewer = treeViewer;
boolean checked = CUIPlugin.getDefault().getDialogSettings().getBoolean(DIALOG_STORE_KEY);
@@ -53,39 +51,46 @@ public class LexicalSortingAction extends Action {
public void run() {
valueChanged(isChecked(), true);
}
-
+
private void valueChanged(boolean on, boolean store) {
setChecked(on);
fTreeViewer.setComparator(on ? fSorter : null);
-
- String key= ACTION_NAME + ".tooltip" + (on ? ".on" : ".off"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ String key = ACTION_NAME + ".tooltip" + (on ? ".on" : ".off"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
setToolTipText(CUIPlugin.getResourceString(key));
-
+
if (store) {
CUIPlugin.getDefault().getDialogSettings().put(DIALOG_STORE_KEY, on);
}
}
-
+
private static class LexicalCSorter extends ViewerComparator {
@Override
public int category(Object obj) {
if (obj instanceof ICElement) {
- ICElement elem= (ICElement)obj;
+ ICElement elem = (ICElement) obj;
switch (elem.getElementType()) {
- case ICElement.C_MACRO: return 1;
- case ICElement.C_INCLUDE: return 2;
-
- case ICElement.C_CLASS: return 3;
- case ICElement.C_STRUCT: return 4;
- case ICElement.C_UNION: return 5;
-
- case ICElement.C_FIELD: return 6;
- case ICElement.C_FUNCTION: return 7;
+ case ICElement.C_MACRO:
+ return 1;
+ case ICElement.C_INCLUDE:
+ return 2;
+
+ case ICElement.C_CLASS:
+ return 3;
+ case ICElement.C_STRUCT:
+ return 4;
+ case ICElement.C_UNION:
+ return 5;
+
+ case ICElement.C_FIELD:
+ return 6;
+ case ICElement.C_FUNCTION:
+ return 7;
}
-
+
}
return 0;
}
}
-
+
}
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 177a48c9939..c78899c6d04 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
@@ -50,53 +50,51 @@ import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
import org.eclipse.jface.text.source.projection.ProjectionViewer;
import org.eclipse.ui.texteditor.IDocumentProvider;
-
/**
* ProjectionMakefileUpdater
*/
public class ProjectionFileUpdater implements IProjectionListener {
private static class AutoconfProjectionAnnotation extends ProjectionAnnotation {
-
+
private AutoconfElement fElement;
private boolean fIsComment;
-
+
public AutoconfProjectionAnnotation(AutoconfElement element, boolean isCollapsed, boolean isComment) {
super(isCollapsed);
fElement = element;
fIsComment = isComment;
}
-
+
public AutoconfElement getElement() {
return fElement;
}
-
+
public void setElement(AutoconfElement element) {
fElement = element;
}
-
+
public boolean isComment() {
return fIsComment;
}
-
+
}
-
public void install(AutoconfEditor editor, ProjectionViewer viewer) {
- fEditor= editor;
- fViewer= viewer;
+ fEditor = editor;
+ fViewer = viewer;
fViewer.addProjectionListener(this);
}
-
+
public void uninstall() {
if (isInstalled()) {
projectionDisabled();
fViewer.removeProjectionListener(this);
- fViewer= null;
- fEditor= null;
+ fViewer = null;
+ fEditor = null;
}
}
-
+
protected boolean isInstalled() {
return fEditor != null;
}
@@ -128,49 +126,49 @@ public class ProjectionFileUpdater implements IProjectionListener {
// we have to make sure that we disable first when getting an enable
// message.
projectionDisabled();
-
- initialize();
- fParticipant= new ReconcilerParticipant();
+
+ initialize();
+ fParticipant = new ReconcilerParticipant();
fEditor.addReconcilingParticipant(fParticipant);
}
-
+
@Override
public void projectionDisabled() {
- fCachedDocument= null;
+ fCachedDocument = null;
if (fParticipant != null) {
fEditor.addReconcilingParticipant(fParticipant);
- fParticipant= null;
+ fParticipant = null;
}
}
-
+
public void initialize() {
-
+
if (!isInstalled())
return;
-
+
initializePreferences();
-
+
try {
-
- IDocumentProvider provider= fEditor.getDocumentProvider();
- fCachedDocument= provider.getDocument(fEditor.getEditorInput());
- fAllowCollapsing= true;
-
-// IWorkingCopyManager manager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
- AutoconfElement fInput= fEditor.getRootElement();
-
+
+ IDocumentProvider provider = fEditor.getDocumentProvider();
+ fCachedDocument = provider.getDocument(fEditor.getEditorInput());
+ fAllowCollapsing = true;
+
+ // IWorkingCopyManager manager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ AutoconfElement fInput = fEditor.getRootElement();
+
if (fInput != null) {
ProjectionAnnotationModel model = fEditor.getAdapter(ProjectionAnnotationModel.class);
if (model != null) {
- Map<AutoconfProjectionAnnotation, Position> additions= computeAdditions(fInput);
+ Map<AutoconfProjectionAnnotation, Position> additions = computeAdditions(fInput);
model.removeAllAnnotations();
model.replaceAnnotations(null, additions);
}
}
-
+
} finally {
- fCachedDocument= null;
- fAllowCollapsing= false;
+ fCachedDocument = null;
+ fAllowCollapsing = false;
}
}
@@ -184,55 +182,52 @@ public class ProjectionFileUpdater implements IProjectionListener {
}
private Map<AutoconfProjectionAnnotation, Position> computeAdditions(AutoconfElement root) {
- Map<AutoconfProjectionAnnotation, Position> map= new HashMap<>();
+ Map<AutoconfProjectionAnnotation, Position> map = new HashMap<>();
if (root instanceof AutoconfRootElement)
computeAdditions(root.getChildren(), map);
return map;
}
private void computeAdditions(Object[] elements, Map<AutoconfProjectionAnnotation, Position> map) {
- for (int i= 0; i < elements.length; i++) {
- AutoconfElement element= (AutoconfElement)elements[i];
-
+ for (int i = 0; i < elements.length; i++) {
+ AutoconfElement element = (AutoconfElement) elements[i];
+
computeAdditions(element, map);
-
- if (element.hasChildren()) {
+
+ if (element.hasChildren()) {
computeAdditions(element.getChildren(), map);
}
}
}
private void computeAdditions(AutoconfElement element, Map<AutoconfProjectionAnnotation, Position> map) {
-
- boolean createProjection= false;
-
+
+ boolean createProjection = false;
+
@SuppressWarnings("unused")
- boolean collapse= false;
-
- if (element instanceof AutoconfIfElement ||
- element instanceof AutoconfElseElement ||
- element instanceof AutoconfElifElement) {
- collapse= fAllowCollapsing && fCollapseConditional;
- createProjection= true;
+ boolean collapse = false;
+
+ if (element instanceof AutoconfIfElement || element instanceof AutoconfElseElement
+ || element instanceof AutoconfElifElement) {
+ collapse = fAllowCollapsing && fCollapseConditional;
+ createProjection = true;
} else if (element instanceof AutoconfMacroElement) {
- collapse= fAllowCollapsing && fCollapseMacroDef;
- createProjection= true;
+ collapse = fAllowCollapsing && fCollapseMacroDef;
+ createProjection = true;
} else if (element instanceof AutoconfMacroArgumentElement) {
- collapse= fAllowCollapsing && fCollapseMacroDef;
- createProjection= true;
+ collapse = fAllowCollapsing && fCollapseMacroDef;
+ createProjection = true;
} else if (element instanceof AutoconfCaseElement) {
- collapse= fAllowCollapsing && fCollapseCase;
- createProjection= true;
- } else if (element instanceof AutoconfForElement ||
- element instanceof AutoconfWhileElement ||
- element instanceof AutoconfUntilElement ||
- element instanceof AutoconfSelectElement) {
+ collapse = fAllowCollapsing && fCollapseCase;
+ createProjection = true;
+ } else if (element instanceof AutoconfForElement || element instanceof AutoconfWhileElement
+ || element instanceof AutoconfUntilElement || element instanceof AutoconfSelectElement) {
collapse = fAllowCollapsing && fCollapseLoop;
createProjection = true;
}
-
+
if (createProjection) {
- Position position= createProjectionPosition(element);
+ Position position = createProjectionPosition(element);
if (position != null) {
map.put(new AutoconfProjectionAnnotation(element, fAllowCollapsing, true), position);
}
@@ -250,7 +245,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
endLine = fCachedDocument.getLineOfOffset(element.getEndOffset());
if (startLine != endLine) {
- offset= fCachedDocument.getLineOffset(startLine);
+ offset = fCachedDocument.getLineOffset(startLine);
int endOffset = fCachedDocument.getLineOffset(endLine) + fCachedDocument.getLineLength(endLine);
return new Position(offset, endOffset - offset);
}
@@ -264,40 +259,39 @@ public class ProjectionFileUpdater implements IProjectionListener {
public void processReconcile() {
if (!isInstalled())
return;
-
- ProjectionAnnotationModel model= fEditor.getAdapter(ProjectionAnnotationModel.class);
+
+ ProjectionAnnotationModel model = fEditor.getAdapter(ProjectionAnnotationModel.class);
if (model == null)
return;
-
+
try {
- IDocumentProvider provider= fEditor.getDocumentProvider();
- fCachedDocument= provider.getDocument(fEditor.getEditorInput());
- fAllowCollapsing= false;
-
- Map<AutoconfProjectionAnnotation, Position> additions= new HashMap<>();
- List<AutoconfProjectionAnnotation> deletions= new ArrayList<>();
+ IDocumentProvider provider = fEditor.getDocumentProvider();
+ fCachedDocument = provider.getDocument(fEditor.getEditorInput());
+ fAllowCollapsing = false;
+
+ Map<AutoconfProjectionAnnotation, Position> additions = new HashMap<>();
+ List<AutoconfProjectionAnnotation> deletions = new ArrayList<>();
List<AutoconfProjectionAnnotation> updates = new ArrayList<>();
-
- Map<AutoconfProjectionAnnotation, Position> updated= computeAdditions(fEditor.getRootElement());
-
- Map<AutoconfElement, List<AutoconfProjectionAnnotation>> previous= createAnnotationMap(model);
-
-
- Iterator<AutoconfProjectionAnnotation> e= updated.keySet().iterator();
+
+ Map<AutoconfProjectionAnnotation, Position> updated = computeAdditions(fEditor.getRootElement());
+
+ Map<AutoconfElement, List<AutoconfProjectionAnnotation>> previous = createAnnotationMap(model);
+
+ Iterator<AutoconfProjectionAnnotation> e = updated.keySet().iterator();
while (e.hasNext()) {
- AutoconfProjectionAnnotation annotation= e.next();
- AutoconfElement element= annotation.getElement();
- Position position= updated.get(annotation);
-
- List<AutoconfProjectionAnnotation> annotations= previous.get(element);
+ AutoconfProjectionAnnotation annotation = e.next();
+ AutoconfElement element = annotation.getElement();
+ Position position = updated.get(annotation);
+
+ List<AutoconfProjectionAnnotation> annotations = previous.get(element);
if (annotations == null) {
additions.put(annotation, position);
} else {
- Iterator<AutoconfProjectionAnnotation> x= annotations.iterator();
+ Iterator<AutoconfProjectionAnnotation> x = annotations.iterator();
while (x.hasNext()) {
- AutoconfProjectionAnnotation a= x.next();
+ AutoconfProjectionAnnotation a = x.next();
if (annotation.isComment() == a.isComment()) {
- Position p= model.getPosition(a);
+ Position p = model.getPosition(a);
if (p != null && !position.equals(p)) {
p.setOffset(position.getOffset());
p.setLength(position.getLength());
@@ -307,108 +301,109 @@ public class ProjectionFileUpdater implements IProjectionListener {
break;
}
}
-
+
if (annotations.isEmpty())
previous.remove(element);
}
}
-
+
Iterator<List<AutoconfProjectionAnnotation>> e2 = previous.values().iterator();
while (e2.hasNext()) {
- List<AutoconfProjectionAnnotation> list= e2.next();
- int size= list.size();
- for (int i= 0; i < size; i++)
+ List<AutoconfProjectionAnnotation> list = e2.next();
+ int size = list.size();
+ for (int i = 0; i < size; i++)
deletions.add(list.get(i));
}
match(model, deletions, additions, updates);
- Annotation[] removals= new Annotation[deletions.size()];
+ Annotation[] removals = new Annotation[deletions.size()];
deletions.toArray(removals);
- Annotation[] changes= new Annotation[updates.size()];
+ Annotation[] changes = new Annotation[updates.size()];
updates.toArray(changes);
model.modifyAnnotations(removals, additions, changes);
-
+
} finally {
- fCachedDocument= null;
- fAllowCollapsing= true;
+ fCachedDocument = null;
+ fAllowCollapsing = true;
}
}
- private void match(ProjectionAnnotationModel model, List<AutoconfProjectionAnnotation> deletions, Map<AutoconfProjectionAnnotation, Position> additions, List<AutoconfProjectionAnnotation> changes) {
+ private void match(ProjectionAnnotationModel model, List<AutoconfProjectionAnnotation> deletions,
+ Map<AutoconfProjectionAnnotation, Position> additions, List<AutoconfProjectionAnnotation> changes) {
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty()))
return;
-
- List<AutoconfProjectionAnnotation> newDeletions= new ArrayList<>();
- List<AutoconfProjectionAnnotation> newChanges= new ArrayList<>();
-
- Iterator<AutoconfProjectionAnnotation> deletionIterator= deletions.iterator();
+
+ List<AutoconfProjectionAnnotation> newDeletions = new ArrayList<>();
+ List<AutoconfProjectionAnnotation> newChanges = new ArrayList<>();
+
+ Iterator<AutoconfProjectionAnnotation> deletionIterator = deletions.iterator();
outer: while (deletionIterator.hasNext()) {
- AutoconfProjectionAnnotation deleted= deletionIterator.next();
- Position deletedPosition= model.getPosition(deleted);
+ AutoconfProjectionAnnotation deleted = deletionIterator.next();
+ Position deletedPosition = model.getPosition(deleted);
if (deletedPosition == null)
continue;
-
- Iterator<AutoconfProjectionAnnotation> changesIterator= changes.iterator();
+
+ Iterator<AutoconfProjectionAnnotation> changesIterator = changes.iterator();
while (changesIterator.hasNext()) {
- AutoconfProjectionAnnotation changed= changesIterator.next();
+ AutoconfProjectionAnnotation changed = changesIterator.next();
if (deleted.isComment() == changed.isComment()) {
- Position changedPosition= model.getPosition(changed);
+ Position changedPosition = model.getPosition(changed);
if (changedPosition == null)
continue;
-
+
if (deletedPosition.getOffset() == changedPosition.getOffset()) {
-
+
deletedPosition.setLength(changedPosition.getLength());
deleted.setElement(changed.getElement());
-
+
deletionIterator.remove();
newChanges.add(deleted);
-
+
changesIterator.remove();
newDeletions.add(changed);
-
+
continue outer;
}
}
}
-
- Iterator<AutoconfProjectionAnnotation> additionsIterator= additions.keySet().iterator();
+
+ Iterator<AutoconfProjectionAnnotation> additionsIterator = additions.keySet().iterator();
while (additionsIterator.hasNext()) {
- AutoconfProjectionAnnotation added= additionsIterator.next();
+ AutoconfProjectionAnnotation added = additionsIterator.next();
if (deleted.isComment() == added.isComment()) {
- Position addedPosition= additions.get(added);
-
+ Position addedPosition = additions.get(added);
+
if (deletedPosition.getOffset() == addedPosition.getOffset()) {
-
+
deletedPosition.setLength(addedPosition.getLength());
deleted.setElement(added.getElement());
-
+
deletionIterator.remove();
newChanges.add(deleted);
-
+
additionsIterator.remove();
-
+
break;
}
}
}
}
-
+
deletions.addAll(newDeletions);
changes.addAll(newChanges);
}
private Map<AutoconfElement, List<AutoconfProjectionAnnotation>> createAnnotationMap(IAnnotationModel model) {
- Map<AutoconfElement, List<AutoconfProjectionAnnotation>> map= new HashMap<>();
+ Map<AutoconfElement, List<AutoconfProjectionAnnotation>> map = new HashMap<>();
Iterator<Annotation> e = model.getAnnotationIterator();
while (e.hasNext()) {
Annotation annotation = e.next();
if (annotation instanceof AutoconfProjectionAnnotation) {
- AutoconfProjectionAnnotation directive= (AutoconfProjectionAnnotation) annotation;
- List<AutoconfProjectionAnnotation> list= map.get(directive.getElement());
+ AutoconfProjectionAnnotation directive = (AutoconfProjectionAnnotation) annotation;
+ List<AutoconfProjectionAnnotation> 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 dff7caeecbe..a05cfb1475d 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
@@ -34,76 +34,81 @@ import org.eclipse.swt.widgets.Shell;
* A class to select one or more elements out of an indexed property
*/
public abstract class AbstractElementListSelectionDialog extends SelectionStatusDialog {
-
+
private ILabelProvider fRenderer;
private boolean fIgnoreCase;
private boolean fIsMultipleSelection;
-
+
private SelectionList fSelectionList;
private Label fMessage;
- private ISelectionValidator fValidator;
-
+ private ISelectionValidator fValidator;
+
private String fMessageText;
private String fEmptyListMessage;
private String fNothingSelectedMessage;
-
+
private StatusInfo fCurrStatus;
-
+
protected void access$superOpen() {
super.open();
}
+
@Override
protected void cancelPressed() {
setResult(null);
super.cancelPressed();
}
+
protected Point computeInitialSize() {
return new Point(convertWidthInCharsToPixels(60), convertHeightInCharsToPixels(18));
}
+
@Override
protected Control createDialogArea(Composite parent) {
- Composite contents= (Composite)super.createDialogArea(parent);
-
- fMessage= createMessage(contents);
-
- int flags= fIsMultipleSelection ? SWT.MULTI : SWT.SINGLE;
- fSelectionList= new SelectionList(contents, flags | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL,
- fRenderer, fIgnoreCase);
-
+ Composite contents = (Composite) super.createDialogArea(parent);
+
+ fMessage = createMessage(contents);
+
+ int flags = fIsMultipleSelection ? SWT.MULTI : SWT.SINGLE;
+ fSelectionList = new SelectionList(contents, flags | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, fRenderer,
+ fIgnoreCase);
+
fSelectionList.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
handleDoubleClick();
}
+
@Override
public void widgetSelected(SelectionEvent e) {
verifyCurrentSelection();
}
});
- GridData spec= new GridData();
- Point initialSize= computeInitialSize();
- spec.widthHint= initialSize.x;
- spec.heightHint= initialSize.y;
- spec.grabExcessVerticalSpace= true;
- spec.grabExcessHorizontalSpace= true;
- spec.horizontalAlignment= GridData.FILL;
- spec.verticalAlignment= GridData.FILL;
+ GridData spec = new GridData();
+ Point initialSize = computeInitialSize();
+ spec.widthHint = initialSize.x;
+ spec.heightHint = initialSize.y;
+ spec.grabExcessVerticalSpace = true;
+ spec.grabExcessHorizontalSpace = true;
+ spec.horizontalAlignment = GridData.FILL;
+ spec.verticalAlignment = GridData.FILL;
fSelectionList.setLayoutData(spec);
-
+
return contents;
}
+
/**
* Creates the message text widget and sets layout data.
*/
protected Label createMessage(Composite parent) {
- Label text= new Label(parent, SWT.NULL);
+ Label text = new Label(parent, SWT.NULL);
text.setText(fMessageText);
- GridData spec= new GridData();
- spec.grabExcessVerticalSpace= false;
- spec.grabExcessHorizontalSpace= true;
- spec.horizontalAlignment= GridData.FILL;
- spec.verticalAlignment= GridData.BEGINNING;
+ GridData spec = new GridData();
+ spec.grabExcessVerticalSpace = false;
+ spec.grabExcessHorizontalSpace = true;
+ spec.horizontalAlignment = GridData.FILL;
+ spec.verticalAlignment = GridData.BEGINNING;
text.setLayoutData(spec);
return text;
}
@@ -111,27 +116,30 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
@Override
public void create() {
super.create();
- if (isEmptyList()) {
- fMessage.setEnabled(false);
- fSelectionList.setEnabled(false);
- } else {
- verifyCurrentSelection();
+ if (isEmptyList()) {
+ fMessage.setEnabled(false);
+ fSelectionList.setEnabled(false);
+ } else {
+ verifyCurrentSelection();
fSelectionList.selectFilterText();
fSelectionList.setFocus();
- }
+ }
}
+
/**
* Returns the currently used filter text.
*/
protected String getFilter() {
return fSelectionList.getFilter();
}
+
/**
* Returns the selection indices.
*/
protected int[] getSelectionIndices() {
return fSelectionList.getSelectionIndices();
}
+
/**
* Returns the widget selection. Returns empty list when the widget is not
* usable.
@@ -139,13 +147,15 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
protected List<Object> getWidgetSelection() {
if (fSelectionList == null || fSelectionList.isDisposed())
return new ArrayList<>(0);
- return fSelectionList.getSelection();
+ return fSelectionList.getSelection();
}
+
/**
* An element as been selected in the list by double clicking on it.
* Emulate a OK button pressed to close the dialog.
- */
+ */
protected abstract void handleDoubleClick();
+
/**
* Checks whether the list of elements is empty or not.
*/
@@ -154,42 +164,48 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
return true;
return fSelectionList.isEmptyList();
}
+
/**
* Constructs a list selection dialog.
* @param renderer The label renderer used
* @param ignoreCase Decides if the match string ignores lower/upppr case
- * @param multipleSelection Allow multiple selection
+ * @param multipleSelection Allow multiple selection
*/
- protected AbstractElementListSelectionDialog(Shell parent, String title, Image image, ILabelProvider renderer, boolean ignoreCase, boolean multipleSelection) {
+ protected AbstractElementListSelectionDialog(Shell parent, String title, Image image, ILabelProvider renderer,
+ boolean ignoreCase, boolean multipleSelection) {
super(parent);
setTitle(title);
setImage(image);
- fRenderer= renderer;
- fIgnoreCase= ignoreCase;
- fIsMultipleSelection= multipleSelection;
-
- fMessageText= ""; //$NON-NLS-1$
-
- fCurrStatus= new StatusInfo();
-
- fValidator= null;
- fEmptyListMessage= ""; //$NON-NLS-1$
- fNothingSelectedMessage= ""; //$NON-NLS-1$
+ fRenderer = renderer;
+ fIgnoreCase = ignoreCase;
+ fIsMultipleSelection = multipleSelection;
+
+ fMessageText = ""; //$NON-NLS-1$
+
+ fCurrStatus = new StatusInfo();
+
+ fValidator = null;
+ fEmptyListMessage = ""; //$NON-NLS-1$
+ fNothingSelectedMessage = ""; //$NON-NLS-1$
}
+
/**
* Constructs a list selection dialog.
* @param renderer The label renderer used
* @param ignoreCase Decides if the match string ignores lower/upppr case
- * @param multipleSelection Allow multiple selection
+ * @param multipleSelection Allow multiple selection
*/
- protected AbstractElementListSelectionDialog(Shell parent, ILabelProvider renderer, boolean ignoreCase, boolean multipleSelection) {
+ protected AbstractElementListSelectionDialog(Shell parent, ILabelProvider renderer, boolean ignoreCase,
+ boolean multipleSelection) {
this(parent, "", null, renderer, ignoreCase, multipleSelection); //$NON-NLS-1$
}
+
@Override
public int open() {
BusyIndicator.showWhile(null, () -> access$superOpen());
- return getReturnCode() ;
+ return getReturnCode();
}
+
/**
* Refilters the current list according to the filter entered into the
* text edit field.
@@ -197,33 +213,38 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
protected void refilter() {
fSelectionList.filter(true);
}
+
/**
* If a empty-list message is set, a error message is shown
* Must be set before widget creation
*/
public void setEmptyListMessage(String message) {
- fEmptyListMessage= message;
+ fEmptyListMessage = message;
}
+
/**
* Sets the filter text to the given value.
*/
protected void setFilter(String text, boolean refilter) {
fSelectionList.setFilter(text, refilter);
}
+
/**
* 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;
+ fMessageText = message;
}
+
/**
* If the selection is empty, this message is shown
*/
public void setNothingSelectedMessage(String message) {
- fNothingSelectedMessage= message;
+ fNothingSelectedMessage = message;
}
+
/**
* Selects the elements in the list determined by the given
* selection indices.
@@ -231,6 +252,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
protected void setSelection(int[] selection) {
fSelectionList.setSelection(selection);
}
+
/**
* Initializes the selection list widget with the given list of
* elements.
@@ -238,20 +260,22 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
protected void setSelectionListElements(List<Object> elements, boolean refilter) {
fSelectionList.setElements(elements, refilter);
}
+
/**
* A validator can be set to check if the current selection
* is valid
*/
public void setValidator(ISelectionValidator validator) {
- fValidator= validator;
+ fValidator = validator;
}
+
/**
* Verifies the current selection and updates the status line
* accordingly.
*/
protected boolean verifyCurrentSelection() {
- List<Object> sel= getWidgetSelection();
- int length= sel.size();
+ List<Object> sel = getWidgetSelection();
+ int length = sel.size();
if (length > 0) {
if (fValidator != null) {
fValidator.isValid(sel.toArray(), fCurrStatus);
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 81d0fca8bb8..d828451beed 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
@@ -31,15 +31,15 @@ import org.eclipse.cdt.make.core.makefile.ITargetRule;
* statement : rule | macro_definition | comments | empty
* rule : inference_rule | target_rule
* inference_rule : target ':' <nl> ( <tab> command <nl> ) +
- * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
+ * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
[ ( command ) * ]
- * macro_definition : string '=' (string)*
+ * macro_definition : string '=' (string)*
* comments : ('#' (string) <nl>) *
* empty : <nl>
* command : <tab> prefix_command string <nl>
* target : string
* prefix_command : '-' | '@' | '+'
- * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
+ * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
*/
public abstract class AbstractMakefile extends Parent implements IMakefile {
@@ -59,7 +59,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
List<IRule> array = new ArrayList<>(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IRule) {
- array.add((IRule)stmts[i]);
+ array.add((IRule) stmts[i]);
}
}
return array.toArray(new IRule[0]);
@@ -83,7 +83,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
List<IInferenceRule> array = new ArrayList<>(rules.length);
for (int i = 0; i < rules.length; i++) {
if (rules[i] instanceof IInferenceRule) {
- array.add((IInferenceRule)rules[i]);
+ array.add((IInferenceRule) rules[i]);
}
}
return array.toArray(new IInferenceRule[0]);
@@ -107,7 +107,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
List<ITargetRule> array = new ArrayList<>(trules.length);
for (int i = 0; i < trules.length; i++) {
if (trules[i] instanceof ITargetRule) {
- array.add((ITargetRule)trules[i]);
+ array.add((ITargetRule) trules[i]);
}
}
return array.toArray(new ITargetRule[0]);
@@ -131,7 +131,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
List<IMacroDefinition> array = new ArrayList<>(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IMacroDefinition) {
- array.add((IMacroDefinition)stmts[i]);
+ array.add((IMacroDefinition) stmts[i]);
}
}
return array.toArray(new IMacroDefinition[0]);
@@ -155,7 +155,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
List<IMacroDefinition> array = new ArrayList<>(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IMacroDefinition) {
- array.add((IMacroDefinition)stmts[i]);
+ array.add((IMacroDefinition) stmts[i]);
}
}
return array.toArray(new IMacroDefinition[0]);
@@ -178,7 +178,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
List<IInferenceRule> array = new ArrayList<>(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IInferenceRule) {
- array.add((IInferenceRule)stmts[i]);
+ array.add((IInferenceRule) stmts[i]);
}
}
return array.toArray(new IInferenceRule[0]);
@@ -209,54 +209,29 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
StringBuilder macroName = new StringBuilder();
for (int i = 0; i < len; i++) {
char c = line.charAt(i);
- switch(c) {
- case '$':
- // '$$' --> '$'
- if (foundDollar) {
- buffer.append(c);
- foundDollar = false;
- } else {
- foundDollar = true;
- }
- break;
- case '(':
- case '{':
- if (foundDollar) {
- inMacro = true;
- } else {
- buffer.append(c);
- }
- break;
- case ')':
- case '}':
- if (inMacro) {
- String name = macroName.toString();
- if (name.length() > 0) {
- IMacroDefinition[] defs = getMacroDefinitions(name);
- if (defs.length == 0) {
- defs = getBuiltinMacroDefinitions(name);
- }
- if (defs.length > 0) {
- String result = defs[0].getValue().toString();
- if (result.indexOf('$') != -1 && recursive) {
- result = expandString(result, recursive);
- }
- buffer.append(result);
- } else { // Do not expand
- buffer.append('$').append('(').append(name).append(')');
- }
- }
- macroName.setLength(0);
- inMacro = false;
- } else {
- buffer.append(c);
- }
- break;
- default:
- if (inMacro) {
- macroName.append(c);
- } else if (foundDollar) {
- String name = String.valueOf(c);
+ switch (c) {
+ case '$':
+ // '$$' --> '$'
+ if (foundDollar) {
+ buffer.append(c);
+ foundDollar = false;
+ } else {
+ foundDollar = true;
+ }
+ break;
+ case '(':
+ case '{':
+ if (foundDollar) {
+ inMacro = true;
+ } else {
+ buffer.append(c);
+ }
+ break;
+ case ')':
+ case '}':
+ if (inMacro) {
+ String name = macroName.toString();
+ if (name.length() > 0) {
IMacroDefinition[] defs = getMacroDefinitions(name);
if (defs.length == 0) {
defs = getBuiltinMacroDefinitions(name);
@@ -267,44 +242,67 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
result = expandString(result, recursive);
}
buffer.append(result);
- } else {
- // nothing found
- buffer.append('$').append(c);
+ } else { // Do not expand
+ buffer.append('$').append('(').append(name).append(')');
}
- inMacro = false;
+ }
+ macroName.setLength(0);
+ inMacro = false;
+ } else {
+ buffer.append(c);
+ }
+ break;
+ default:
+ if (inMacro) {
+ macroName.append(c);
+ } else if (foundDollar) {
+ String name = String.valueOf(c);
+ IMacroDefinition[] defs = getMacroDefinitions(name);
+ if (defs.length == 0) {
+ defs = getBuiltinMacroDefinitions(name);
+ }
+ if (defs.length > 0) {
+ String result = defs[0].getValue().toString();
+ if (result.indexOf('$') != -1 && recursive) {
+ result = expandString(result, recursive);
+ }
+ buffer.append(result);
} else {
- buffer.append(c);
+ // nothing found
+ buffer.append('$').append(c);
}
- foundDollar = false;
- break;
+ inMacro = false;
+ } else {
+ buffer.append(c);
+ }
+ foundDollar = false;
+ break;
}
}
return buffer.toString();
}
-
+
@Override
public URI getFileURI() {
return filename;
}
-
+
public void setFileURI(URI filename) {
- this.filename = filename;
- }
-
+ this.filename = filename;
+ }
@Override
public IMakefile getMakefile() {
return this;
}
-
+
@Override
public IMakefileReaderProvider getMakefileReaderProvider() {
return null;
}
-
+
@Override
- public void parse(URI fileURI,
- IMakefileReaderProvider makefileReaderProvider) throws IOException {
+ 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 b6ec594e158..8d3d062c79f 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
@@ -32,17 +32,16 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
-
/**
* AbstractMakefileEditorScanner
*/
public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner {
- private Map<String, Token> fTokenMap= new HashMap<>();
+ private Map<String, Token> fTokenMap = new HashMap<>();
private String[] fPropertyNamesColor;
/**
* Preference keys for boolean preferences which are <code>true</code>,
- * iff the corresponding token should be rendered bold.
+ * iff the corresponding token should be rendered bold.
*/
private String[] fPropertyNamesBold;
/**
@@ -50,42 +49,41 @@ public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner {
* iff the corresponding token should be rendered italic.
*/
private String[] fPropertyNamesItalic;
-
- /**
+ /**
* Returns the list of preference keys which define the tokens
* used in the rules of this scanner.
*/
abstract protected String[] getTokenProperties();
-
+
/**
* Creates the list of rules controlling this scanner.
*/
abstract protected List<IRule> createRules();
-
+
/**
* Must be called after the constructor has been called.
*/
public final void initialize() {
-
- fPropertyNamesColor= getTokenProperties();
- int length= fPropertyNamesColor.length;
- fPropertyNamesBold= new String[length];
- fPropertyNamesItalic= new String[length];
-
- for (int i= 0; i < length; i++) {
- fPropertyNamesBold[i]= fPropertyNamesColor[i] + MakefileEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
- fPropertyNamesItalic[i]= fPropertyNamesColor[i] + MakefileEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
+
+ fPropertyNamesColor = getTokenProperties();
+ int length = fPropertyNamesColor.length;
+ fPropertyNamesBold = new String[length];
+ fPropertyNamesItalic = new String[length];
+
+ for (int i = 0; i < length; i++) {
+ fPropertyNamesBold[i] = fPropertyNamesColor[i] + MakefileEditorPreferenceConstants.EDITOR_BOLD_SUFFIX;
+ fPropertyNamesItalic[i] = fPropertyNamesColor[i] + MakefileEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX;
addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]);
}
-
+
initializeRules();
}
private void initializeRules() {
- List<IRule> rules= createRules();
+ List<IRule> rules = createRules();
if (rules != null) {
- IRule[] result= new IRule[rules.size()];
+ IRule[] result = new IRule[rules.size()];
rules.toArray(result);
setRules(result);
}
@@ -101,23 +99,24 @@ public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner {
private int indexOf(String property) {
if (property != null) {
- int length= fPropertyNamesColor.length;
- for (int i= 0; i < length; i++) {
- if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i]) || property.equals(fPropertyNamesItalic[i]))
+ int length = fPropertyNamesColor.length;
+ for (int i = 0; i < length; i++) {
+ if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i])
+ || property.equals(fPropertyNamesItalic[i]))
return i;
}
}
return -1;
}
-
+
public boolean affectsBehavior(PropertyChangeEvent event) {
return indexOf(event.getProperty()) >= 0;
}
-
+
public void adaptToPreferenceChange(PropertyChangeEvent event) {
- String p= event.getProperty();
- int index= indexOf(p);
- Token token= getToken(fPropertyNamesColor[index]);
+ String p = event.getProperty();
+ int index = indexOf(p);
+ Token token = getToken(fPropertyNamesColor[index]);
if (fPropertyNamesColor[index].equals(p))
adaptToColorChange(event, token);
else if (fPropertyNamesBold[index].equals(p))
@@ -127,49 +126,51 @@ public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner {
}
protected void adaptToColorChange(PropertyChangeEvent event, Token token) {
- RGB rgb= null;
- Object value= event.getNewValue();
+ RGB rgb = null;
+ Object value = event.getNewValue();
if (value instanceof RGB) {
- rgb= (RGB) value;
+ rgb = (RGB) value;
} else if (value instanceof String) {
- rgb= StringConverter.asRGB((String) value);
+ rgb = StringConverter.asRGB((String) value);
}
-
+
if (rgb != null) {
- TextAttribute attr= (TextAttribute) token.getData();
- token.setData(new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
+ TextAttribute attr = (TextAttribute) token.getData();
+ token.setData(
+ new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
}
}
protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) {
- if (token == null) {
+ if (token == null) {
return;
}
- boolean eventValue= false;
- Object value= event.getNewValue();
+ boolean eventValue = false;
+ Object value = event.getNewValue();
if (value instanceof Boolean) {
- eventValue= ((Boolean) value).booleanValue();
+ eventValue = ((Boolean) value).booleanValue();
} else if (IPreferenceStore.TRUE.equals(value)) {
- eventValue= true;
+ eventValue = true;
}
-
- TextAttribute attr= (TextAttribute) token.getData();
- boolean activeValue= (attr.getStyle() & styleAttribute) == styleAttribute;
- if (activeValue != eventValue) {
- token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(), eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
+
+ TextAttribute attr = (TextAttribute) token.getData();
+ boolean activeValue = (attr.getStyle() & styleAttribute) == styleAttribute;
+ if (activeValue != eventValue) {
+ token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(),
+ eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute));
}
}
protected TextAttribute createTextAttribute(String colorID, String boldKey, String italicKey) {
- Color color= null;
+ Color color = null;
if (colorID != null) {
- color= AutomakeEditorFactory.getPreferenceColor(colorID);
+ color = AutomakeEditorFactory.getPreferenceColor(colorID);
}
- IPreferenceStore store= AutotoolsPlugin.getDefault().getPreferenceStore();
- int style= store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
+ IPreferenceStore store = AutotoolsPlugin.getDefault().getPreferenceStore();
+ int style = store.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
if (store.getBoolean(italicKey)) {
style |= SWT.ITALIC;
- }
+ }
return new TextAttribute(color, null, style);
}
}
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 4beecf83c57..3fb85aef5be 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
@@ -23,7 +23,7 @@ public class AutoconfSubstRule implements IPredicateRule {
private IToken token;
private char[][] fLineDelimiters;
private char[][] fSortedLineDelimiters;
-
+
private static class DecreasingCharArrayLengthComparator implements Comparator<Object> {
@Override
public int compare(Object o1, Object o2) {
@@ -31,32 +31,32 @@ public class AutoconfSubstRule implements IPredicateRule {
}
}
- private Comparator<Object> fLineDelimiterComparator= new DecreasingCharArrayLengthComparator();
+ private Comparator<Object> fLineDelimiterComparator = new DecreasingCharArrayLengthComparator();
public AutoconfSubstRule(IToken token) {
this.token = token;
}
-
+
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
- char[][] originalDelimiters= scanner.getLegalLineDelimiters();
- int count= originalDelimiters.length;
+ char[][] originalDelimiters = scanner.getLegalLineDelimiters();
+ int count = originalDelimiters.length;
if (fLineDelimiters == null || originalDelimiters.length != count) {
- fSortedLineDelimiters= new char[count][];
+ fSortedLineDelimiters = new char[count][];
} else {
- while (count > 0 && fLineDelimiters[count-1] == originalDelimiters[count-1])
+ while (count > 0 && fLineDelimiters[count - 1] == originalDelimiters[count - 1])
count--;
}
if (count != 0) {
- fLineDelimiters= originalDelimiters;
+ fLineDelimiters = originalDelimiters;
System.arraycopy(fLineDelimiters, 0, fSortedLineDelimiters, 0, fLineDelimiters.length);
Arrays.sort(fSortedLineDelimiters, fLineDelimiterComparator);
}
-
+
int c;
boolean okToScan = resume;
int charCount = 0;
-
+
if (!resume) {
// Not resuming. Verify first char is '@'.
c = scanner.read();
@@ -65,7 +65,7 @@ public class AutoconfSubstRule implements IPredicateRule {
okToScan = true;
}
}
-
+
if (okToScan) {
// We want to make sure we have a valid id (not @@) or (@_@). When
// we resume, we have no choice but to assume it is valid so far.
@@ -75,21 +75,19 @@ public class AutoconfSubstRule implements IPredicateRule {
if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') {
// A valid id has some alphabetic character in it.
isId = true;
- }
- else if (c >= '0' && c <= '9' || c == '_') {
+ } else if (c >= '0' && c <= '9' || c == '_') {
; // continue
- }
- else if (c == '@' && isId)
+ } else if (c == '@' && isId)
return getSuccessToken();
else
break;
++charCount;
}
}
-
+
for (int i = 0; i < charCount; ++i)
scanner.unread();
-
+
return Token.UNDEFINED;
}
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 ace622556ca..309ac934967 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
@@ -1,7 +1,7 @@
/*******************************************************************************
* Mostly copied from makefileCompletionProcessor which has the following
* copyright notice:
- *
+ *
* Copyright (c) 2000, 2015 QNX Software Systems and others.
*
* This program and the accompanying materials
@@ -38,185 +38,177 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorPart;
-
public class AutomakeCompletionProcessor implements IContentAssistProcessor {
- /**
- * Simple content assist tip closer. The tip is valid in a range
- * of 5 characters around its popup location.
- */
- protected static class Validator implements IContextInformationValidator, IContextInformationPresenter {
-
- protected int fInstallOffset;
+ /**
+ * Simple content assist tip closer. The tip is valid in a range
+ * of 5 characters around its popup location.
+ */
+ protected static class Validator implements IContextInformationValidator, IContextInformationPresenter {
- @Override
- public boolean isContextInformationValid(int offset) {
- return Math.abs(fInstallOffset - offset) < 5;
- }
-
- @Override
- public void install(IContextInformation info, ITextViewer viewer, int offset) {
- fInstallOffset = offset;
- }
+ protected int fInstallOffset;
- @Override
- public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
- return false;
- }
+ @Override
+ public boolean isContextInformationValid(int offset) {
+ return Math.abs(fInstallOffset - offset) < 5;
}
- public static class DirectiveComparator implements Comparator<Object> {
+ @Override
+ public void install(IContextInformation info, ITextViewer viewer, int offset) {
+ fInstallOffset = offset;
+ }
- @Override
- public int compare(Object o1, Object o2) {
- String name1;
- String name2;
+ @Override
+ public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
+ return false;
+ }
+ }
- if (o1 instanceof IMacroDefinition) {
- name1 = ((IMacroDefinition)o1).getName();
- } else if (o1 instanceof IRule) {
- name1 = ((IRule)o1).getTarget().toString();
- } else {
- name1 =""; //$NON-NLS-1$
- }
+ public static class DirectiveComparator implements Comparator<Object> {
- if (o2 instanceof IMacroDefinition) {
- name2 = ((IMacroDefinition)o1).getName();
- } else if (o2 instanceof IRule) {
- name2 = ((IRule)o1).getTarget().toString();
- } else {
- name2 =""; //$NON-NLS-1$
- }
+ @Override
+ public int compare(Object o1, Object o2) {
+ String name1;
+ String name2;
+
+ if (o1 instanceof IMacroDefinition) {
+ name1 = ((IMacroDefinition) o1).getName();
+ } else if (o1 instanceof IRule) {
+ name1 = ((IRule) o1).getTarget().toString();
+ } else {
+ name1 = ""; //$NON-NLS-1$
+ }
- //return String.CASE_INSENSITIVE_ORDER.compare(name1, name2);
- return name1.compareToIgnoreCase(name2);
+ if (o2 instanceof IMacroDefinition) {
+ name2 = ((IMacroDefinition) o1).getName();
+ } else if (o2 instanceof IRule) {
+ name2 = ((IRule) o1).getTarget().toString();
+ } else {
+ name2 = ""; //$NON-NLS-1$
}
-
- }
- protected IContextInformationValidator fValidator = new Validator();
- protected Image imageMacro = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_MACRO);
- protected Image imageTarget = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE);
- protected CompletionProposalComparator comparator = new CompletionProposalComparator();
- protected IEditorPart fEditor;
- protected IWorkingCopyManager fManager;
+ //return String.CASE_INSENSITIVE_ORDER.compare(name1, name2);
+ return name1.compareToIgnoreCase(name2);
+ }
- public AutomakeCompletionProcessor(IEditorPart editor) {
- fEditor = editor;
- fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ }
+
+ protected IContextInformationValidator fValidator = new Validator();
+ protected Image imageMacro = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_MACRO);
+ protected Image imageTarget = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE);
+
+ protected CompletionProposalComparator comparator = new CompletionProposalComparator();
+ protected IEditorPart fEditor;
+ protected IWorkingCopyManager fManager;
+
+ public AutomakeCompletionProcessor(IEditorPart editor) {
+ fEditor = editor;
+ fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ }
+
+ @Override
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
+ WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
+ boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
+ IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
+ IDirective[] statements = null;
+ if (macro) {
+ IDirective[] m1 = makefile.getMacroDefinitions();
+ IDirective[] m2 = makefile.getBuiltinMacroDefinitions();
+ statements = new IDirective[m1.length + m2.length];
+ System.arraycopy(m1, 0, statements, 0, m1.length);
+ System.arraycopy(m2, 0, statements, m1.length, m2.length);
+ } else {
+ statements = makefile.getTargetRules();
}
- @Override
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
- WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
- boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
- IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
- IDirective[] statements = null;
- if (macro) {
- IDirective[] m1 = makefile.getMacroDefinitions();
- IDirective[] m2 = makefile.getBuiltinMacroDefinitions();
- statements = new IDirective[m1.length + m2.length];
- System.arraycopy(m1, 0, statements, 0, m1.length);
- System.arraycopy(m2, 0, statements, m1.length, m2.length);
- } else {
- statements = makefile.getTargetRules();
+ ArrayList<ICompletionProposal> proposalList = new ArrayList<>(statements.length);
+
+ // iterate over all the different categories
+ for (int i = 0; i < statements.length; i++) {
+ String name = null;
+ Image image = null;
+ String infoString = "";//getContentInfoString(name); //$NON-NLS-1$
+ if (statements[i] instanceof IMacroDefinition) {
+ name = ((IMacroDefinition) statements[i]).getName();
+ image = imageMacro;
+ infoString = ((IMacroDefinition) statements[i]).getValue().toString();
+ } else if (statements[i] instanceof IRule) {
+ name = ((IRule) statements[i]).getTarget().toString();
+ image = imageTarget;
+ infoString = name;
}
-
- ArrayList<ICompletionProposal> proposalList = new ArrayList<>(statements.length);
-
- // iterate over all the different categories
- for (int i = 0; i < statements.length; i++) {
- String name = null;
- Image image = null;
- String infoString = "";//getContentInfoString(name); //$NON-NLS-1$
- if (statements[i] instanceof IMacroDefinition) {
- name = ((IMacroDefinition) statements[i]).getName();
- image = imageMacro;
- infoString = ((IMacroDefinition)statements[i]).getValue().toString();
- } else if (statements[i] instanceof IRule) {
- name = ((IRule) statements[i]).getTarget().toString();
- image = imageTarget;
- infoString = name;
- }
- if (name != null && name.startsWith(wordPart.toString())) {
- IContextInformation info = new ContextInformation(name, infoString);
- String displayString = (name.equals(infoString) ? name : name + " - " + infoString); //$NON-NLS-1$
- ICompletionProposal result =
- new CompletionProposal(
- name,
- wordPart.getOffset(),
- wordPart.toString().length(),
- name.length(),
- image,
- displayString,
- info,
- infoString);
- proposalList.add(result);
- }
+ if (name != null && name.startsWith(wordPart.toString())) {
+ IContextInformation info = new ContextInformation(name, infoString);
+ String displayString = (name.equals(infoString) ? name : name + " - " + infoString); //$NON-NLS-1$
+ ICompletionProposal result = new CompletionProposal(name, wordPart.getOffset(),
+ wordPart.toString().length(), name.length(), image, displayString, info, infoString);
+ proposalList.add(result);
}
- ICompletionProposal[] proposals = proposalList.toArray(new ICompletionProposal[0]);
- Arrays.sort(proposals, comparator);
- return proposals;
}
-
- @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<String> contextList = new ArrayList<>();
- if (macro) {
+ ICompletionProposal[] proposals = proposalList.toArray(new ICompletionProposal[0]);
+ Arrays.sort(proposals, comparator);
+ return proposals;
+ }
+
+ @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<String> contextList = new ArrayList<>();
+ if (macro) {
IMacroDefinition[] statements = makefile.getMacroDefinitions();
- for (int i = 0; i < statements.length; i++) {
+ for (int i = 0; i < statements.length; i++) {
String name = statements[i].getName();
if (name != null && name.equals(wordPart.toString())) {
String value = statements[i].getValue().toString();
if (value != null && value.length() > 0) {
contextList.add(value);
- }
- }
+ }
}
- statements = makefile.getBuiltinMacroDefinitions();
- for (int i = 0; i < statements.length; i++) {
- if (statements[i] != null) {
- String name = statements[i].getName();
- if (name != null && name.equals(wordPart.toString())) {
- String value = statements[i].getValue().toString();
- if (value != null && value.length() > 0) {
- contextList.add(value);
- }
+ }
+ statements = makefile.getBuiltinMacroDefinitions();
+ for (int i = 0; i < statements.length; i++) {
+ if (statements[i] != null) {
+ String name = statements[i].getName();
+ if (name != null && name.equals(wordPart.toString())) {
+ String value = statements[i].getValue().toString();
+ if (value != null && value.length() > 0) {
+ contextList.add(value);
}
}
}
}
-
- IContextInformation[] result = new IContextInformation[contextList.size()];
- for (int i = 0; i < result.length; i++) {
- String context = contextList.get(i);
- result[i] = new ContextInformation(imageMacro, wordPart.toString(), context);
- }
- return result;
-
}
- @Override
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
+ IContextInformation[] result = new IContextInformation[contextList.size()];
+ for (int i = 0; i < result.length; i++) {
+ String context = contextList.get(i);
+ result[i] = new ContextInformation(imageMacro, wordPart.toString(), context);
}
+ return result;
- @Override
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
+ }
- @Override
- public String getErrorMessage() {
- return null;
- }
+ @Override
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return null;
+ }
+
+ @Override
+ public char[] getContextInformationAutoActivationCharacters() {
+ return null;
+ }
+
+ @Override
+ public String getErrorMessage() {
+ return null;
+ }
+
+ @Override
+ public IContextInformationValidator getContextInformationValidator() {
+ return fValidator;
+ }
- @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 eddb710b8b2..939265c2fa7 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
@@ -14,20 +14,18 @@
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
-
public class AutomakeConfigMacro extends Directive {
String name;
-
+
public AutomakeConfigMacro(Directive parent, String name) {
super(parent);
this.name = name;
}
-
+
public String getName() {
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 cc50453cce4..1b693072f5a 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
@@ -26,48 +26,47 @@ import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IURIEditorInput;
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
+public class AutomakeDocumentProvider extends TextFileDocumentProvider implements IMakefileDocumentProvider {
-public class AutomakeDocumentProvider extends TextFileDocumentProvider implements IMakefileDocumentProvider {
-
/**
* Remembers a IMakefile for each element.
*/
- protected class AutomakefileFileInfo extends FileInfo {
+ protected class AutomakefileFileInfo extends FileInfo {
public IMakefile fCopy;
}
-
+
@Override
protected FileInfo createEmptyFileInfo() {
return new AutomakefileFileInfo();
}
-
+
@Override
protected FileInfo createFileInfo(Object element) throws CoreException {
IMakefile original = null;
- if (element instanceof IFileEditorInput) {
- IFileEditorInput input= (IFileEditorInput) element;
+ if (element instanceof IFileEditorInput) {
+ IFileEditorInput input = (IFileEditorInput) element;
if (input.getFile().exists())
- original= createMakefile(input.getFile().getLocation().toOSString());
+ original = createMakefile(input.getFile().getLocation().toOSString());
} else if (element instanceof IURIEditorInput) {
- IURIEditorInput input = (IURIEditorInput)element;
+ IURIEditorInput input = (IURIEditorInput) element;
original = createMakefile(input.getURI().getPath().toString());
}
if (original == null)
return null;
- FileInfo info= super.createFileInfo(element);
+ FileInfo info = super.createFileInfo(element);
if (!(info instanceof AutomakefileFileInfo)) {
return null;
}
- AutomakefileFileInfo makefileInfo= (AutomakefileFileInfo) info;
+ AutomakefileFileInfo makefileInfo = (AutomakefileFileInfo) info;
setUpSynchronization(makefileInfo);
makefileInfo.fCopy = original;
return makefileInfo;
}
-
+
/**
*/
private IMakefile createMakefile(String fileName) {
@@ -80,37 +79,37 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
makefile = automakefile;
return makefile;
}
-
+
@Override
public IMakefile getWorkingCopy(Object element) {
- FileInfo fileInfo= getFileInfo(element);
+ FileInfo fileInfo = getFileInfo(element);
if (fileInfo instanceof AutomakefileFileInfo) {
return ((AutomakefileFileInfo) fileInfo).fCopy;
}
return null;
}
-
+
@Override
public void shutdown() {
Iterator<?> e = getConnectedElementsIterator();
while (e.hasNext())
disconnect(e.next());
}
-
+
@Override
public void connect(Object element) throws CoreException {
super.connect(element);
IMakefile makefile = getWorkingCopy(element);
- AutomakeErrorHandler errorHandler = new AutomakeErrorHandler((IEditorInput)element);
+ AutomakeErrorHandler errorHandler = new AutomakeErrorHandler((IEditorInput) element);
errorHandler.update(makefile);
}
-
+
@Override
public IDocument getDocument(Object element) {
- FileInfo info= 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 7b83ba7dfdd..c7d28d925a3 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
@@ -28,32 +28,31 @@ import org.eclipse.ui.texteditor.ChainedPreferenceStore;
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
public class AutomakeEditor extends MakefileEditor {
-
+
protected AutomakefileContentOutlinePage ampage;
private AutomakefileSourceConfiguration sourceViewerConfiguration;
private static AutomakeEditor fgInstance;
private IEditorInput input;
-
+
static {
fgInstance = new AutomakeEditor();
}
-
- public AutomakeEditor() {
- super();
- }
-
- /**
- * Returns the default editor instance.
- *
- * @return the default editor instance
- */
- public static AutomakeEditor getDefault() {
- return fgInstance;
- }
-
- @Override
+
+ public AutomakeEditor() {
+ super();
+ }
+
+ /**
+ * Returns the default editor instance.
+ *
+ * @return the default editor instance
+ */
+ public static AutomakeEditor getDefault() {
+ return fgInstance;
+ }
+
+ @Override
protected void doSetInput(IEditorInput newInput) throws CoreException {
super.doSetInput(newInput);
this.input = newInput;
@@ -79,11 +78,11 @@ public class AutomakeEditor extends MakefileEditor {
configureInsertMode(SMART_INSERT, false);
setInsertMode(INSERT);
}
-
+
public AutomakeDocumentProvider getAutomakefileDocumentProvider() {
return AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
}
-
+
public AutomakefileContentOutlinePage getAutomakeOutlinePage() {
if (ampage == null) {
ampage = new AutomakefileContentOutlinePage(this);
@@ -92,7 +91,7 @@ public class AutomakeEditor extends MakefileEditor {
}
return ampage;
}
-
+
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Class<T> key) {
@@ -101,17 +100,17 @@ public class AutomakeEditor extends MakefileEditor {
}
return super.getAdapter(key);
}
-
+
public AutomakefileSourceConfiguration getAutomakeSourceViewerConfiguration() {
return sourceViewerConfiguration;
}
-
+
public IMakefile getMakefile() {
return getAutomakefileDocumentProvider().getWorkingCopy(this.getEditorInput());
}
-
+
public ISourceViewer getAutomakeSourceViewer() {
return getSourceViewer();
}
-
+
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditorFactory.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditorFactory.java
index be4d8cf6928..0423492ba71 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditorFactory.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditorFactory.java
@@ -19,7 +19,6 @@ import org.eclipse.cdt.make.ui.IWorkingCopyManager;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.Color;
-
public class AutomakeEditorFactory {
private IWorkingCopyManager workingCopyManager;
private AutomakeDocumentProvider automakeFileDocumentProvider;
@@ -31,18 +30,18 @@ public class AutomakeEditorFactory {
private AutomakeEditorFactory() {
factory = this;
}
-
+
public synchronized AutomakeDocumentProvider getAutomakefileDocumentProvider() {
if (automakeFileDocumentProvider == null) {
- automakeFileDocumentProvider= new AutomakeDocumentProvider();
+ automakeFileDocumentProvider = new AutomakeDocumentProvider();
}
return automakeFileDocumentProvider;
}
public synchronized IWorkingCopyManager getWorkingCopyManager() {
if (workingCopyManager == null) {
- IMakefileDocumentProvider provider= getAutomakefileDocumentProvider();
- workingCopyManager= new WorkingCopyManager(provider);
+ IMakefileDocumentProvider provider = getAutomakefileDocumentProvider();
+ workingCopyManager = new WorkingCopyManager(provider);
}
return workingCopyManager;
}
@@ -52,7 +51,8 @@ public class AutomakeEditorFactory {
*/
public static Color getPreferenceColor(String key) {
//FIXME: what do we do with Makefile editor preferences?
- return ColorManager.getDefault().getColor(PreferenceConverter.getColor(AutotoolsPlugin.getDefault().getPreferenceStore(), key));
+ return ColorManager.getDefault()
+ .getColor(PreferenceConverter.getColor(AutotoolsPlugin.getDefault().getPreferenceStore(), key));
}
public static AutomakeEditorFactory getDefault() {
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 ff9fbaa1ac9..621f4d882be 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
@@ -26,18 +26,16 @@ import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationModel;
import org.eclipse.ui.IEditorInput;
-
public class AutomakeErrorHandler {
- public static final String AUTOMAKE_ERROR_MARKER_ID = AutotoolsUIPlugin.PLUGIN_ID
- + ".parsefileerror";
-
+ public static final String AUTOMAKE_ERROR_MARKER_ID = AutotoolsUIPlugin.PLUGIN_ID + ".parsefileerror";
+
private IDocument document;
private AnnotationModel fAnnotationModel;
public static final String CDT_ANNOTATION_INFO = "org.eclipse.cdt.ui.info";
public static final String CDT_ANNOTATION_WARNING = "org.eclipse.cdt.ui.warning";
public static final String CDT_ANNOTATION_ERROR = "org.eclipse.cdt.ui.error";
-
+
// TODO: no quickfixes yet implemented, but maybe in the future
private static class AutomakeAnnotation extends Annotation implements IQuickFixableAnnotation {
public AutomakeAnnotation(String annotationType, boolean persist, String message) {
@@ -60,45 +58,44 @@ public class AutomakeErrorHandler {
}
}
-
+
public AutomakeErrorHandler(IEditorInput input) {
this.document = AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider().getDocument(input);
- this.fAnnotationModel = (AnnotationModel)AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider().getAnnotationModel(input);
+ this.fAnnotationModel = (AnnotationModel) AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider()
+ .getAnnotationModel(input);
}
-
public void update(IMakefile makefile) {
removeExistingMarkers();
// Recursively process all the directives in the Makefile
checkChildren(makefile);
}
-
+
private void checkChildren(IParent parent) {
IDirective[] directives = parent.getDirectives();
for (int i = 0; i < directives.length; i++) {
IDirective directive = directives[i];
if (directive instanceof IParent) {
- checkChildren((IParent)directive);
+ checkChildren((IParent) directive);
} else if (directive instanceof BadDirective) {
int lineNumber = directive.getStartLine();
Integer charStart = getCharOffset(lineNumber - 1, 0);
Integer charEnd = getCharOffset(directive.getEndLine() - 1, -1);
-
+
String annotationType = CDT_ANNOTATION_ERROR;
Annotation annotation = new AutomakeAnnotation(annotationType, true, "Bad directive"); //$NON-NLS-1$
- Position p = new Position(charStart.intValue(),charEnd.intValue() - charStart.intValue());
+ Position p = new Position(charStart.intValue(), charEnd.intValue() - charStart.intValue());
fAnnotationModel.addAnnotation(annotation, p);
}
}
return;
}
-
+
public void removeExistingMarkers() {
fAnnotationModel.removeAllAnnotations();
}
-
-
+
private Integer getCharOffset(int lineNumber, int columnNumber) {
try {
if (columnNumber >= 0)
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 83315b4732c..9ddfd34919f 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
@@ -17,20 +17,25 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake;
public class AutomakeIfElse extends Parent {
String condition;
String type;
+
public AutomakeIfElse(Directive parent, String type, String condition) {
super(parent);
this.type = type;
this.condition = condition;
}
+
public String getCondition() {
return condition;
}
+
public void setCondition(String condition) {
this.condition = condition;
}
+
public String getType() {
return type;
}
+
public void setType(String type) {
this.type = 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 38bb3374e99..f70a7eafb52 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
@@ -31,7 +31,7 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
private IToken token;
private StringBuilder buffer = new StringBuilder();
protected IToken defaultToken;
-
+
public AutomakeMacroDefinitionRule(IToken token, IToken defaultToken) {
this.token = token;
this.defaultToken = defaultToken;
@@ -53,45 +53,45 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
for (c = scanner.read(); c != ICharacterScanner.EOF; c = scanner.read()) {
switch (state) {
- case INIT_STATE :
- if (c != '\n' && Character.isWhitespace((char) c)) {
- break;
- }
- if (isValidCharacter(c)) {
- state = VAR_STATE;
- } else {
- state = ERROR_STATE;
- }
- break;
- case VAR_STATE :
- if (isValidCharacter(c)) {
- break;
- }
- case END_VAR_STATE :
- if (Character.isWhitespace((char) c)) {
- state = END_VAR_STATE;
- } else if (c == ':' || c == '+') {
- state = EQUAL_STATE;
- } else if (c == '=') {
- state = FINISH_STATE;
- } else {
-// if (state == END_VAR_STATE) {
-// scanner.unread(); // Return back to the space
-// }
- state = ERROR_STATE;
- }
- break;
- case EQUAL_STATE :
- if (c == '=') {
- state = FINISH_STATE;
- } else {
- state = ERROR_STATE;
- }
+ case INIT_STATE:
+ if (c != '\n' && Character.isWhitespace((char) c)) {
break;
- case FINISH_STATE :
- break;
- default :
+ }
+ if (isValidCharacter(c)) {
+ state = VAR_STATE;
+ } else {
+ state = ERROR_STATE;
+ }
+ break;
+ case VAR_STATE:
+ if (isValidCharacter(c)) {
break;
+ }
+ case END_VAR_STATE:
+ if (Character.isWhitespace((char) c)) {
+ state = END_VAR_STATE;
+ } else if (c == ':' || c == '+') {
+ state = EQUAL_STATE;
+ } else if (c == '=') {
+ state = FINISH_STATE;
+ } else {
+ // if (state == END_VAR_STATE) {
+ // scanner.unread(); // Return back to the space
+ // }
+ state = ERROR_STATE;
+ }
+ break;
+ case EQUAL_STATE:
+ if (c == '=') {
+ state = FINISH_STATE;
+ } else {
+ state = ERROR_STATE;
+ }
+ break;
+ case FINISH_STATE:
+ break;
+ default:
+ break;
}
if (state >= FINISH_STATE) {
break;
@@ -104,21 +104,21 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
return token;
}
- boolean debug = true;
- if (debug) {
-// System.out.println("This should be a 'c': " + peek(scanner));
-// System.out.println("This is what's in the **REST OF** the buffer:");
-// int count = 0;
-// for (int c = scanner.read(); c != ICharacterScanner.EOF; c = scanner.read()) {
-// System.out.println((char) c);
-// count++;
-// }
-// // Unread what we just displayed
-// for (int i = 0; i < count; i++) {
-// scanner.unread();
-// }
- }
-
+ boolean debug = true;
+ if (debug) {
+ // System.out.println("This should be a 'c': " + peek(scanner));
+ // System.out.println("This is what's in the **REST OF** the buffer:");
+ // int count = 0;
+ // for (int c = scanner.read(); c != ICharacterScanner.EOF; c = scanner.read()) {
+ // System.out.println((char) c);
+ // count++;
+ // }
+ // // Unread what we just displayed
+ // for (int i = 0; i < count; i++) {
+ // scanner.unread();
+ // }
+ }
+
if (defaultToken.isUndefined()) {
// If c is EOF, we've read it and broken out of the for loop above,
// but we need to unread it since it got read but not put into the
@@ -126,27 +126,27 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
if (state == ERROR_STATE || c == ICharacterScanner.EOF)
scanner.unread();
unreadBuffer(scanner);
- debug = true;
- if (debug) {
-// System.out.println("This should be an 'i': " + peek(scanner));
-// System.out.println("We've supposedly just unread the entire buffer. Here it is:");
-// int count = 0;
-// for (int c = scanner.read(); c != ICharacterScanner.EOF; c = scanner.read()) {
-// System.out.println((char) c);
-// count++;
-// }
-// // Unread what we just displayed
-// for (int i = 0; i < count + 1; i++) {
-// scanner.unread();
-// }
-// System.out.println("... just to be safe, here's the first character: " + peek(scanner));
- }
+ debug = true;
+ if (debug) {
+ // System.out.println("This should be an 'i': " + peek(scanner));
+ // System.out.println("We've supposedly just unread the entire buffer. Here it is:");
+ // int count = 0;
+ // for (int c = scanner.read(); c != ICharacterScanner.EOF; c = scanner.read()) {
+ // System.out.println((char) c);
+ // count++;
+ // }
+ // // Unread what we just displayed
+ // for (int i = 0; i < count + 1; i++) {
+ // scanner.unread();
+ // }
+ // System.out.println("... just to be safe, here's the first character: " + peek(scanner));
+ }
}
-
+
return Token.UNDEFINED;
}
-
+
public char peek(ICharacterScanner scanner) {
char c = (char) scanner.read();
scanner.unread();
@@ -182,7 +182,7 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
}
private void scanToBeginOfLine(ICharacterScanner scanner) {
- while(scanner.getColumn() != 0) {
+ while (scanner.getColumn() != 0) {
scanner.unread();
}
}
@@ -203,10 +203,11 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
return true;
}
+
protected boolean isValidCharacter(int c) {
char c0 = (char) c;
- return Character.isLetterOrDigit(c0) || (c0 == '_') || (c0 == '-') ||
- (c0 == '@') || (c0 == '+') || (c0 == '$') || (c0 == '(') || (c0 == ')');
+ return Character.isLetterOrDigit(c0) || (c0 == '_') || (c0 == '-') || (c0 == '@') || (c0 == '+') || (c0 == '$')
+ || (c0 == '(') || (c0 == ')');
}
}
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 e16968e2fba..53404ca0182 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
@@ -1,7 +1,7 @@
/*******************************************************************************
* Copyright (c) 2006, 2015, Red Hat, Inc.
* Based on MacroReferenceRule which has the following copyright notice
- *
+ *
* Copyright (c) 2000, 2006 QNX Software Systems and others.
*
* This program and the accompanying materials
@@ -25,19 +25,19 @@ public class AutomakeMacroReferenceRule extends PatternRule {
int nOfBrackets;
int fBracket;
-// public MacroReferenceRule(IToken token) {
-// super("$(", ")", token, (char) 0, true); //$NON-NLS-1$ //$NON-NLS-2$
-// }
+ // public MacroReferenceRule(IToken token) {
+ // super("$(", ")", token, (char) 0, true); //$NON-NLS-1$ //$NON-NLS-2$
+ // }
public AutomakeMacroReferenceRule(IToken token, String startSeq, String endSeq) {
- super(startSeq, endSeq, token, (char)0, true);
+ super(startSeq, endSeq, token, (char) 0, true);
if (endSeq.length() > 0 && endSeq.charAt(0) == '}') {
fBracket = '{';
} else {
fBracket = '(';
}
}
-
+
@Override
protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) {
nOfBrackets = 1;
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 63b0d70944e..24a0d3d0951 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
@@ -25,26 +25,25 @@ import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point;
-
public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
AutomakeEditor editor;
-
+
public AutomakeTextHover(AutomakeEditor editor) {
this.editor = editor;
}
-
+
@Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
TargetRule target = null;
String[] preReqs = null;
-
+
if (hoverRegion == null || hoverRegion.getLength() == 0)
return null;
Automakefile makefile = (Automakefile) editor.getMakefile();
if (makefile == null)
return null;
-
+
String hoverText;
int hoverLine;
try {
@@ -53,7 +52,7 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
} catch (BadLocationException e) {
return null;
}
-
+
// Automatic variables
if (hoverText.startsWith("$")) {
IDirective containingDirective = makefile.getDirectiveContainingLine(hoverLine);
@@ -71,8 +70,8 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
return preReqs[0];
break;
// FIXME: implement $* ?
-// case '*':
-// break;
+ // case '*':
+ // break;
case '?':
preReqs = target.getPrerequisites();
if (preReqs != null && preReqs.length > 0) {
@@ -85,12 +84,12 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
}
break;
case '%':
-// if (target instanceOf ArchiveTarget) {
-// return target.getMember();
-// } else {
-// error;
-// }
-// break;
+ // if (target instanceOf ArchiveTarget) {
+ // return target.getMember();
+ // } else {
+ // error;
+ // }
+ // break;
default:
break;
}
@@ -103,21 +102,20 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
return definition.getValue().toString();
}
}
-
+
return "";
}
@Override
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
-
+
if (textViewer != null) {
/*
* If the hover offset falls within the selection range return the
* region for the whole selection.
*/
Point selectedRange = textViewer.getSelectedRange();
- if (selectedRange.x >= 0 && selectedRange.y > 0
- && offset >= selectedRange.x
+ if (selectedRange.x >= 0 && selectedRange.y > 0 && offset >= selectedRange.x
&& offset <= selectedRange.x + selectedRange.y)
return new Region(selectedRange.x, selectedRange.y);
else {
@@ -137,8 +135,8 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
while (pos >= 0) {
c = document.getChar(pos);
- if (!Character.isJavaIdentifierPart(c) &&
- (c != '@') && (c != '<') && (c != '*') && (c != '?') && (c != '%'))
+ if (!Character.isJavaIdentifierPart(c) && (c != '@') && (c != '<') && (c != '*') && (c != '?')
+ && (c != '%'))
break;
--pos;
}
@@ -150,8 +148,8 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
while (pos < length) {
c = document.getChar(pos);
- if (!Character.isJavaIdentifierPart(c) &&
- (c != '@') && (c != '<') && (c != '*') && (c != '?') && (c != '%'))
+ if (!Character.isJavaIdentifierPart(c) && (c != '@') && (c != '<') && (c != '*') && (c != '?')
+ && (c != '%'))
break;
++pos;
}
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 a2b7324348a..9ee3ccbaf89 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
@@ -16,10 +16,10 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake;
import org.eclipse.jface.text.rules.IWordDetector;
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);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Automakefile.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Automakefile.java
index a193588947d..f1c07a306cf 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Automakefile.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Automakefile.java
@@ -37,7 +37,7 @@ public class Automakefile extends GNUAutomakefile {
}
return null;
}
-
+
public static void main(String[] args) {
try {
String filename = "Makefile.am"; //$NON-NLS-1$
@@ -56,5 +56,5 @@ public class Automakefile extends GNUAutomakefile {
System.out.println(e);
}
}
-
+
}
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 bec0ad5a83a..5c220704ded 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
@@ -31,35 +31,27 @@ import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.rules.WhitespaceRule;
import org.eclipse.jface.text.rules.WordRule;
-
public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner {
-
private final static String[] keywords = { "define", "endef", "ifdef", "ifndef", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "ifeq", "ifneq", "else", "endif", "include", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "-include", "sinclude", "override", "endef", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "export", "unexport", "vpath", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "if", "@if", "@endif" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "ifeq", "ifneq", "else", "endif", "include", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "-include", "sinclude", "override", "endef", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "export", "unexport", "vpath", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "if", "@if", "@endif" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private final static String[] functions = { "subst", "patsubst", "strip", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "findstring", "filter", "sort", "dir", "notdir", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "suffix", "basename", "addsuffix", "addprefix", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "join", "word", "words", "wordlist", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "firstword", "wildcard", "error", "warning", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "shell", "origin", "foreach", "call" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- };
-
- private final static String[] automaticVariables = { "$<" , "$*" , "$@" , "$?" , "$%"
+ "findstring", "filter", "sort", "dir", "notdir", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "suffix", "basename", "addsuffix", "addprefix", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "join", "word", "words", "wordlist", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "firstword", "wildcard", "error", "warning", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "shell", "origin", "foreach", "call" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
};
- static final String[] fTokenProperties = new String[] {
- ColorManager.MAKE_COMMENT_COLOR,
- ColorManager.MAKE_KEYWORD_COLOR,
- ColorManager.MAKE_FUNCTION_COLOR,
- ColorManager.MAKE_MACRO_REF_COLOR,
- ColorManager.MAKE_MACRO_DEF_COLOR,
- ColorManager.MAKE_DEFAULT_COLOR
- };
+ private final static String[] automaticVariables = { "$<", "$*", "$@", "$?", "$%" };
+
+ static final String[] fTokenProperties = new String[] { ColorManager.MAKE_COMMENT_COLOR,
+ ColorManager.MAKE_KEYWORD_COLOR, ColorManager.MAKE_FUNCTION_COLOR, ColorManager.MAKE_MACRO_REF_COLOR,
+ ColorManager.MAKE_MACRO_DEF_COLOR, ColorManager.MAKE_DEFAULT_COLOR };
/**
* Constructor for AutomakefileCodeScanner
@@ -68,7 +60,7 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner {
super();
initialize();
}
-
+
@Override
protected List<IRule> createRules() {
IToken keyword = getToken(ColorManager.MAKE_KEYWORD_COLOR);
@@ -85,14 +77,14 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner {
// Add generic whitespace rule.
rules.add(new WhitespaceRule(character -> Character.isWhitespace(character)));
-
+
// Put before the the word rules
MultiLineRule defineRule = new MultiLineRule("define", "endef", macroDef); //$NON-NLS-1$ //$NON-NLS-2$
defineRule.setColumnConstraint(0);
rules.add(defineRule);
-
+
rules.add(new AutomakeMacroDefinitionRule(macroDef, Token.UNDEFINED));
-
+
// @AC_SUBST_VAR@
IPredicateRule substVarRule = new AutoconfSubstRule(macroRef);
rules.add(substVarRule);
@@ -106,28 +98,27 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner {
keyWordRule.setColumnConstraint(0);
rules.add(keyWordRule);
-
WordRule functionRule = new WordRule(new MakefileWordDetector(), Token.UNDEFINED);
for (int i = 0; i < functions.length; i++)
functionRule.addWord(functions[i], function);
rules.add(functionRule);
-
+
WordRule automaticVarRule = new WordRule(new AutomakeWordDetector(), Token.UNDEFINED);
for (int i = 0; i < automaticVariables.length; i++)
automaticVarRule.addWord(automaticVariables[i], keyword);
rules.add(automaticVarRule);
-// rules.add(new SingleLineRule("$(", ")", macroRef)); //$NON-NLS-1$ //$NON-NLS-2$
-// rules.add(new SingleLineRule("${", "}", macroRef)); //$NON-NLS-1$ //$NON-NLS-2$
+ // rules.add(new SingleLineRule("$(", ")", macroRef)); //$NON-NLS-1$ //$NON-NLS-2$
+ // rules.add(new SingleLineRule("${", "}", macroRef)); //$NON-NLS-1$ //$NON-NLS-2$
rules.add(new AutomakeMacroReferenceRule(macroRef, "$(", ")")); //$NON-NLS-1$ //$NON-NLS-2$
rules.add(new AutomakeMacroReferenceRule(macroRef, "${", "}")); //$NON-NLS-1$ //$NON-NLS-2$
// Add word rule for identifier.
rules.add(new AutoconfIdentifierRule(other));
-
+
// Make sure we don't treat "\#" as comment start.
rules.add(new SingleLineRule("\\#", null, Token.UNDEFINED));
-
+
rules.add(new WhitespaceRule(new AutoconfWhitespaceDetector()));
setDefaultReturnToken(other);
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 f7263bfd856..5e86a02d75d 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
@@ -46,9 +46,8 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-
public class AutomakefileContentOutlinePage extends ContentOutlinePage {
-
+
protected IMakefile makefile;
protected IMakefile nullMakefile = new NullMakefile();
private LexicalSortingAction sortAction;
@@ -78,7 +77,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
if (element instanceof IMakefile) {
return fInput;
} else if (element instanceof IDirective) {
- return ((IDirective)element).getParent();
+ return ((IDirective) element).getParent();
}
return fInput;
}
@@ -103,12 +102,12 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
if (inputElement == fInput) {
directives = makefile.getDirectives();
} else if (inputElement instanceof IRule) {
- directives = ((IRule)inputElement).getCommands();
+ directives = ((IRule) inputElement).getCommands();
} else if (inputElement instanceof IParent) {
if (inputElement instanceof IInclude && !showIncludeChildren) {
directives = new IDirective[0];
} else {
- directives = ((IParent)inputElement).getDirectives();
+ directives = ((IParent) inputElement).getDirectives();
}
} else {
directives = new IDirective[0];
@@ -124,9 +123,8 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
} else if (showTargetRule && directives[i] instanceof AutomakeIfElse) {
list.add(directives[i]);
} else {
- boolean irrelevant = (directives[i] instanceof IComment ||
- directives[i] instanceof IEmptyLine ||
- directives[i] instanceof ITerminal);
+ boolean irrelevant = (directives[i] instanceof IComment || directives[i] instanceof IEmptyLine
+ || directives[i] instanceof ITerminal);
if (!irrelevant) {
list.add(directives[i]);
}
@@ -146,7 +144,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
}
if (newInput != null) {
- IWorkingCopyManager manager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ IWorkingCopyManager manager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
makefile = manager.getWorkingCopy((IEditorInput) newInput);
if (makefile == null) {
makefile = nullMakefile;
@@ -196,7 +194,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
} else
name = "else";
} else if (element instanceof AutomakeConfigMacro) {
- AutomakeConfigMacro macro = (AutomakeConfigMacro)element;
+ AutomakeConfigMacro macro = (AutomakeConfigMacro) element;
name = macro.getName();
} else {
name = super.getText(element);
@@ -211,15 +209,15 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
}
}
-
+
protected AutomakeEditor fEditor;
protected Object fInput;
-
+
public AutomakefileContentOutlinePage(AutomakeEditor editor) {
super();
fEditor = editor;
}
-
+
/**
* Sets the input of the outline page
*/
@@ -227,7 +225,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
fInput = input;
update();
}
-
+
/**
* Updates the outline page.
*/
@@ -260,15 +258,15 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
}
sortAction.setTreeViewer(viewer);
}
-
+
public void inputChanged(Object oldInput, Object newInput) {
if (oldInput != null) {
makefile = nullMakefile;
}
if (newInput != null) {
- IWorkingCopyManager manager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
- makefile = manager.getWorkingCopy((IEditorInput)newInput);
+ IWorkingCopyManager manager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ makefile = manager.getWorkingCopy((IEditorInput) newInput);
if (makefile == 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 34d52b00846..a49bd721276 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
@@ -28,41 +28,39 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
-
public class AutomakefileReconcilingStrategy implements IReconcilingStrategy {
private int fLastRegionOffset;
- private ITextEditor fEditor;
+ private ITextEditor fEditor;
private IWorkingCopyManager fManager;
private IDocumentProvider fDocumentProvider;
private AutomakefileContentOutlinePage fOutliner;
private IReconcilingParticipant fMakefileReconcilingParticipant;
private AutomakeErrorHandler fErrorHandler;
private IEditorInput input;
-
+
public AutomakefileReconcilingStrategy(AutomakeEditor editor) {
- fOutliner= editor.getAutomakeOutlinePage();
+ fOutliner = editor.getAutomakeOutlinePage();
fLastRegionOffset = Integer.MAX_VALUE;
- fEditor= editor;
+ fEditor = editor;
input = fEditor.getEditorInput();
- fManager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
- fDocumentProvider= AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
- fErrorHandler= new AutomakeErrorHandler(input);
- fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor;
+ fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ fDocumentProvider = AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
+ fErrorHandler = new AutomakeErrorHandler(input);
+ fMakefileReconcilingParticipant = (IReconcilingParticipant) fEditor;
}
-
+
@Override
public void setDocument(IDocument document) {
- }
-
+ }
@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
- // multiple times with different regions of the file, we do a
+ // multiple times with different regions of the file, we do a
// complete parse on the first region.
- if(region.getOffset() <= fLastRegionOffset) {
+ if (region.getOffset() <= fLastRegionOffset) {
reconcile();
}
fLastRegionOffset = region.getOffset();
@@ -74,7 +72,7 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy {
// the contentoutline viewer.
//reconcile();
}
-
+
private void reconcile() {
try {
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
@@ -85,7 +83,7 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy {
makefile.parse(makefile.getFileURI(), reader);
} catch (IOException e) {
}
-
+
fOutliner.update();
fErrorHandler.update(makefile);
}
@@ -98,6 +96,6 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy {
//
}
}
- }
+ }
}
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 60f3d345e37..e2ae906082d 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
@@ -27,40 +27,38 @@ import org.eclipse.jface.text.reconciler.MonoReconciler;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.util.PropertyChangeEvent;
+public class AutomakefileSourceConfiguration extends MakefileSourceConfiguration {
-public class AutomakefileSourceConfiguration extends
- MakefileSourceConfiguration {
-
AutomakeEditor editor;
AutomakefileCodeScanner codeScanner;
AutomakeTextHover amHover;
-
+
/**
* Constructor for MakeConfiguration
*/
public AutomakefileSourceConfiguration(IPreferenceStore preferenceStore) {
super(preferenceStore, null);
}
-
+
public AutomakefileSourceConfiguration(IPreferenceStore preferenceStore, AutomakeEditor editor) {
super(preferenceStore, editor);
this.editor = editor;
}
-
+
public AutomakefileCodeScanner getAutomakeCodeScanner() {
if (null == codeScanner)
codeScanner = new AutomakefileCodeScanner();
return codeScanner;
}
-
+
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
if (amHover == null)
amHover = new AutomakeTextHover(editor);
return amHover;
}
-
+
/**
* @param event
*/
@@ -69,7 +67,7 @@ public class AutomakefileSourceConfiguration extends
AutomakefileCodeScanner scanner = getAutomakeCodeScanner();
scanner.adaptToPreferenceChange(event);
}
-
+
/**
* @param event
* @return
@@ -79,7 +77,7 @@ public class AutomakefileSourceConfiguration extends
AutomakefileCodeScanner scanner = getAutomakeCodeScanner();
return scanner.affectsBehavior(event);
}
-
+
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer v) {
@@ -89,23 +87,28 @@ public class AutomakefileSourceConfiguration extends
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (editor != null && editor.isEditable()) {
- MonoReconciler reconciler= new MonoReconciler(new AutomakefileReconcilingStrategy(editor), false);
+ MonoReconciler reconciler = new MonoReconciler(new AutomakefileReconcilingStrategy(editor), false);
reconciler.setDelay(1000);
reconciler.setProgressMonitor(new NullProgressMonitor());
return reconciler;
}
return null;
}
-
+
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
ContentAssistant assistant = new ContentAssistant();
assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), IDocument.DEFAULT_CONTENT_TYPE);
- assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION);
- assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), MakefilePartitionScanner.MAKEFILE_DEF_BLOCK_PARTITION);
- assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), MakefilePartitionScanner.MAKEFILE_IF_BLOCK_PARTITION);
- assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK_PARTITION);
- assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT_PARTITION);
+ assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor),
+ MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION);
+ assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor),
+ MakefilePartitionScanner.MAKEFILE_DEF_BLOCK_PARTITION);
+ assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor),
+ MakefilePartitionScanner.MAKEFILE_IF_BLOCK_PARTITION);
+ assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor),
+ MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK_PARTITION);
+ assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor),
+ MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT_PARTITION);
assistant.enableAutoActivation(true);
assistant.setAutoActivationDelay(500);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileUtil.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileUtil.java
index 9aae153caa4..ef95a8527d7 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileUtil.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileUtil.java
@@ -14,7 +14,6 @@
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class AutomakefileUtil {
// Look for Automake conditionals which optionally
@@ -22,7 +21,7 @@ public class AutomakefileUtil {
public static boolean isAutomakeCommand(String line) {
return line.matches("^@[a-z_A-Z0-9]+@\\t.*$"); //$NON-NLS-1$
}
-
+
public static boolean isIfBlock(String line) {
return line.startsWith("if"); //$NON-NLS-1$
}
@@ -30,7 +29,7 @@ public class AutomakefileUtil {
public static boolean isElseBlock(String line) {
return line.startsWith("else"); //$NON-NLS-1$
}
-
+
public static boolean isElseIfBlock(String line) {
return line.startsWith("else if"); //$NON-NLS-1$
}
@@ -38,7 +37,7 @@ public class AutomakefileUtil {
public static boolean isEndifBlock(String line) {
return line.startsWith("endif"); //$NON-NLS-1$
}
-
+
public static boolean isConfigMacro(String line) {
return line.matches("\\s*@[a-z_A-Z0-9]+@"); //$NON-NLS-1$
}
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 e94925d8365..f15a0dd7af9 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
@@ -20,7 +20,7 @@ import org.eclipse.cdt.make.core.makefile.ICommand;
/**
* Makefile : ( statement ) *
- * statement : command | ..
+ * statement : command | ..
* command : <tab> prefix_command string <nl>
* prefix_command : '-' | '@' | '+'
*/
@@ -84,7 +84,7 @@ public class Command extends Directive implements ICommand {
@Override
public String toString() {
StringBuilder cmd = new StringBuilder();
- cmd.append( '\t');
+ cmd.append('\t');
if (getPrefix() != 0) {
cmd.append(getPrefix());
}
@@ -103,7 +103,7 @@ public class Command extends Directive implements ICommand {
public int hashCode() {
return toString().hashCode();
}
-
+
char getPrefix() {
return prefix;
}
@@ -121,7 +121,7 @@ public class Command extends Directive implements ICommand {
@Override
public Process execute(String shell, String[] envp, File dir) throws IOException {
- String[] cmdArray = new String[] { shell, "-c", command}; //$NON-NLS-1$
+ 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 2f80d6b67f7..4e0f34e0772 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
@@ -41,7 +41,7 @@ public class Comment extends Directive implements IComment {
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 da40d91fa68..1594393c2f1 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
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
import java.io.Serializable;
import java.util.Comparator;
@@ -26,6 +25,6 @@ public class CompletionProposalComparator implements Comparator<ICompletionPropo
@Override
public int compare(ICompletionProposal o1, ICompletionProposal o2) {
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 42612068dc9..57fdf36c3d8 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
@@ -18,7 +18,7 @@ import org.eclipse.cdt.make.core.makefile.gnu.IConditional;
public abstract class Conditional extends Parent implements IConditional {
- private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
String cond;
String arg1;
String arg2;
@@ -40,7 +40,6 @@ public abstract class Conditional extends Parent implements IConditional {
cond = conditional;
}
-
@Override
public String getConditional() {
return cond;
@@ -55,7 +54,7 @@ public abstract class Conditional extends Parent implements IConditional {
public String getArg2() {
return arg2;
}
-
+
public boolean isIf() {
return false;
}
@@ -101,12 +100,12 @@ public abstract class Conditional extends Parent implements IConditional {
String line = getConditional().trim();
char terminal = line.charAt(0) == '(' ? ',' : line.charAt(0);
-
+
if (line.length() < 5 && terminal != ',' && terminal != '"' && terminal != '\'') {
arg1 = arg2 = EMPTY;
return;
}
-
+
// Find the end of the first string.
int count = 0;
// For the (ARG1, ARG2) format.
@@ -135,20 +134,20 @@ public abstract class Conditional extends Parent implements IConditional {
if (count >= line.length()) {
arg1 = arg2 = EMPTY;
- return;
+ return;
}
arg1 = line.substring(1, count);
-
+
/* Find the start of the second string. */
line = line.substring(count + 1).trim();
-
+
terminal = terminal == ',' ? ')' : line.charAt(0);
if (terminal != ')' && terminal != '"' && terminal != '\'') {
arg2 = EMPTY;
return;
}
-
+
count = 0;
/* Find the end of the second string. */
if (terminal == ')') {
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 f1ff63b0e03..4d3dfce69af 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
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class DefineVariable extends GNUVariableDef {
public DefineVariable(Directive parent, String name, StringBuffer value) {
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 8a5ad54031b..e219d84f680 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
@@ -58,7 +58,7 @@ public abstract class Directive implements IDirective {
}
return filename;
}
-
+
@Override
public IMakefile getMakefile() {
if (makefile == 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 accb81cba4c..01ea1eb5246 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
@@ -61,12 +61,13 @@ public class EditorUtility {
*/
public static final String DEFAULT_TEXT_EDITOR_ID = EditorsUI.DEFAULT_TEXT_EDITOR_ID;
- private EditorUtility () {
+ private EditorUtility() {
}
- private static IEditorPart openInEditor(IEditorInput input, String editorID, boolean activate) throws PartInitException {
+ private static IEditorPart openInEditor(IEditorInput input, String editorID, boolean activate)
+ throws PartInitException {
if (input != null) {
- IWorkbenchPage p= CUIPlugin.getActivePage();
+ IWorkbenchPage p = CUIPlugin.getActivePage();
if (p != null) {
return p.openEditor(input, editorID, activate);
}
@@ -76,31 +77,31 @@ public class EditorUtility {
private static IEditorInput getEditorInput(ICElement element) {
while (element != null) {
- if (element instanceof ISourceReference) {
- ITranslationUnit tu = ((ISourceReference)element).getTranslationUnit();
- if (tu != null) {
- element = tu;
- }
- }
- if (element instanceof IWorkingCopy && ((IWorkingCopy) element).isWorkingCopy())
- element= ((IWorkingCopy) element).getOriginalElement();
-
+ if (element instanceof ISourceReference) {
+ ITranslationUnit tu = ((ISourceReference) element).getTranslationUnit();
+ if (tu != null) {
+ element = tu;
+ }
+ }
+ if (element instanceof IWorkingCopy && ((IWorkingCopy) element).isWorkingCopy())
+ element = ((IWorkingCopy) element).getOriginalElement();
+
if (element instanceof ITranslationUnit) {
- ITranslationUnit unit= (ITranslationUnit) element;
- IResource resource= unit.getResource();
+ ITranslationUnit unit = (ITranslationUnit) element;
+ IResource resource = unit.getResource();
if (resource instanceof IFile) {
return new FileEditorInput((IFile) resource);
}
return new ExternalEditorInput(unit, new FileStorage(unit.getPath()));
}
-
+
if (element instanceof IBinary) {
- return new ExternalEditorInput(getStorage((IBinary)element), (IPath)null);
+ return new ExternalEditorInput(getStorage((IBinary) element), (IPath) null);
}
-
- element= element.getParent();
+
+ element = element.getParent();
}
-
+
return null;
}
@@ -108,11 +109,11 @@ public class EditorUtility {
if (input instanceof ICElement) {
return getEditorInput((ICElement) input);
}
- if (input instanceof IFile) {
+ if (input instanceof IFile) {
return new FileEditorInput((IFile) input);
}
- if (input instanceof IStorage) {
- return new ExternalEditorInput((IStorage)input);
+ if (input instanceof IStorage) {
+ return new ExternalEditorInput((IStorage) input);
}
return null;
}
@@ -121,14 +122,14 @@ public class EditorUtility {
* Utility method to open an editor for the given file system location
* using {@link #getEditorInputForLocation(IPath, ICElement)} to create
* the editor input.
- *
+ *
* @param location a file system location
* @param element an element related to the target file, may be <code>null</code>
- * @throws PartInitException
+ * @throws PartInitException
*/
public static IEditorPart openInEditor(IPath location, ICElement element) throws PartInitException {
- IEditorInput input= getEditorInputForLocation(location, element);
- return EditorUtility.openInEditor(input, getEditorID(input, element), true);
+ IEditorInput input = getEditorInputForLocation(location, element);
+ return EditorUtility.openInEditor(input, getEditorID(input, element), true);
}
/**
@@ -138,17 +139,17 @@ public class EditorUtility {
* assuming the location points to an existing file in the file system.
* The <code>ICElement</code> is used to determine the associated project
* in case the location can not be resolved to a workspace <code>IFile</code>.
- *
+ *
* @param location a valid file system location
* @param context an element related to the target file, may be <code>null</code>
* @return an editor input
*/
public static IEditorInput getEditorInputForLocation(IPath location, ICElement context) {
- IFile resource= getWorkspaceFileAtLocation(location, context);
+ IFile resource = getWorkspaceFileAtLocation(location, context);
if (resource != null) {
return new FileEditorInput(resource);
- }
-
+ }
+
if (context == null) {
// try to synthesize a context for a location appearing on a project's
// include paths
@@ -165,15 +166,15 @@ public class EditorUtility {
}
if (context == null && projects.length > 0) {
// last resort: just take any of them
- context= projects[0];
+ context = projects[0];
}
} catch (CModelException e) {
}
}
-
+
if (context != null) {
// try to get a translation unit from the location and associated element
- ICProject cproject= context.getCProject();
+ ICProject cproject = context.getCProject();
if (cproject != null) {
ITranslationUnit unit = CoreModel.getDefault().createTranslationUnitFrom(cproject, location);
if (unit != null) {
@@ -181,46 +182,45 @@ public class EditorUtility {
}
// no translation unit - still try to get a sensible marker resource
// from the associated element
- IResource markerResource= cproject.getProject();
+ IResource markerResource = cproject.getProject();
return new ExternalEditorInput(new FileStorage(location), markerResource);
}
}
return new ExternalEditorInput(new FileStorage(location));
}
-
/**
* Utility method to resolve a file system location to a workspace resource.
* If a context element is given and there are multiple matches in the workspace,
* a resource with the same project of the context element are preferred.
- *
+ *
* @param location a valid file system location
* @param context an element related to the target file, may be <code>null</code>
* @return an <code>IFile</code> or <code>null</code>
*/
private static IFile getWorkspaceFileAtLocation(IPath location, ICElement context) {
- IFile file= FileBuffers.getWorkspaceFileAtLocation(location);
+ IFile file = FileBuffers.getWorkspaceFileAtLocation(location);
if (file == null) {
// try to find a linked resource
- IProject project= null;
+ IProject project = null;
if (context != null) {
- ICProject cProject= context.getCProject();
+ ICProject cProject = context.getCProject();
if (cProject != null) {
- project= cProject.getProject();
+ project = cProject.getProject();
}
}
- IFile bestMatch= null;
- IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- IFile[] files= root.findFilesForLocationURI(URIUtil.toURI(location));
- for (int i= 0; i < files.length; i++) {
- file= files[i];
+ IFile bestMatch = null;
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IFile[] files = root.findFilesForLocationURI(URIUtil.toURI(location));
+ for (int i = 0; i < files.length; i++) {
+ file = files[i];
if (file.isAccessible()) {
if (project != null && file.getProject() == project) {
- bestMatch= file;
+ bestMatch = file;
break;
}
if (bestMatch == null) {
- bestMatch= file;
+ bestMatch = file;
if (project == null) {
break;
}
@@ -235,7 +235,7 @@ public class EditorUtility {
/**
* Determine the editor id from the given file name using
* the workspace-wide content-type definitions.
- *
+ *
* @param name the file name
* @return a valid editor id, never <code>null</code>
*/
@@ -256,7 +256,7 @@ public class EditorUtility {
* mechanism is used to determine the correct editor id.
* If that fails, the editor id is determined by file name and extension using
* the workspace-wide content-type definitions.
- *
+ *
* @param input the editor input
* @param inputObject the input object (used to create the editor input) or <code>null</code>
* @return a valid editor id, never <code>null</code>
@@ -265,26 +265,26 @@ public class EditorUtility {
ITranslationUnit tunit = null;
if (inputObject instanceof ITranslationUnit) {
- tunit= (ITranslationUnit)inputObject;
+ tunit = (ITranslationUnit) inputObject;
} else if (input instanceof IFileEditorInput) {
- IFileEditorInput editorInput = (IFileEditorInput)input;
+ IFileEditorInput editorInput = (IFileEditorInput) input;
IFile file = editorInput.getFile();
ICElement celement = CoreModel.getDefault().create(file);
if (celement instanceof ITranslationUnit) {
- tunit = (ITranslationUnit)celement;
+ tunit = (ITranslationUnit) celement;
}
} else if (input instanceof ITranslationUnitEditorInput) {
- ITranslationUnitEditorInput editorInput = (ITranslationUnitEditorInput)input;
+ ITranslationUnitEditorInput editorInput = (ITranslationUnitEditorInput) input;
tunit = editorInput.getTranslationUnit();
}
if (tunit != null) {
// Choose an editor based on the content type
- String contentTypeId= tunit.getContentTypeId();
+ String contentTypeId = tunit.getContentTypeId();
if (contentTypeId != null) {
- IContentType contentType= Platform.getContentTypeManager().getContentType(contentTypeId);
+ IContentType contentType = Platform.getContentTypeManager().getContentType(contentTypeId);
IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
- IEditorDescriptor desc= registry.getDefaultEditor(input.getName(), contentType);
+ IEditorDescriptor desc = registry.getDefaultEditor(input.getName(), contentType);
if (desc != null) {
return desc.getId();
}
@@ -310,12 +310,12 @@ public class EditorUtility {
try {
IBuffer buffer = bin.getBuffer();
if (buffer != null) {
- store = new FileStorage (new ByteArrayInputStream(buffer.getContents().getBytes()), bin.getPath());
+ store = new FileStorage(new ByteArrayInputStream(buffer.getContents().getBytes()), bin.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 f6030bca8bc..7fe0d6c29a4 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
@@ -27,70 +27,78 @@ import org.eclipse.swt.widgets.Shell;
* A class to select one or more elements out of an indexed property
*/
public class ElementListSelectionDialog extends AbstractElementListSelectionDialog {
-
+
private List<Object> fElements;
-
+
@Override
protected void computeResult() {
setResult(getWidgetSelection());
}
-
@Override
protected Control createDialogArea(Composite parent) {
- Control result= super.createDialogArea(parent);
-
+ Control result = super.createDialogArea(parent);
+
setSelectionListElements(fElements, false);
- //a little trick to make the window come up faster
- String initialFilter= null;
- if (getPrimaryInitialSelection() instanceof String)
- initialFilter= (String)getPrimaryInitialSelection();
- if (initialFilter != null)
- setFilter(initialFilter, true);
- else
- refilter();
-
+ //a little trick to make the window come up faster
+ String initialFilter = null;
+ if (getPrimaryInitialSelection() instanceof String)
+ initialFilter = (String) getPrimaryInitialSelection();
+ if (initialFilter != null)
+ setFilter(initialFilter, true);
+ else
+ refilter();
+
return result;
}
+
public Object getSelectedElement() {
return getPrimaryResult();
}
+
public Object[] getSelectedElements() {
return getResult();
}
+
@Override
protected void handleDoubleClick() {
if (verifyCurrentSelection()) {
buttonPressed(IDialogConstants.OK_ID);
}
}
+
/**
* Constructs a list selection dialog.
* @param renderer The label renderer used
* @param ignoreCase Decides if the match string ignores lower/upper case
- * @param multipleSelection Allow multiple selection
+ * @param multipleSelection Allow multiple selection
*/
- public ElementListSelectionDialog(Shell parent, String title, Image image, ILabelProvider renderer, boolean ignoreCase, boolean multipleSelection) {
- super (parent, title, image, renderer, ignoreCase, multipleSelection);
+ public ElementListSelectionDialog(Shell parent, String title, Image image, ILabelProvider renderer,
+ boolean ignoreCase, boolean multipleSelection) {
+ super(parent, title, image, renderer, ignoreCase, multipleSelection);
}
+
/**
* Constructs a list selection dialog.
* @param renderer The label renderer used
* @param ignoreCase Decides if the match string ignores lower/upppr case
- * @param multipleSelection Allow multiple selection
+ * @param multipleSelection Allow multiple selection
*/
- public ElementListSelectionDialog(Shell parent, ILabelProvider renderer, boolean ignoreCase, boolean multipleSelection) {
+ public ElementListSelectionDialog(Shell parent, ILabelProvider renderer, boolean ignoreCase,
+ boolean multipleSelection) {
this(parent, "", null, renderer, ignoreCase, multipleSelection); //$NON-NLS-1$
}
+
/**
* Open the dialog.
* @param elements The elements to show in the list
* @return Returns OK or CANCEL
- */
+ */
public int open(List<Object> elements) {
setElements(elements);
return open();
}
+
/**
* Open the dialog.
* @param elements The elements to show in the list
@@ -102,10 +110,11 @@ public class ElementListSelectionDialog extends AbstractElementListSelectionDial
setInitialSelection(initialSelection);
return open();
}
+
/**
* Sets the elements presented by this dialog.
*/
public void setElements(List<Object> elements) {
- fElements= elements;
+ fElements = elements;
}
}
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 5be169626e2..f68df791128 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
@@ -22,7 +22,7 @@ public class Else extends Conditional implements IAutomakeConditional, ICommand
private boolean isAutomake;
private Rule[] rules;
-
+
public Else(Directive parent) {
super(parent);
}
@@ -31,7 +31,7 @@ public class Else extends Conditional implements IAutomakeConditional, ICommand
public boolean isAutomake() {
return isAutomake;
}
-
+
@Override
public Rule[] getRules() {
if (rules != null)
@@ -46,12 +46,12 @@ public class Else extends Conditional implements IAutomakeConditional, ICommand
else
this.rules = rules;
}
-
+
@Override
public void setAutomake(boolean value) {
isAutomake = value;
}
-
+
@Override
public boolean isElse() {
return true;
@@ -61,23 +61,23 @@ public class Else extends Conditional implements IAutomakeConditional, ICommand
public String toString() {
return GNUMakefileConstants.CONDITIONAL_ELSE;
}
-
+
// ICommand methods so Automake else can be a child of an IRule
@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/Endef.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Endef.java
index 5e8cbe811dc..fe0adca060f 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
@@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake;
public class Endef extends Terminal {
-
public Endef(Directive parent) {
super(parent);
}
@@ -24,9 +23,9 @@ public class Endef extends Terminal {
public boolean isEndef() {
return true;
}
-
+
@Override
public String toString() {
- return GNUMakefileConstants.TERMINAL_ENDEF;
- }
+ 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 c725a969383..e55bb876d77 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
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class Endif extends Terminal {
public Endif(Directive parent) {
@@ -24,9 +23,9 @@ public class Endif extends Terminal {
public boolean isEndif() {
return true;
}
-
- @Override
+
+ @Override
public String toString() {
- return GNUMakefileConstants.TERMINAL_ENDIF;
- }
+ return GNUMakefileConstants.TERMINAL_ENDIF;
+ }
}
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 5bbf7b99cdf..5872d71afef 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
@@ -14,7 +14,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
@@ -29,12 +28,11 @@ import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.ILocationProvider;
-
/**
* An EditorInput for an external (non-workspace) file.
*/
public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersistableElement {
-
+
private IStorage externalFile;
private IResource markerResource;
private ITranslationUnit unit;
@@ -46,14 +44,14 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis
return true;
if (!(obj instanceof IStorageEditorInput))
return false;
- IStorageEditorInput other = (IStorageEditorInput)obj;
+ IStorageEditorInput other = (IStorageEditorInput) obj;
try {
return externalFile.equals(other.getStorage());
} catch (CoreException exc) {
return false;
}
}
-
+
@Override
public int hashCode() {
return externalFile.hashCode();
@@ -76,7 +74,7 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis
@Override
public ImageDescriptor getImageDescriptor() {
- IEditorRegistry registry= PlatformUI.getWorkbench().getEditorRegistry();
+ IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
return registry.getImageDescriptor(externalFile.getFullPath().getFileExtension());
}
@@ -113,7 +111,7 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis
public ExternalEditorInput(ITranslationUnit unit, IStorage exFile) {
this(exFile, exFile.getFullPath());
this.unit = unit;
- markerResource= unit.getCProject().getProject();
+ markerResource = unit.getCProject().getProject();
}
public ExternalEditorInput(IStorage exFile) {
@@ -124,14 +122,14 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis
externalFile = exFile;
this.location = location;
}
-
+
/**
* This constructor accepts the storage for the editor
* and a reference to a resource which holds the markers for the external file.
*/
- public ExternalEditorInput(IStorage exFile, IResource markerResource) {
+ public ExternalEditorInput(IStorage exFile, IResource markerResource) {
this(exFile, exFile.getFullPath());
- this.markerResource = markerResource ;
+ this.markerResource = markerResource;
}
/**
@@ -150,5 +148,5 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis
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 c2e4a3b5ba4..694b59ba741 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
@@ -41,48 +41,48 @@ public class ExternalEditorInputFactory implements IElementFactory {
public static final String ID = "org.eclipse.cdt.ui.ExternalEditorInputFactory"; //$NON-NLS-1$
- private static final String TAG_PATH = "path";//$NON-NLS-1$
- private static final String TAG_PROJECT = "project";//$NON-NLS-1$
+ private static final String TAG_PATH = "path";//$NON-NLS-1$
+ private static final String TAG_PROJECT = "project";//$NON-NLS-1$
@Override
public IAdaptable createElement(IMemento memento) {
- // Get the file name.
- String fileName = memento.getString(TAG_PATH);
- if (fileName == null) {
+ // Get the file name.
+ String fileName = memento.getString(TAG_PATH);
+ if (fileName == null) {
return null;
}
- IPath location= new Path(fileName);
- ICProject cProject= null;
-
- String projectName= memento.getString(TAG_PROJECT);
- if (projectName != null) {
- IProject project= ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if (project.isAccessible() && CoreModel.hasCNature(project)) {
- cProject= CoreModel.getDefault().create(project);
- }
- }
+ IPath location = new Path(fileName);
+ ICProject cProject = null;
+
+ String projectName = memento.getString(TAG_PROJECT);
+ if (projectName != null) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project.isAccessible() && CoreModel.hasCNature(project)) {
+ cProject = CoreModel.getDefault().create(project);
+ }
+ }
return EditorUtility.getEditorInputForLocation(location, cProject);
}
/**
* Save the element state.
- *
+ *
* @param memento the storage
* @param input the element
*/
static void saveState(IMemento memento, ExternalEditorInput input) {
- IPath location= input.getPath(input);
+ IPath location = input.getPath(input);
if (location != null) {
memento.putString(TAG_PATH, location.toOSString());
}
- IProject project= null;
- ITranslationUnit unit= input.getTranslationUnit();
+ IProject project = null;
+ ITranslationUnit unit = input.getTranslationUnit();
if (unit != null) {
- project= unit.getCProject().getProject();
+ project = unit.getCProject().getProject();
}
if (project == null && input.getMarkerResource() instanceof IProject) {
- project= (IProject)input.getMarkerResource();
+ project = (IProject) input.getMarkerResource();
}
if (project != null) {
memento.putString(TAG_PROJECT, project.getName());
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 2eebff18a92..0ebd0f89875 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
@@ -46,21 +46,20 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-
/**
* Makefile : ( statement ) *
* statement : rule | macro_definition | comments | empty
* rule : inference_rule | target_rule
* inference_rule : target ':' <nl> ( <tab> command <nl> ) +
- * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
+ * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
[ ( command ) * ]
- * macro_definition : string '=' (string)*
+ * macro_definition : string '=' (string)*
* comments : ('#' (string) <nl>) *
* empty : <nl>
* command : <tab> prefix_command string <nl>
* target : string
* prefix_command : '-' | '@' | '+'
- * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
+ * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
*/
public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
@@ -80,7 +79,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
parse(name, stream);
}
}
-
+
@Override
public void parse(String filePath, Reader reader) throws IOException {
parse(URIUtil.toURI(filePath), new MakefileReader(reader));
@@ -90,7 +89,6 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
public void parse(URI fileURI, Reader reader) throws IOException {
parse(fileURI, new MakefileReader(reader));
}
-
protected void parse(URI fileURI, MakefileReader reader) throws IOException {
String line;
@@ -104,11 +102,11 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
clearDirectives();
setFileURI(fileURI);
-
+
while ((line = reader.readLine()) != null) {
startLine = endLine + 1;
endLine = reader.getLineNumber();
-
+
// Check if we enter in "define"
if (GNUMakefileUtil.isEndef(line)) {
// We should have a "define" for a "endef".
@@ -146,8 +144,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
}
// 1- Try command first, since we can not strip '#' in command line
- if (PosixMakefileUtil.isCommand(line) ||
- AutomakefileUtil.isAutomakeCommand(line)) {
+ if (PosixMakefileUtil.isCommand(line) || AutomakefileUtil.isAutomakeCommand(line)) {
Command cmd = new Command(this, line);
cmd.setLines(startLine, endLine);
if (rules != null) {
@@ -235,11 +232,11 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
rules = null;
continue;
}
-
+
// 3c - Check for else or endif
if (GNUMakefileUtil.isElse(line)) {
- Else elseDirective = (Else)parseConditional(line);
+ Else elseDirective = (Else) parseConditional(line);
elseDirective.setLines(startLine, endLine);
Conditional cond = null;
// FIXME: Are we missing a if condition ?
@@ -250,7 +247,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
if (cond != null && cond.isIf()) {
// See 3b above for description on automake if/else handling.
elseDirective.setAutomake(true);
- rules = ((If)cond).getRules();
+ rules = ((If) cond).getRules();
// We cache the rules at the time of entry into the if/else block.
elseDirective.setRules(rules);
if (rules != null) {
@@ -278,7 +275,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
cond.setEndLine(endLine);
}
if (cond instanceof IAutomakeConditional) {
- rules = ((IAutomakeConditional)cond).getRules();
+ rules = ((IAutomakeConditional) cond).getRules();
}
if (rules != null) {
// The endif is added to the rules.
@@ -291,7 +288,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
}
continue;
}
-
+
// 4 - reset rules to null
// The first non empty line that does not begin with a <TAB> or '#'
// shall begin a new entry.
@@ -338,7 +335,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
vd.setLines(startLine, endLine);
addDirective(conditions, vd);
if (!vd.isTargetSpecific()) {
- continue;
+ continue;
}
}
@@ -363,7 +360,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
rules = trules;
continue;
}
-
+
// - Configure macro (@xxxx@)
if (AutomakefileUtil.isConfigMacro(line)) {
AutomakeConfigMacro macro = parseConfigMacro(line);
@@ -462,7 +459,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
*/
protected SpecialRule parseSpecialRule(String line) {
line = line.trim();
- String keyword = null;
+ String keyword = null;
String[] reqs = null;
SpecialRule special = null;
int index = Util.indexOf(line, ':');
@@ -505,7 +502,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
}
return special;
}
-
+
/**
* if CONDITIONAL
*
@@ -526,15 +523,15 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
if (keyword == null) {
keyword = line;
}
- if (keyword.equals(GNUMakefileConstants.CONDITIONAL_IF) ||
- keyword.equals(GNUMakefileConstants.AT_CONDITIONAL_IF)) {
+ if (keyword.equals(GNUMakefileConstants.CONDITIONAL_IF)
+ || keyword.equals(GNUMakefileConstants.AT_CONDITIONAL_IF)) {
return new If(this, rules, line);
}
return null;
}
/**
- *
+ *
* ifdef CONDITIONAL
* ifeq CONDITIONAL
* ifneq CONDITIONAL
@@ -579,14 +576,14 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
String extraChars = "_-";
char[] ch = line.toCharArray();
int i = 1;
- while (Character.isLetterOrDigit(ch[i]) ||
- extraChars.indexOf(ch[i]) >= 0) {
+ while (Character.isLetterOrDigit(ch[i]) || extraChars.indexOf(ch[i]) >= 0) {
++i;
}
if (i > 1 && ch[i] == '@')
- return new AutomakeConfigMacro(this, line.substring(0, i+1));
+ return new AutomakeConfigMacro(this, line.substring(0, i + 1));
return null;
}
+
/**
* Format of the include directive:
* include filename1 filename2 ...
@@ -718,7 +715,8 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
GNUTargetRule[] rules = new GNUTargetRule[targetNames.length];
for (int i = 0; i < targetNames.length; i++) {
- rules[i] = new GNUTargetRule(this, new Target(targetNames[i]), doubleColon, normalReqs, orderReqs, new Command[0]);
+ rules[i] = new GNUTargetRule(this, new Target(targetNames[i]), doubleColon, normalReqs, orderReqs,
+ new Command[0]);
if (cmd != null) {
rules[i].addDirective(new Command(this, cmd));
}
@@ -798,9 +796,8 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
// Check for "+=", ":=", "?="
if (index > 0) {
type = line.charAt(index - 1);
- if (type == GNUVariableDef.TYPE_SIMPLE_EXPAND
- || type == GNUVariableDef.TYPE_APPEND
- || type == GNUVariableDef.TYPE_CONDITIONAL) {
+ if (type == GNUVariableDef.TYPE_SIMPLE_EXPAND || type == GNUVariableDef.TYPE_APPEND
+ || type == GNUVariableDef.TYPE_CONDITIONAL) {
separator = index - 1;
} else {
type = GNUVariableDef.TYPE_RECURSIVE_EXPAND;
@@ -861,7 +858,8 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
StaticTargetRule[] staticRules = new StaticTargetRule[targets.length];
for (int i = 0; i < targets.length; i++) {
- staticRules[i] = new StaticTargetRule(this, new Target(targets[i]), targetPattern, prereqPatterns, new Command[0]);
+ staticRules[i] = new StaticTargetRule(this, new Target(targets[i]), targetPattern, prereqPatterns,
+ new Command[0]);
}
return staticRules;
}
@@ -890,10 +888,10 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
ArrayList<IDirective> list = new ArrayList<>(Arrays.asList(dirs));
for (int i = 0; i < dirs.length; ++i) {
if (dirs[i] instanceof Include) {
- Include include = (Include)dirs[i];
+ Include include = (Include) dirs[i];
IDirective[] includedMakefiles = include.getDirectives();
for (int j = 0; j < includedMakefiles.length; ++j) {
- IMakefile includedMakefile = (IMakefile)includedMakefiles[j];
+ IMakefile includedMakefile = (IMakefile) includedMakefiles[j];
list.addAll(Arrays.asList(includedMakefile.getDirectives()));
}
}
@@ -904,9 +902,10 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
@Override
public IDirective[] getBuiltins() {
if (builtins == null) {
- String location = "builtin" + File.separator + "gnu.mk"; //$NON-NLS-1$ //$NON-NLS-2$
+ String location = "builtin" + File.separator + "gnu.mk"; //$NON-NLS-1$ //$NON-NLS-2$
try {
- InputStream stream = FileLocator.openStream(MakeCorePlugin.getDefault().getBundle(), new Path(location), false);
+ InputStream stream = FileLocator.openStream(MakeCorePlugin.getDefault().getBundle(), new Path(location),
+ false);
GNUAutomakefile gnu = new GNUAutomakefile();
URL url = FileLocator.find(MakeCorePlugin.getDefault().getBundle(), new Path(location), null);
url = FileLocator.resolve(url);
@@ -915,7 +914,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
builtins = gnu.getDirectives();
for (int i = 0; i < builtins.length; i++) {
if (builtins[i] instanceof MacroDefinition) {
- ((MacroDefinition)builtins[i]).setFromDefault(true);
+ ((MacroDefinition) builtins[i]).setFromDefault(true);
}
}
} catch (Exception e) {
@@ -940,8 +939,8 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
/**
* Create an IMakefile using the given IMakefileReaderProvider to fetch
- * contents by name.
- *
+ * contents by name.
+ *
* @param fileURI URI of main file
* @param makefileReaderProvider may be <code>null</code> for EFS IFileStore reading
*/
@@ -960,8 +959,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
if (!info.exists() || info.isDirectory())
throw new IOException();
- MakefileReader reader = new MakefileReader(new InputStreamReader(
- store.openInputStream(EFS.NONE, null)));
+ MakefileReader reader = new MakefileReader(new InputStreamReader(store.openInputStream(EFS.NONE, null)));
gnu.parse(fileURI, reader);
} catch (IOException e) {
AutotoolsUIPlugin.log(e);
@@ -971,7 +969,7 @@ public class GNUAutomakefile extends AbstractMakefile implements IGNUMakefile {
makefile = gnu;
return makefile;
}
-
+
public static void main(String[] args) {
try {
String filename = "Makefile"; //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileConstants.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileConstants.java
index b51a1c4f90f..5a0e460f883 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileConstants.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileConstants.java
@@ -14,34 +14,33 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class GNUMakefileConstants extends MakeFileConstants {
- static final String CONDITIONAL_ELSE = "else"; //$NON-NLS-1$
- static final String CONDITIONAL_IF = "if"; //$NON-NLS-1$
- static final String AT_CONDITIONAL_IF = "@if"; //$NON-NLS-1$
- static final String CONDITIONAL_IFNEQ = "ifneq"; //$NON-NLS-1$
- static final String CONDITIONAL_IFNDEF = "ifndef"; //$NON-NLS-1$
- static final String CONDITIONAL_IFEQ = "ifeq"; //$NON-NLS-1$
- static final String CONDITIONAL_IFDEF = "ifdef"; //$NON-NLS-1$
-
- static final String TERMINAL_ENDEF = "endef"; //$NON-NLS-1$
- static final String TERMINAL_ENDIF = "endif"; //$NON-NLS-1$
- static final String AT_TERMINAL_ENDIF = "@endif"; //$NON-NLS-1$
+ static final String CONDITIONAL_ELSE = "else"; //$NON-NLS-1$
+ static final String CONDITIONAL_IF = "if"; //$NON-NLS-1$
+ static final String AT_CONDITIONAL_IF = "@if"; //$NON-NLS-1$
+ static final String CONDITIONAL_IFNEQ = "ifneq"; //$NON-NLS-1$
+ static final String CONDITIONAL_IFNDEF = "ifndef"; //$NON-NLS-1$
+ static final String CONDITIONAL_IFEQ = "ifeq"; //$NON-NLS-1$
+ static final String CONDITIONAL_IFDEF = "ifdef"; //$NON-NLS-1$
+
+ static final String TERMINAL_ENDEF = "endef"; //$NON-NLS-1$
+ static final String TERMINAL_ENDIF = "endif"; //$NON-NLS-1$
+ static final String AT_TERMINAL_ENDIF = "@endif"; //$NON-NLS-1$
+
+ static final String DIRECTIVE_VPATH = "vpath"; //$NON-NLS-1$
+ static final String DIRECTIVE_UNEXPORT = "unexport"; //$NON-NLS-1$
+
+ static final String VARIABLE_DEFINE = "define"; //$NON-NLS-1$
+ static final String VARIABLE_EXPORT = "export"; //$NON-NLS-1$
+ static final String VARIABLE_OVERRIDE = "override"; //$NON-NLS-1$
- static final String DIRECTIVE_VPATH = "vpath"; //$NON-NLS-1$
- static final String DIRECTIVE_UNEXPORT = "unexport"; //$NON-NLS-1$
-
- static final String VARIABLE_DEFINE = "define"; //$NON-NLS-1$
- static final String VARIABLE_EXPORT = "export"; //$NON-NLS-1$
- static final String VARIABLE_OVERRIDE = "override"; //$NON-NLS-1$
-
- static final String DIRECTIVE_INCLUDE = "include"; //$NON-NLS-1$
+ static final String DIRECTIVE_INCLUDE = "include"; //$NON-NLS-1$
- static final String RULE_DELETE_ON_ERROR = ".DELETE_ON_ERROR"; //$NON-NLS-1$
- static final String RULE_PHONY = ".PHONY"; //$NON-NLS-1$
- static final String RULE_SECONDARY = ".SECONDARY"; //$NON-NLS-1$
- static final String RULE_LOW_RESOLUTION_TIME = ".LOW_RESOLUTION_TIME"; //$NON-NLS-1$
- static final String RULE_NOT_PARALLEL = ".NOTPARALLEL"; //$NON-NLS-1$
- static final String RULE_EXPORT_ALL_VARIABLES = ".EXPORT_ALL_VARIABLES"; //$NON-NLS-1$
- static final String RULE_INTERMEDIATE = ".INTERMEDIATE"; //$NON-NLS-1$
+ static final String RULE_DELETE_ON_ERROR = ".DELETE_ON_ERROR"; //$NON-NLS-1$
+ static final String RULE_PHONY = ".PHONY"; //$NON-NLS-1$
+ static final String RULE_SECONDARY = ".SECONDARY"; //$NON-NLS-1$
+ static final String RULE_LOW_RESOLUTION_TIME = ".LOW_RESOLUTION_TIME"; //$NON-NLS-1$
+ static final String RULE_NOT_PARALLEL = ".NOTPARALLEL"; //$NON-NLS-1$
+ static final String RULE_EXPORT_ALL_VARIABLES = ".EXPORT_ALL_VARIABLES"; //$NON-NLS-1$
+ static final String RULE_INTERMEDIATE = ".INTERMEDIATE"; //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileUtil.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileUtil.java
index 955881d1928..8659f766019 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileUtil.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/GNUMakefileUtil.java
@@ -14,7 +14,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
/**
* GNUMakefile
*/
@@ -22,30 +21,39 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
public static boolean isInclude(String line) {
line = line.trim();
- boolean isInclude = line.startsWith(GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 7 && Character.isWhitespace(line.charAt(7));
- boolean isDashInclude = line.startsWith("-" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 && Character.isWhitespace(line.charAt(8)); //$NON-NLS-1$
- boolean isSInclude = line.startsWith("s" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 && Character.isWhitespace(line.charAt(8)); //$NON-NLS-1$
+ boolean isInclude = line.startsWith(GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 7
+ && Character.isWhitespace(line.charAt(7));
+ boolean isDashInclude = line.startsWith("-" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 //$NON-NLS-1$
+ && Character.isWhitespace(line.charAt(8));
+ boolean isSInclude = line.startsWith("s" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 //$NON-NLS-1$
+ && Character.isWhitespace(line.charAt(8));
return isInclude || isDashInclude || isSInclude;
}
public static boolean isVPath(String line) {
line = line.trim();
- return line.equals(GNUMakefileConstants.DIRECTIVE_VPATH) || line.startsWith(GNUMakefileConstants.DIRECTIVE_VPATH) && line.length() > 5 && Character.isWhitespace(line.charAt(5));
+ return line.equals(GNUMakefileConstants.DIRECTIVE_VPATH)
+ || line.startsWith(GNUMakefileConstants.DIRECTIVE_VPATH) && line.length() > 5
+ && Character.isWhitespace(line.charAt(5));
}
public static boolean isExport(String line) {
line = line.trim();
- return line.equals(GNUMakefileConstants.VARIABLE_EXPORT) || line.startsWith(GNUMakefileConstants.VARIABLE_EXPORT) && line.length() > 6 && Character.isWhitespace(line.charAt(6));
+ return line.equals(GNUMakefileConstants.VARIABLE_EXPORT)
+ || line.startsWith(GNUMakefileConstants.VARIABLE_EXPORT) && line.length() > 6
+ && Character.isWhitespace(line.charAt(6));
}
public static boolean isUnExport(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.DIRECTIVE_UNEXPORT) && line.length() > 8 && Character.isWhitespace(line.charAt(8));
+ return line.startsWith(GNUMakefileConstants.DIRECTIVE_UNEXPORT) && line.length() > 8
+ && Character.isWhitespace(line.charAt(8));
}
public static boolean isDefine(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.VARIABLE_DEFINE) && line.length() > 6 && Character.isWhitespace(line.charAt(6));
+ return line.startsWith(GNUMakefileConstants.VARIABLE_DEFINE) && line.length() > 6
+ && Character.isWhitespace(line.charAt(6));
}
public static boolean isEndef(String line) {
@@ -54,33 +62,40 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
public static boolean isOverride(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.VARIABLE_OVERRIDE) && line.length() > 8 && Character.isWhitespace(line.charAt(8));
+ return line.startsWith(GNUMakefileConstants.VARIABLE_OVERRIDE) && line.length() > 8
+ && Character.isWhitespace(line.charAt(8));
}
public static boolean isIf(String line) {
line = line.trim();
- return (line.startsWith(GNUMakefileConstants.CONDITIONAL_IF) && line.length() > 2 && Character.isWhitespace(line.charAt(2))) ||
- (line.startsWith(GNUMakefileConstants.AT_CONDITIONAL_IF) && line.length() > 3 && Character.isWhitespace(line.charAt(3)));
+ return (line.startsWith(GNUMakefileConstants.CONDITIONAL_IF) && line.length() > 2
+ && Character.isWhitespace(line.charAt(2)))
+ || (line.startsWith(GNUMakefileConstants.AT_CONDITIONAL_IF) && line.length() > 3
+ && Character.isWhitespace(line.charAt(3)));
}
-
+
public static boolean isIfeq(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFEQ) && line.length() > 4 && Character.isWhitespace(line.charAt(4));
+ return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFEQ) && line.length() > 4
+ && Character.isWhitespace(line.charAt(4));
}
public static boolean isIfneq(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNEQ) && line.length() > 5 && Character.isWhitespace(line.charAt(5));
+ return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNEQ) && line.length() > 5
+ && Character.isWhitespace(line.charAt(5));
}
public static boolean isIfdef(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFDEF) && line.length() > 5 && Character.isWhitespace(line.charAt(5));
+ return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFDEF) && line.length() > 5
+ && Character.isWhitespace(line.charAt(5));
}
public static boolean isIfndef(String line) {
line = line.trim();
- return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNDEF) && line.length() > 6 && Character.isWhitespace(line.charAt(6));
+ return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNDEF) && line.length() > 6
+ && Character.isWhitespace(line.charAt(6));
}
public static boolean isElse(String line) {
@@ -88,15 +103,15 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
}
public static boolean isEndif(String line) {
- return line.trim().equals(GNUMakefileConstants.TERMINAL_ENDIF) ||
- line.trim().startsWith(GNUMakefileConstants.AT_TERMINAL_ENDIF);
+ return line.trim().equals(GNUMakefileConstants.TERMINAL_ENDIF)
+ || line.trim().startsWith(GNUMakefileConstants.AT_TERMINAL_ENDIF);
}
public static boolean isOverrideDefine(String line) {
line = line.trim();
if (line.startsWith(GNUMakefileConstants.VARIABLE_OVERRIDE)) {
int i = 8;
- while(i < line.length() && Character.isWhitespace(line.charAt(i))) {
+ while (i < line.length() && Character.isWhitespace(line.charAt(i))) {
i++;
}
if (line.startsWith(GNUMakefileConstants.VARIABLE_DEFINE, i)) {
@@ -120,12 +135,8 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
}
public static boolean isVariableDefinition(String line) {
- return isOverrideDefine(line)
- || isTargetVariable(line)
- || isDefine(line)
- || isOverride(line)
- || isExport(line)
- || isMacroDefinition(line);
+ return isOverrideDefine(line) || isTargetVariable(line) || isDefine(line) || isOverride(line) || isExport(line)
+ || isMacroDefinition(line);
}
/**
@@ -138,7 +149,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil {
if (colon1 > 0) {
// move pass colon1
line = line.substring(colon1 + 1);
- int colon2 = Util.indexOf(line, ':');
+ int colon2 = Util.indexOf(line, ':');
// Catch operator "::" not a static pattern rule
return (colon2 > 0);
}
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 819b1633389..0dff594cc9c 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
@@ -22,7 +22,8 @@ public class GNUTargetRule extends TargetRule {
String[] orderOnlyPrerequisites;
boolean doubleColon;
- public GNUTargetRule(Directive parent, Target target, boolean doubleColon, String[] normalPrereqs, String[] orderPrereqs, Command[] commands) {
+ public GNUTargetRule(Directive parent, Target target, boolean doubleColon, String[] normalPrereqs,
+ String[] orderPrereqs, Command[] commands) {
super(parent, target, normalPrereqs, commands);
orderOnlyPrerequisites = orderPrereqs.clone();
this.doubleColon = doubleColon;
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 4ca282b7767..863404d54a7 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
@@ -18,7 +18,7 @@ import org.eclipse.cdt.make.core.makefile.gnu.IVariableDefinition;
/**
*/
-public class GNUVariableDef extends MacroDefinition implements IVariableDefinition {
+public class GNUVariableDef extends MacroDefinition implements IVariableDefinition {
/**
* ? is Conditional
@@ -38,7 +38,7 @@ public class GNUVariableDef extends MacroDefinition implements IVariableDefiniti
}
public GNUVariableDef(Directive parent, String name, StringBuffer value, int type) {
- this(parent, "", name, value, type); //$NON-NLS-1$
+ this(parent, "", name, value, type); //$NON-NLS-1$
}
public GNUVariableDef(Directive parent, String target, String name, StringBuffer value, int type) {
@@ -122,7 +122,7 @@ public class GNUVariableDef extends MacroDefinition implements IVariableDefiniti
/**
* Variable from an `override' directive.
*/
- @Override
+ @Override
public boolean isOverride() {
return false;
}
@@ -130,7 +130,7 @@ public class GNUVariableDef extends MacroDefinition implements IVariableDefiniti
/**
* Automatic variable -- cannot be set.
*/
- @Override
+ @Override
public boolean isAutomatic() {
return false;
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IAutomakeConditional.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IAutomakeConditional.java
index 1594a876edb..1365c85455b 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IAutomakeConditional.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IAutomakeConditional.java
@@ -14,7 +14,7 @@
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
public interface IAutomakeConditional {
-
+
boolean isAutomake();
void setAutomake(boolean value);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IMakefileEditorActionDefinitionIds.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IMakefileEditorActionDefinitionIds.java
index 5de3fe2e7ef..01e95b460fb 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IMakefileEditorActionDefinitionIds.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IMakefileEditorActionDefinitionIds.java
@@ -14,7 +14,6 @@
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
/**
*/
public interface IMakefileEditorActionDefinitionIds {
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IReconcilingParticipant.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IReconcilingParticipant.java
index a1fd0c7c108..b1e7198efa8 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IReconcilingParticipant.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/IReconcilingParticipant.java
@@ -19,7 +19,7 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake;
* Interface of an object participating in reconciling.
*/
public interface IReconcilingParticipant {
-
+
/**
* Called after reconciling has been finished.
*/
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 6defd218eaa..4f40c074c3e 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
@@ -19,9 +19,9 @@ import java.io.File;
import org.eclipse.cdt.make.core.makefile.ICommand;
public class If extends Conditional implements IAutomakeConditional, ICommand {
- private static final String EMPTY = ""; //$NON-NLS-1$
- private Rule rules[] = null;
-
+ private static final String EMPTY = ""; //$NON-NLS-1$
+ private Rule rules[] = null;
+
public If(Directive parent, Rule[] rules, String var) {
super(parent, var, EMPTY, EMPTY);
if (rules != null) {
@@ -36,7 +36,7 @@ public class If extends Conditional implements IAutomakeConditional, ICommand {
return rules.clone();
return null;
}
-
+
@Override
public void setRules(Rule[] rules) {
if (rules != null)
@@ -44,7 +44,7 @@ public class If extends Conditional implements IAutomakeConditional, ICommand {
else
this.rules = rules;
}
-
+
@Override
public boolean isIf() {
return true;
@@ -54,12 +54,12 @@ public class If extends Conditional implements IAutomakeConditional, ICommand {
public boolean isAutomake() {
return true;
}
-
+
@Override
public void setAutomake(boolean value) {
// ignore value
}
-
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder(GNUMakefileConstants.CONDITIONAL_IF);
@@ -70,23 +70,23 @@ public class If extends Conditional implements IAutomakeConditional, ICommand {
public String getVariable() {
return getConditional();
}
-
+
// ICommand methods so Automake if can be a child of an IRule
@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 d74cdaba908..588a0b1888d 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
@@ -13,10 +13,9 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class Ifdef extends Conditional {
- private static final String EMPTY = ""; //$NON-NLS-1$
-
+ private static final String EMPTY = ""; //$NON-NLS-1$
+
public Ifdef(Directive parent, String var) {
super(parent, var, EMPTY, EMPTY);
}
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 824c0a9cd7e..075a7936310 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
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class Ifeq extends Conditional {
public Ifeq(Directive parent, String cond) {
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 71a1905ef24..3aa444baff6 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
@@ -13,10 +13,10 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class Ifndef extends Conditional {
- private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
+
public Ifndef(Directive parent, String var) {
super(parent, var, EMPTY, EMPTY);
}
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 d1b09519258..fa0079863af 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
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class Ifneq extends Conditional {
public Ifneq(Directive parent, String cond) {
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 c52b30c70f8..4faf87dfa34 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
@@ -58,7 +58,7 @@ public class Include extends Parent implements IInclude {
if (!filenames[i].startsWith(GNUAutomakefile.FILE_SEPARATOR) && dirs != null) {
for (int j = 0; j < dirs.length; j++) {
try {
- String filename = dirs[j] + GNUAutomakefile.FILE_SEPARATOR + filenames[i];
+ String filename = dirs[j] + GNUAutomakefile.FILE_SEPARATOR + filenames[i];
gnu = new GNUAutomakefile();
gnu.parse(filename);
addDirective(gnu);
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 3bb5c3bac22..7ca84e66bee 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
@@ -38,7 +38,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
}
public void setName(String n) {
- name = (n == null) ? "" : n.trim() ; //$NON-NLS-1$
+ name = (n == null) ? "" : n.trim(); //$NON-NLS-1$
}
@Override
@@ -56,7 +56,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
@Override
public boolean equals(Object v) {
if (v instanceof MacroDefinition)
- return ((MacroDefinition)v).getName().equals(getName());
+ return ((MacroDefinition) v).getName().equals(getName());
return false;
}
@@ -64,7 +64,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
public int hashCode() {
return getName().hashCode();
}
-
+
public void setFromCommand(boolean from) {
fromCommand = from;
}
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 bbb4e4d066f..3a864538185 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
@@ -30,7 +30,7 @@ class MacroDefinitionRule implements IPredicateRule {
private IToken token;
private StringBuilder buffer = new StringBuilder();
protected IToken defaultToken;
-
+
public MacroDefinitionRule(IToken token, IToken defaultToken) {
this.token = token;
this.defaultToken = defaultToken;
@@ -51,45 +51,45 @@ class MacroDefinitionRule implements IPredicateRule {
for (int c = scanner.read(); c != ICharacterScanner.EOF; c = scanner.read()) {
switch (state) {
- case INIT_STATE :
- if (c != '\n' && Character.isWhitespace((char) c)) {
- break;
- }
- if (isValidCharacter(c)) {
- state = VAR_STATE;
- } else {
- state = ERROR_STATE;
- }
+ case INIT_STATE:
+ if (c != '\n' && Character.isWhitespace((char) c)) {
break;
- case VAR_STATE :
- if (isValidCharacter(c)) {
- break;
- }
- case END_VAR_STATE :
- if (c != '\n' && Character.isWhitespace((char) c)) {
- state = END_VAR_STATE;
- } else if (c == ':' || c == '+') {
- state = EQUAL_STATE;
- } else if (c == '=') {
- state = FINISH_STATE;
- } else {
- if (state == END_VAR_STATE) {
- scanner.unread(); // Return back to the space
- }
- state = ERROR_STATE;
- }
+ }
+ if (isValidCharacter(c)) {
+ state = VAR_STATE;
+ } else {
+ state = ERROR_STATE;
+ }
+ break;
+ case VAR_STATE:
+ if (isValidCharacter(c)) {
break;
- case EQUAL_STATE :
- if (c == '=') {
- state = FINISH_STATE;
- } else {
- state = ERROR_STATE;
+ }
+ case END_VAR_STATE:
+ if (c != '\n' && Character.isWhitespace((char) c)) {
+ state = END_VAR_STATE;
+ } else if (c == ':' || c == '+') {
+ state = EQUAL_STATE;
+ } else if (c == '=') {
+ state = FINISH_STATE;
+ } else {
+ if (state == END_VAR_STATE) {
+ scanner.unread(); // Return back to the space
}
- break;
- case FINISH_STATE :
- break;
- default :
- break;
+ state = ERROR_STATE;
+ }
+ break;
+ case EQUAL_STATE:
+ if (c == '=') {
+ state = FINISH_STATE;
+ } else {
+ state = ERROR_STATE;
+ }
+ break;
+ case FINISH_STATE:
+ break;
+ default:
+ break;
}
if (state >= FINISH_STATE) {
break;
@@ -141,7 +141,7 @@ class MacroDefinitionRule implements IPredicateRule {
}
private void scanToBeginOfLine(ICharacterScanner scanner) {
- while(scanner.getColumn() != 0) {
+ while (scanner.getColumn() != 0) {
scanner.unread();
}
}
@@ -162,6 +162,7 @@ class MacroDefinitionRule implements IPredicateRule {
return true;
}
+
protected boolean isValidCharacter(int c) {
char c0 = (char) c;
return Character.isLetterOrDigit(c0) || (c0 == '_');
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 60d113f4c3f..734e4311b2c 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
@@ -22,19 +22,19 @@ public class MacroReferenceRule extends PatternRule {
int nOfBrackets;
int fBracket;
-// public MacroReferenceRule(IToken token) {
-// super("$(", ")", token, (char) 0, true); //$NON-NLS-1$ //$NON-NLS-2$
-// }
+ // public MacroReferenceRule(IToken token) {
+ // super("$(", ")", token, (char) 0, true); //$NON-NLS-1$ //$NON-NLS-2$
+ // }
public MacroReferenceRule(IToken token, String startSeq, String endSeq) {
- super(startSeq, endSeq, token, (char)0, true);
+ super(startSeq, endSeq, token, (char) 0, true);
if (endSeq.length() > 0 && endSeq.charAt(0) == '}') {
fBracket = '{';
} else {
fBracket = '(';
}
}
-
+
@Override
protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) {
nOfBrackets = 1;
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakeFileConstants.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakeFileConstants.java
index 8ea62250715..bb36a4ba8e9 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakeFileConstants.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakeFileConstants.java
@@ -13,15 +13,14 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class MakeFileConstants {
- public static final String RULE_DEFAULT = ".DEFAULT"; //$NON-NLS-1$
- public static final String RULE_IGNORE =".IGNORE"; //$NON-NLS-1$
- public static final String RULE_POSIX = ".POSIX"; //$NON-NLS-1$
- public static final String RULE_PRECIOUS = ".PRECIOUS"; //$NON-NLS-1$
- public static final String RULE_SCCS_GET = ".SCCS_GET"; //$NON-NLS-1$
- public static final String RULE_SILENT = ".SILENT"; //$NON-NLS-1$
- public static final String RULE_SUFFIXES = ".SUFFIXES"; //$NON-NLS-1$
+ public static final String RULE_DEFAULT = ".DEFAULT"; //$NON-NLS-1$
+ public static final String RULE_IGNORE = ".IGNORE"; //$NON-NLS-1$
+ public static final String RULE_POSIX = ".POSIX"; //$NON-NLS-1$
+ public static final String RULE_PRECIOUS = ".PRECIOUS"; //$NON-NLS-1$
+ public static final String RULE_SCCS_GET = ".SCCS_GET"; //$NON-NLS-1$
+ public static final String RULE_SILENT = ".SILENT"; //$NON-NLS-1$
+ public static final String RULE_SUFFIXES = ".SUFFIXES"; //$NON-NLS-1$
}
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 380370341ad..12d2857d194 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
@@ -37,31 +37,30 @@ import org.eclipse.jface.text.source.LineRange;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
-
/**
* MakefileAnnotationHover
- *
+ *
*/
public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHoverExtension {
@SuppressWarnings("unused")
private IEditorPart fEditor;
-
+
/**
- *
+ *
*/
public MakefileAnnotationHover(IEditorPart editor) {
- fEditor = editor;
+ fEditor = editor;
}
/**
* Returns the distance to the ruler line.
*/
protected int compareRulerLine(Position position, IDocument document, int line) {
-
+
if (position.getOffset() > -1 && position.getLength() > -1) {
try {
- int markerLine= document.getLineOfOffset(position.getOffset());
+ int markerLine = document.getLineOfOffset(position.getOffset());
if (line == markerLine)
return 1;
if (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()))
@@ -69,10 +68,10 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov
} catch (BadLocationException x) {
}
}
-
+
return 0;
}
-
+
/**
* Selects a set of markers from the two lists. By default, it just returns
* the set of exact matches.
@@ -85,16 +84,16 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov
* Returns one marker which includes the ruler's line of activity.
*/
protected List<Annotation> getAnnotationsForLine(ISourceViewer viewer, int line) {
-
- IDocument document= viewer.getDocument();
- IAnnotationModel model= viewer.getAnnotationModel();
-
+
+ IDocument document = viewer.getDocument();
+ IAnnotationModel model = viewer.getAnnotationModel();
+
if (model == null)
return null;
-
- List<Annotation> exact= new ArrayList<>();
- List<Annotation> including= new ArrayList<>();
-
+
+ List<Annotation> exact = new ArrayList<>();
+ List<Annotation> including = new ArrayList<>();
+
Iterator<Annotation> e = model.getAnnotationIterator();
while (e.hasNext()) {
Annotation a = e.next();
@@ -107,7 +106,7 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov
break;
}
}
-
+
return select(exact, including);
}
@@ -115,35 +114,35 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
List<Annotation> annotations = getAnnotationsForLine(sourceViewer, lineNumber);
if (annotations != null && annotations.size() > 0) {
-
+
if (annotations.size() == 1) {
-
+
// optimization
Annotation annotation = annotations.get(0);
- String message= annotation.getText();
+ String message = annotation.getText();
if (message != null && message.trim().length() > 0)
return formatSingleMessage(message);
-
+
} else {
-
- List<String> messages= new ArrayList<>();
-
- Iterator<Annotation> e= annotations.iterator();
+
+ List<String> messages = new ArrayList<>();
+
+ Iterator<Annotation> e = annotations.iterator();
while (e.hasNext()) {
Annotation annotation = e.next();
- String message= annotation.getText();
+ String message = annotation.getText();
if (message != null && message.trim().length() > 0)
messages.add(message.trim());
}
-
+
if (messages.size() == 1)
return formatSingleMessage(messages.get(0));
-
+
if (messages.size() > 1)
return formatMultipleMessages(messages);
}
}
-
+
return null;
}
@@ -151,36 +150,36 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov
* Formats a message as HTML text.
*/
private String formatSingleMessage(String message) {
- StringBuilder buffer= new StringBuilder();
+ StringBuilder buffer = new StringBuilder();
HTMLPrinter.addPageProlog(buffer);
HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(message));
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
-
+
/*
* Formats several message as HTML text.
*/
private String formatMultipleMessages(List<String> messages) {
- StringBuilder buffer= new StringBuilder();
+ StringBuilder buffer = new StringBuilder();
HTMLPrinter.addPageProlog(buffer);
- HTMLPrinter.addParagraph(buffer, HTMLPrinter.convertToHTMLContent(AutoconfEditorMessages.getString("AutoconfAnnotationHover.multipleMarkers"))); //$NON-NLS-1$
-
+ HTMLPrinter.addParagraph(buffer, HTMLPrinter
+ .convertToHTMLContent(AutoconfEditorMessages.getString("AutoconfAnnotationHover.multipleMarkers"))); //$NON-NLS-1$
+
HTMLPrinter.startBulletList(buffer);
- Iterator<String> e= messages.iterator();
+ Iterator<String> e = messages.iterator();
while (e.hasNext())
HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent(e.next()));
- HTMLPrinter.endBulletList(buffer);
-
+ HTMLPrinter.endBulletList(buffer);
+
HTMLPrinter.addPageEpilog(buffer);
return buffer.toString();
}
-
+
// IAnnotationHoverExtension members
// We need to use the extension to get a Hover Control Creator which
// handles html.
-
-
+
@Override
public IInformationControlCreator getHoverControlCreator() {
return new IInformationControlCreator() {
@@ -190,17 +189,17 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov
}
};
}
-
+
@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 81f3bec921d..a975e2a7850 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
@@ -24,31 +24,25 @@ import org.eclipse.jface.text.rules.MultiLineRule;
import org.eclipse.jface.text.rules.WhitespaceRule;
import org.eclipse.jface.text.rules.WordRule;
-
public class MakefileCodeScanner extends AbstractMakefileCodeScanner {
private final static String[] keywords = { "define", "endef", "ifdef", "ifndef", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "ifeq", "ifneq", "else", "endif", "include", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "-include", "sinclude", "override", "endef", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "export", "unexport", "vpath" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "ifeq", "ifneq", "else", "endif", "include", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "-include", "sinclude", "override", "endef", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "export", "unexport", "vpath" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
};
private final static String[] functions = { "subst", "patsubst", "strip", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "findstring", "filter", "sort", "dir", "notdir", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "suffix", "basename", "addsuffix", "addprefix", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "join", "word", "words", "wordlist", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "firstword", "wildcard", "error", "warning", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "shell", "origin", "foreach", "call" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "findstring", "filter", "sort", "dir", "notdir", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "suffix", "basename", "addsuffix", "addprefix", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "join", "word", "words", "wordlist", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "firstword", "wildcard", "error", "warning", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "shell", "origin", "foreach", "call" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
};
- static final String[] fTokenProperties = new String[] {
- ColorManager.MAKE_COMMENT_COLOR,
- ColorManager.MAKE_KEYWORD_COLOR,
- ColorManager.MAKE_FUNCTION_COLOR,
- ColorManager.MAKE_MACRO_REF_COLOR,
- ColorManager.MAKE_MACRO_DEF_COLOR,
- ColorManager.MAKE_DEFAULT_COLOR
- };
+ static final String[] fTokenProperties = new String[] { ColorManager.MAKE_COMMENT_COLOR,
+ ColorManager.MAKE_KEYWORD_COLOR, ColorManager.MAKE_FUNCTION_COLOR, ColorManager.MAKE_MACRO_REF_COLOR,
+ ColorManager.MAKE_MACRO_DEF_COLOR, ColorManager.MAKE_DEFAULT_COLOR };
/**
* Constructor for MakefileCodeScanner
@@ -57,7 +51,7 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner {
super();
initialize();
}
-
+
@Override
protected List<IRule> createRules() {
IToken keyword = getToken(ColorManager.MAKE_KEYWORD_COLOR);
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 e8aaaf58008..0c1da80a50c 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
@@ -36,7 +36,6 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorPart;
-
/**
* MakefileCompletionProcessor
*/
@@ -66,7 +65,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
}
}
- public static class DirectiveComparator implements Comparator<Object>{
+ public static class DirectiveComparator implements Comparator<Object> {
@Override
public int compare(Object o1, Object o2) {
@@ -74,26 +73,27 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
String name2;
if (o1 instanceof IMacroDefinition) {
- name1 = ((IMacroDefinition)o1).getName();
+ name1 = ((IMacroDefinition) o1).getName();
} else if (o1 instanceof IRule) {
- name1 = ((IRule)o1).getTarget().toString();
+ name1 = ((IRule) o1).getTarget().toString();
} else {
- name1 =""; //$NON-NLS-1$
+ name1 = ""; //$NON-NLS-1$
}
if (o2 instanceof IMacroDefinition) {
- name2 = ((IMacroDefinition)o1).getName();
+ name2 = ((IMacroDefinition) o1).getName();
} else if (o2 instanceof IRule) {
- name2 = ((IRule)o1).getTarget().toString();
+ name2 = ((IRule) o1).getTarget().toString();
} else {
- name2 =""; //$NON-NLS-1$
+ name2 = ""; //$NON-NLS-1$
}
//return String.CASE_INSENSITIVE_ORDER.compare(name1, name2);
return name1.compareToIgnoreCase(name2);
}
-
+
}
+
protected IContextInformationValidator fValidator = new Validator();
protected Image imageMacro = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_MACRO);
protected Image imageTarget = MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE);
@@ -104,7 +104,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
public MakefileCompletionProcessor(IEditorPart editor) {
fEditor = editor;
- fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
}
@Override
@@ -133,7 +133,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
if (statements[i] instanceof IMacroDefinition) {
name = ((IMacroDefinition) statements[i]).getName();
image = imageMacro;
- infoString = ((IMacroDefinition)statements[i]).getValue().toString();
+ infoString = ((IMacroDefinition) statements[i]).getValue().toString();
} else if (statements[i] instanceof IRule) {
name = ((IRule) statements[i]).getTarget().toString();
image = imageTarget;
@@ -142,16 +142,8 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
if (name != null && name.startsWith(wordPart.toString())) {
IContextInformation info = new ContextInformation(name, infoString);
String displayString = (name.equals(infoString) ? name : name + " - " + infoString); //$NON-NLS-1$
- ICompletionProposal result =
- new CompletionProposal(
- name,
- wordPart.getOffset(),
- wordPart.toString().length(),
- name.length(),
- image,
- displayString,
- info,
- infoString);
+ ICompletionProposal result = new CompletionProposal(name, wordPart.getOffset(),
+ wordPart.toString().length(), name.length(), image, displayString, info, infoString);
proposalList.add(result);
}
}
@@ -169,13 +161,13 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor {
if (macro) {
IMacroDefinition[] statements = makefile.getMacroDefinitions();
for (int i = 0; i < statements.length; i++) {
- String name = statements[i].getName();
- if (name != null && name.equals(wordPart.toString())) {
- String value = statements[i].getValue().toString();
- if (value != null && value.length() > 0) {
- contextList.add(value);
- }
+ String name = statements[i].getName();
+ if (name != null && name.equals(wordPart.toString())) {
+ String value = statements[i].getValue().toString();
+ if (value != null && value.length() > 0) {
+ contextList.add(value);
}
+ }
}
statements = makefile.getBuiltinMacroDefinitions();
for (int i = 0; i < statements.length; i++) {
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 90051cb4849..09b1076ac7b 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
@@ -49,7 +49,6 @@ import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-
/**
* MakefileContentOutlinePage
*/
@@ -80,7 +79,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
if (element instanceof IMakefile) {
return fInput;
} else if (element instanceof IDirective) {
- return ((IDirective)element).getParent();
+ return ((IDirective) element).getParent();
}
return fInput;
}
@@ -105,12 +104,12 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
if (inputElement == fInput) {
directives = makefile.getDirectives();
} else if (inputElement instanceof IRule) {
- directives = ((IRule)inputElement).getCommands();
+ directives = ((IRule) inputElement).getCommands();
} else if (inputElement instanceof IParent) {
if (inputElement instanceof IInclude && !showIncludeChildren) {
directives = new IDirective[0];
} else {
- directives = ((IParent)inputElement).getDirectives();
+ directives = ((IParent) inputElement).getDirectives();
}
} else {
directives = new IDirective[0];
@@ -124,9 +123,8 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
} else if (showTargetRule && directives[i] instanceof ITargetRule) {
list.add(directives[i]);
} else {
- boolean irrelevant = (directives[i] instanceof IComment ||
- directives[i] instanceof IEmptyLine ||
- directives[i] instanceof ITerminal);
+ boolean irrelevant = (directives[i] instanceof IComment || directives[i] instanceof IEmptyLine
+ || directives[i] instanceof ITerminal);
if (!irrelevant) {
list.add(directives[i]);
}
@@ -146,8 +144,8 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
}
if (newInput != null) {
- IWorkingCopyManager manager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
- makefile = manager.getWorkingCopy((IEditorInput)newInput);
+ IWorkingCopyManager manager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ makefile = manager.getWorkingCopy((IEditorInput) newInput);
if (makefile == null) {
makefile = nullMakefile;
}
@@ -219,7 +217,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
viewer.setInput(fInput);
}
- MenuManager manager= new MenuManager("#MakefileOutlinerContext"); //$NON-NLS-1$
+ MenuManager manager = new MenuManager("#MakefileOutlinerContext"); //$NON-NLS-1$
manager.setRemoveAllWhenShown(true);
manager.addMenuListener(m -> contextMenuAboutToShow(m));
Control tree = viewer.getControl();
@@ -232,7 +230,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
}
});
- IPageSite site= getSite();
+ IPageSite site = getSite();
//FIXME: should pluginid below be MakeUIPlugin id?
site.registerContextMenu(AutotoolsUIPlugin.getPluginId() + ".outline", manager, viewer); //$NON-NLS-1$
site.setSelectionProvider(viewer);
@@ -247,7 +245,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
menu.add(fOpenIncludeAction);
}
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end"));//$NON-NLS-1$
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "-end"));//$NON-NLS-1$
}
/**
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 71b7a86876b..d01b85ca87d 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
@@ -28,10 +28,10 @@ import org.eclipse.ui.editors.text.TextFileDocumentProvider;
import org.eclipse.ui.texteditor.IDocumentProvider;
public class MakefileDocumentProvider extends TextFileDocumentProvider implements IMakefileDocumentProvider {
-
+
IMakefile fMakefile;
- protected class MakefileAnnotationModel extends AnnotationModel /*implements IProblemRequestor */{
+ protected class MakefileAnnotationModel extends AnnotationModel /*implements IProblemRequestor */ {
/**
* @param resource
*/
@@ -50,13 +50,14 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
/**
* Remembers a IMakefile for each element.
*/
- protected class MakefileFileInfo extends FileInfo {
+ protected class MakefileFileInfo extends FileInfo {
public IMakefile fCopy;
}
public MakefileDocumentProvider() {
- IDocumentProvider provider= new TextFileDocumentProvider(new MakefileStorageDocumentProvider());
- provider= new ForwardingDocumentProvider(MakefileDocumentSetupParticipant.MAKEFILE_PARTITIONING, new MakefileDocumentSetupParticipant(), provider);
+ IDocumentProvider provider = new TextFileDocumentProvider(new MakefileStorageDocumentProvider());
+ provider = new ForwardingDocumentProvider(MakefileDocumentSetupParticipant.MAKEFILE_PARTITIONING,
+ new MakefileDocumentSetupParticipant(), provider);
setParentDocumentProvider(provider);
}
@@ -69,57 +70,57 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
return null;
}
- @Override
+ @Override
protected IAnnotationModel createAnnotationModel(IFile file) {
- return new MakefileAnnotationModel(file);
- }
+ return new MakefileAnnotationModel(file);
+ }
@Override
protected FileInfo createFileInfo(Object element) throws CoreException {
if (!(element instanceof IFileEditorInput))
return null;
-
- IFileEditorInput input= (IFileEditorInput) element;
- IMakefile original= createMakefile(input.getFile());
+
+ IFileEditorInput input = (IFileEditorInput) element;
+ IMakefile original = createMakefile(input.getFile());
if (original == null)
return null;
- FileInfo info= super.createFileInfo(element);
+ FileInfo info = super.createFileInfo(element);
if (!(info instanceof MakefileFileInfo)) {
return null;
}
-
- MakefileFileInfo makefileInfo= (MakefileFileInfo) info;
+
+ MakefileFileInfo makefileInfo = (MakefileFileInfo) info;
setUpSynchronization(makefileInfo);
makefileInfo.fCopy = original;
- if (makefileInfo.fModel instanceof MakefileAnnotationModel) {
- MakefileAnnotationModel model= (MakefileAnnotationModel) makefileInfo.fModel;
+ if (makefileInfo.fModel instanceof MakefileAnnotationModel) {
+ MakefileAnnotationModel model = (MakefileAnnotationModel) makefileInfo.fModel;
model.setMakefile(makefileInfo.fCopy);
- }
+ }
return makefileInfo;
}
-
- @Override
+
+ @Override
protected void disposeFileInfo(Object element, FileInfo info) {
- if (info instanceof MakefileFileInfo) {
- MakefileFileInfo makefileInfo= (MakefileFileInfo) info;
- if (makefileInfo.fCopy != null) {
- makefileInfo.fCopy = null;
- }
- }
- super.disposeFileInfo(element, info);
- }
-
+ if (info instanceof MakefileFileInfo) {
+ MakefileFileInfo makefileInfo = (MakefileFileInfo) info;
+ if (makefileInfo.fCopy != null) {
+ makefileInfo.fCopy = null;
+ }
+ }
+ super.disposeFileInfo(element, info);
+ }
+
@Override
protected FileInfo createEmptyFileInfo() {
return new MakefileFileInfo();
}
-
+
@Override
public IMakefile getWorkingCopy(Object element) {
- FileInfo fileInfo= getFileInfo(element);
+ FileInfo fileInfo = getFileInfo(element);
if (fileInfo instanceof MakefileFileInfo) {
return ((MakefileFileInfo) fileInfo).fCopy;
}
@@ -132,5 +133,5 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
while (e.hasNext())
disconnect(e.next());
}
-
+
}
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 a26ad71df1e..3b73fecb57a 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
@@ -24,28 +24,27 @@ import org.eclipse.jface.text.rules.FastPartitioner;
* MakefileDocumentSetupParticipant
* The document setup participant for Ant.
*/
-public class MakefileDocumentSetupParticipant implements IDocumentSetupParticipant {
-
+public class MakefileDocumentSetupParticipant implements IDocumentSetupParticipant {
+
/**
* The name of the Makefile partitioning.
*/
- public final static String MAKEFILE_PARTITIONING= "___makefile_partitioning"; //$NON-NLS-1$
-
+ public final static String MAKEFILE_PARTITIONING = "___makefile_partitioning"; //$NON-NLS-1$
+
public MakefileDocumentSetupParticipant() {
}
-
+
@Override
public void setup(IDocument document) {
if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
+ IDocumentExtension3 extension3 = (IDocumentExtension3) document;
IDocumentPartitioner partitioner = createDocumentPartitioner();
extension3.setDocumentPartitioner(MAKEFILE_PARTITIONING, partitioner);
partitioner.connect(document);
- }
+ }
}
-
+
private IDocumentPartitioner createDocumentPartitioner() {
- return new FastPartitioner(
- new MakefilePartitionScanner(), MakefilePartitionScanner.MAKE_PARTITIONS);
+ return new FastPartitioner(new MakefilePartitionScanner(), MakefilePartitionScanner.MAKE_PARTITIONS);
}
}
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 72aa0fcb0cd..1b7c94f6fb6 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
@@ -56,7 +56,6 @@ import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.TextOperationAction;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
public class MakefileEditor extends TextEditor implements ISelectionChangedListener, IReconcilingParticipant {
/**
@@ -73,11 +72,10 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
*/
private ListenerList<IReconcilingParticipant> fReconcilingListeners = new ListenerList<>(ListenerList.IDENTITY);
-
MakefileSourceConfiguration getMakefileSourceConfiguration() {
SourceViewerConfiguration configuration = getSourceViewerConfiguration();
if (configuration instanceof MakefileSourceConfiguration) {
- return (MakefileSourceConfiguration)configuration;
+ return (MakefileSourceConfiguration) configuration;
}
return null;
}
@@ -113,13 +111,14 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
public void dispose() {
if (fProjectionMakefileUpdater != null) {
fProjectionMakefileUpdater.uninstall();
- fProjectionMakefileUpdater= null;
+ fProjectionMakefileUpdater = null;
}
super.dispose();
}
boolean isFoldingEnabled() {
- return AutotoolsPlugin.getDefault().getPreferenceStore().getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED);
+ return AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED);
}
@Override
@@ -142,9 +141,9 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
projectionViewer.doOperation(ProjectionViewer.TOGGLE);
}
-// ProjectionAnnotationModel model= (ProjectionAnnotationModel) getAdapter(ProjectionAnnotationModel.class);
+ // ProjectionAnnotationModel model= (ProjectionAnnotationModel) getAdapter(ProjectionAnnotationModel.class);
- fProjectionMakefileUpdater= new ProjectionMakefileUpdater();
+ fProjectionMakefileUpdater = new ProjectionMakefileUpdater();
if (fProjectionMakefileUpdater != null) {
fProjectionMakefileUpdater.install(this, projectionViewer);
fProjectionMakefileUpdater.initialize();
@@ -153,11 +152,12 @@ 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);
+ ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(),
+ styles);
// ensure decoration support has been created and configured.
getSourceViewerDecorationSupport(viewer);
-
+
return viewer;
}
@@ -191,7 +191,8 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
ResourceBundle bundle = MakeUIMessages.getResourceBundle();
- IAction a = new TextOperationAction(bundle, "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS); //$NON-NLS-1$
+ IAction a = new TextOperationAction(bundle, "ContentAssistProposal.", this, //$NON-NLS-1$
+ ISourceViewer.CONTENTASSIST_PROPOSALS);
a.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
setAction("ContentAssistProposal", a); //$NON-NLS-1$
@@ -203,7 +204,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
a.setActionDefinitionId(IMakefileEditorActionDefinitionIds.COMMENT);
setAction("Comment", a); //$NON-NLS-1$
markAsStateDependentAction("Comment", true); //$NON-NLS-1$
-
+
a = new TextOperationAction(bundle, "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX); //$NON-NLS-1$
a.setActionDefinitionId(IMakefileEditorActionDefinitionIds.UNCOMMENT);
setAction("Uncomment", a); //$NON-NLS-1$
@@ -221,13 +222,13 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
ISelection selection = event.getSelection();
if (selection.isEmpty()) {
resetHighlightRange();
- } else if (selection instanceof IStructuredSelection){
+ } else if (selection instanceof IStructuredSelection) {
if (!isActivePart() && AutotoolsUIPlugin.getActivePage() != null) {
AutotoolsUIPlugin.getActivePage().bringToTop(this);
- }
- Object element = ((IStructuredSelection) selection).getFirstElement();
+ }
+ Object element = ((IStructuredSelection) selection).getFirstElement();
if (element instanceof IDirective) {
- IDirective statement = (IDirective)element;
+ IDirective statement = (IDirective) element;
setSelection(statement, !isActivePart());
}
}
@@ -237,21 +238,21 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
* Returns whether the editor is active.
*/
private boolean isActivePart() {
- IWorkbenchWindow window= getSite().getWorkbenchWindow();
- IPartService service= window.getPartService();
- IWorkbenchPart part= service.getActivePart();
+ IWorkbenchWindow window = getSite().getWorkbenchWindow();
+ IPartService service = window.getPartService();
+ IWorkbenchPart part = service.getActivePart();
return part != null && part.equals(this);
}
/**
* Returns the find/replace document adapter.
- *
+ *
* @return the find/replace document adapter.
*/
private FindReplaceDocumentAdapter getFindRepalceDocumentAdapter() {
if (fFindReplaceDocumentAdapter == null) {
IDocument doc = getDocumentProvider().getDocument(getEditorInput());
- fFindReplaceDocumentAdapter= new FindReplaceDocumentAdapter(doc);
+ fFindReplaceDocumentAdapter = new FindReplaceDocumentAdapter(doc);
}
return fFindReplaceDocumentAdapter;
}
@@ -308,7 +309,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
/**
* Adds the given listener.
* Has no effect if an identical listener was not already registered.
- *
+ *
* @param listener The reconcile listener to be added
* @since 3.0
*/
@@ -317,11 +318,11 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
fReconcilingListeners.add(listener);
}
}
-
+
/**
* Removes the given listener.
* Has no effect if an identical listener was not already registered.
- *
+ *
* @param listener the reconcile listener to be removed
* @since 3.0
*/
@@ -330,65 +331,64 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
fReconcilingListeners.remove(listener);
}
}
-
+
@Override
- public void reconciled() {
+ public void reconciled() {
// Notify listeners
- for (IReconcilingParticipant listener: fReconcilingListeners) {
+ for (IReconcilingParticipant listener : fReconcilingListeners) {
listener.reconciled();
}
}
@Override
protected void performRevert() {
- ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
+ ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
projectionViewer.setRedraw(false);
try {
-
- boolean projectionMode= projectionViewer.isProjectionMode();
+
+ boolean projectionMode = projectionViewer.isProjectionMode();
if (projectionMode) {
- projectionViewer.disableProjection();
+ projectionViewer.disableProjection();
if (fProjectionMakefileUpdater != null)
fProjectionMakefileUpdater.uninstall();
}
-
+
super.performRevert();
-
+
if (projectionMode) {
if (fProjectionMakefileUpdater != null)
- fProjectionMakefileUpdater.install(this, projectionViewer);
+ fProjectionMakefileUpdater.install(this, projectionViewer);
projectionViewer.enableProjection();
}
-
+
} finally {
projectionViewer.setRedraw(true);
}
}
-
@Override
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
- ISourceViewer sourceViewer= getSourceViewer();
+ ISourceViewer sourceViewer = getSourceViewer();
if (sourceViewer == null)
return;
- String property = event.getProperty();
+ String property = event.getProperty();
- MakefileSourceConfiguration makeConf = getMakefileSourceConfiguration();
- if (makeConf != null) {
- if (makeConf.affectsBehavior(event)) {
- makeConf.adaptToPreferenceChange(event);
- sourceViewer.invalidateTextPresentation();
- }
- }
+ MakefileSourceConfiguration makeConf = getMakefileSourceConfiguration();
+ if (makeConf != null) {
+ if (makeConf.affectsBehavior(event)) {
+ makeConf.adaptToPreferenceChange(event);
+ sourceViewer.invalidateTextPresentation();
+ }
+ }
- if (MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) {
+ if (MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) {
if (sourceViewer instanceof ProjectionViewer) {
- ProjectionViewer projectionViewer= (ProjectionViewer) sourceViewer;
+ ProjectionViewer projectionViewer = (ProjectionViewer) sourceViewer;
if (fProjectionMakefileUpdater != null)
fProjectionMakefileUpdater.uninstall();
// either freshly enabled or provider changed
- fProjectionMakefileUpdater= new ProjectionMakefileUpdater();
+ fProjectionMakefileUpdater = new ProjectionMakefileUpdater();
if (fProjectionMakefileUpdater != null) {
fProjectionMakefileUpdater.install(this, projectionViewer);
}
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 5babe2a1235..f0352083a70 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
@@ -28,7 +28,6 @@ import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.RetargetTextEditorAction;
-
/**
*/
public class MakefileEditorActionContributor extends BasicTextEditorActionContributor {
@@ -50,7 +49,7 @@ public class MakefileEditorActionContributor extends BasicTextEditorActionContri
fContentAssistTip.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
fTogglePresentation = new MakefileEditorTogglePresentationAction();
fOpenDeclarationAction = new OpenDeclarationAction();
-
+
}
@Override
@@ -72,7 +71,7 @@ public class MakefileEditorActionContributor extends BasicTextEditorActionContri
fTogglePresentation.setEditor(editor);
fTogglePresentation.update();
-
+
fOpenDeclarationAction.setEditor(editor);
fOpenDeclarationAction.update();
}
@@ -95,14 +94,15 @@ public class MakefileEditorActionContributor extends BasicTextEditorActionContri
editMenu.add(fOpenDeclarationAction);
}
- bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY, fTogglePresentation);
+ bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY,
+ fTogglePresentation);
// there is a global action in the toolbar, that is retargeted,
// there is no need to add another one.
-// IToolBarManager toolBarManager = bars.getToolBarManager();
-// if (toolBarManager != null) {
-// toolBarManager.add(new Separator());
-// toolBarManager.add(fTogglePresentation);
-// }
+ // IToolBarManager toolBarManager = bars.getToolBarManager();
+ // if (toolBarManager != null) {
+ // toolBarManager.add(new Separator());
+ // toolBarManager.add(fTogglePresentation);
+ // }
}
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorPreferenceConstants.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorPreferenceConstants.java
index b30dda73b1a..46a966ebd02 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorPreferenceConstants.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileEditorPreferenceConstants.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
public class MakefileEditorPreferenceConstants {
/**
- *
+ *
*/
private MakefileEditorPreferenceConstants() {
}
@@ -33,30 +33,27 @@ public class MakefileEditorPreferenceConstants {
*/
public static final String CURRENT_LINE_COLOR = "org.eclipse.cdt.make.ui.currentLineHightlightColor"; //$NON-NLS-1$
public static final String LINE_NUMBER_RULER_COLOR = "org.eclipse.cdt.make.ui.lineNumberForegroundColor"; //$NON-NLS-1$
- public static final String PRINT_MARGIN_COLOR = "org.eclipse.cdt.make.ui.printMarginColor"; //$NON-NLS-1$
-
+ public static final String PRINT_MARGIN_COLOR = "org.eclipse.cdt.make.ui.printMarginColor"; //$NON-NLS-1$
+
/**
* Preference key suffix for bold text style preference keys.
- *
+ *
*/
- public static final String EDITOR_BOLD_SUFFIX= "_bold"; //$NON-NLS-1$
+ public static final String EDITOR_BOLD_SUFFIX = "_bold"; //$NON-NLS-1$
/**
* Preference key suffix for italic text style preference keys.
*/
- public static final String EDITOR_ITALIC_SUFFIX= "_italic"; //$NON-NLS-1$
-
+ public static final String EDITOR_ITALIC_SUFFIX = "_italic"; //$NON-NLS-1$
public static final String EDITOR_FOLDING_MACRODEF = "editor_folding_default_macrodef"; //$NON-NLS-1$
-
public static final String EDITOR_FOLDING_RULE = "editor_folding_default_rule"; //$NON-NLS-1$
-
public static final String EDITOR_FOLDING_CONDITIONAL = "editor_folding_default_conditional"; //$NON-NLS-1$
public static final String EDITOR_FOLDING_ENABLED = "editor_folding_enabled"; //$NON-NLS-1$
-
+
public static void initializeDefaultValues(IPreferenceStore store) {
store.setDefault(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED, false);
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 59fc131d881..87f1a50dbe0 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
@@ -19,7 +19,6 @@ import org.eclipse.cdt.internal.autotools.ui.MakeUIMessages;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction;
-
/**
*/
public class MakefileEditorTogglePresentationAction extends TextEditorAction {
@@ -35,7 +34,7 @@ public class MakefileEditorTogglePresentationAction extends TextEditorAction {
@Override
public void run() {
- ITextEditor editor= getTextEditor();
+ ITextEditor editor = getTextEditor();
editor.resetHighlightRange();
boolean show = editor.showsHighlightRangeOnly();
setChecked(!show);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileMessages.java
index dfe170a3b9d..951c7d0b6ba 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileMessages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/MakefileMessages.java
@@ -19,43 +19,42 @@ import java.util.ResourceBundle;
public class MakefileMessages {
- private static final String BUNDLE_NAME = MakefileMessages.class.getName();
+ private static final String BUNDLE_NAME = MakefileMessages.class.getName();
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
- private MakefileMessages() {
- }
+ private MakefileMessages() {
+ }
public static ResourceBundle getResourceBundle() {
return RESOURCE_BUNDLE;
}
-
+
/**
* Returns the string from the plugin's resource bundle,
* or 'key' if not found.
- *
+ *
* @param key the message key
* @return the resource bundle message
*/
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+
/**
* Returns the string from the plugin's resource bundle,
* or 'key' if not found.
- *
+ *
* @param key the message key
* @param args an array of substitution strings
* @return the resource bundle message
*/
public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getString(key), (Object[])args);
+ return MessageFormat.format(getString(key), (Object[]) args);
}
}
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 4dfce01a352..cab5a77b6c3 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
@@ -33,15 +33,9 @@ public class MakefilePartitionScanner extends RuleBasedPartitionScanner {
public final static String MAKEFILE_DEF_BLOCK_PARTITION = "makefile_def_block"; //$NON-NLS-1$
public final static String MAKEFILE_OTHER_PARTITION = "makefile_other"; //$NON-NLS-1$
- final static String[] MAKE_PARTITIONS =
- new String[] {
- MAKEFILE_COMMENT_PARTITION,
- MAKEFILE_MACRO_ASSIGNEMENT_PARTITION,
- MAKEFILE_INCLUDE_BLOCK_PARTITION,
- MAKEFILE_IF_BLOCK_PARTITION,
- MAKEFILE_DEF_BLOCK_PARTITION,
- MAKEFILE_OTHER_PARTITION,
- };
+ final static String[] MAKE_PARTITIONS = new String[] { MAKEFILE_COMMENT_PARTITION,
+ MAKEFILE_MACRO_ASSIGNEMENT_PARTITION, MAKEFILE_INCLUDE_BLOCK_PARTITION, MAKEFILE_IF_BLOCK_PARTITION,
+ MAKEFILE_DEF_BLOCK_PARTITION, MAKEFILE_OTHER_PARTITION, };
/** The predefined delimiters of this tracker */
private char[][] fModDelimiters = { { '\r', '\n' }, { '\r' }, { '\n' } };
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 9c8213a40db..bbd0c1225e2 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
@@ -21,7 +21,6 @@ import java.io.Reader;
*/
public class MakefileReader extends LineNumberReader {
-
public MakefileReader(Reader reader) {
super(reader);
}
@@ -30,7 +29,6 @@ public class MakefileReader extends LineNumberReader {
super(reader, sz);
}
-
@Override
public String readLine() throws IOException {
boolean done = false;
@@ -47,7 +45,7 @@ public class MakefileReader extends LineNumberReader {
// Eat the spaces at the beginning.
int i = 0;
while (i < line.length() && (Util.isSpace(line.charAt(i)))) {
- i++ ;
+ i++;
}
line = line.substring(i);
} else if (escapedCommand && line.length() > 0) {
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 923fbd41020..e978b6152dd 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
@@ -27,39 +27,35 @@ import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
-
-
public class MakefileReconcilingStrategy implements IReconcilingStrategy {
-
private int fLastRegionOffset;
- private ITextEditor fEditor;
+ private ITextEditor fEditor;
private IWorkingCopyManager fManager;
private IDocumentProvider fDocumentProvider;
private MakefileContentOutlinePage fOutliner;
private IReconcilingParticipant fMakefileReconcilingParticipant;
public MakefileReconcilingStrategy(MakefileEditor editor) {
- fOutliner= editor.getOutlinePage();
+ fOutliner = editor.getOutlinePage();
fLastRegionOffset = Integer.MAX_VALUE;
- fEditor= editor;
- fManager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
- fDocumentProvider= AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
- fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor;
+ fEditor = editor;
+ fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ fDocumentProvider = AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
+ fMakefileReconcilingParticipant = (IReconcilingParticipant) fEditor;
}
-
+
@Override
public void setDocument(IDocument document) {
- }
-
+ }
@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
- // multiple times with different regions of the file, we do a
+ // multiple times with different regions of the file, we do a
// complete parse on the first region.
- if(region.getOffset() <= fLastRegionOffset) {
+ if (region.getOffset() <= fLastRegionOffset) {
reconcile();
}
fLastRegionOffset = region.getOffset();
@@ -71,7 +67,7 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy {
// the contentouline viewer.
//reconcile();
}
-
+
private void reconcile() {
try {
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
@@ -82,7 +78,7 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy {
makefile.parse(makefile.getFileURI(), reader);
} catch (IOException e) {
}
-
+
fOutliner.update();
}
} finally {
@@ -94,5 +90,5 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy {
//
}
}
- }
+ }
}
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 d6e1a28b6c3..daad4961c26 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
@@ -35,7 +35,6 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-
public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
private ColorManager colorManager;
@@ -62,14 +61,11 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
@Override
public String[] getConfiguredContentTypes(ISourceViewer v) {
- return new String[] {
- IDocument.DEFAULT_CONTENT_TYPE,
- MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION,
- MakefilePartitionScanner.MAKEFILE_IF_BLOCK_PARTITION,
- MakefilePartitionScanner.MAKEFILE_DEF_BLOCK_PARTITION,
- MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK_PARTITION,
- MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT_PARTITION,
- };
+ return new String[] { IDocument.DEFAULT_CONTENT_TYPE, MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION,
+ MakefilePartitionScanner.MAKEFILE_IF_BLOCK_PARTITION,
+ MakefilePartitionScanner.MAKEFILE_DEF_BLOCK_PARTITION,
+ MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK_PARTITION,
+ MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT_PARTITION, };
}
@@ -77,11 +73,16 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
ContentAssistant assistant = new ContentAssistant();
assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), IDocument.DEFAULT_CONTENT_TYPE);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_DEF_BLOCK_PARTITION);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_IF_BLOCK_PARTITION);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK_PARTITION);
- assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor), MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT_PARTITION);
+ assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor),
+ MakefilePartitionScanner.MAKEFILE_COMMENT_PARTITION);
+ assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor),
+ MakefilePartitionScanner.MAKEFILE_DEF_BLOCK_PARTITION);
+ assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor),
+ MakefilePartitionScanner.MAKEFILE_IF_BLOCK_PARTITION);
+ assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor),
+ MakefilePartitionScanner.MAKEFILE_INCLUDE_BLOCK_PARTITION);
+ assistant.setContentAssistProcessor(new MakefileCompletionProcessor(fEditor),
+ MakefilePartitionScanner.MAKEFILE_MACRO_ASSIGNEMENT_PARTITION);
assistant.enableAutoActivation(true);
assistant.setAutoActivationDelay(500);
@@ -140,7 +141,7 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (fEditor != null && fEditor.isEditable()) {
- MonoReconciler reconciler= new MonoReconciler(new MakefileReconcilingStrategy(fEditor), false);
+ MonoReconciler reconciler = new MonoReconciler(new MakefileReconcilingStrategy(fEditor), false);
reconciler.setDelay(1000);
reconciler.setProgressMonitor(new NullProgressMonitor());
return reconciler;
@@ -150,13 +151,14 @@ public class MakefileSourceConfiguration extends TextSourceViewerConfiguration {
@Override
public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType) {
- return new String[]{"#"}; //$NON-NLS-1$
+ return new String[] { "#" }; //$NON-NLS-1$
}
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
return new MakefileTextHover(fEditor);
}
+
@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 e27a41b52f6..f5d1966378e 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
@@ -28,9 +28,9 @@ public class MakefileStorageDocumentProvider extends StorageDocumentProvider {
@Override
protected void setupDocument(Object element, IDocument document) {
if (document != null) {
- IDocumentPartitioner partitioner= createDocumentPartitioner();
+ IDocumentPartitioner partitioner = createDocumentPartitioner();
if (document instanceof IDocumentExtension3) {
- IDocumentExtension3 extension3= (IDocumentExtension3) document;
+ IDocumentExtension3 extension3 = (IDocumentExtension3) document;
extension3.setDocumentPartitioner(MakefileDocumentSetupParticipant.MAKEFILE_PARTITIONING, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
@@ -38,10 +38,9 @@ public class MakefileStorageDocumentProvider extends StorageDocumentProvider {
partitioner.connect(document);
}
}
-
+
private IDocumentPartitioner createDocumentPartitioner() {
- return new FastPartitioner(
- new MakefilePartitionScanner(), MakefilePartitionScanner.MAKE_PARTITIONS);
+ return new FastPartitioner(new MakefilePartitionScanner(), MakefilePartitionScanner.MAKE_PARTITIONS);
}
}
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 d08c03de15b..959c705024b 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
@@ -26,17 +26,16 @@ import org.eclipse.jface.text.Region;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.IEditorPart;
-
/**
* MakefileTextHover
- *
+ *
*/
public class MakefileTextHover implements ITextHover {
private IEditorPart fEditor;
/**
- *
+ *
*/
public MakefileTextHover(IEditorPart editor) {
fEditor = editor;
@@ -62,7 +61,7 @@ public class MakefileTextHover implements ITextHover {
statements = makefile.getBuiltinMacroDefinitions(name);
}
}
-
+
if (statements == null) {
statements = new IMacroDefinition[0];
}
@@ -75,7 +74,7 @@ public class MakefileTextHover implements ITextHover {
String infoString = statements[i].getValue().toString();
buffer.append(name);
buffer.append(" - "); //$NON-NLS-1$
- buffer.append(infoString);
+ buffer.append(infoString);
}
return buffer.toString();
}
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 6e4fd38da12..6fb21f98b08 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
@@ -22,8 +22,8 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
/**
- * A message line. It distinguishs between "normal" messages and errors.
- * Setting an error message hides a currently displayed message until
+ * A message line. It distinguishs between "normal" messages and errors.
+ * Setting an error message hides a currently displayed message until
* <code>clearErrorMessage</code> is called.
*/
public class MessageLine {
@@ -36,7 +36,7 @@ public class MessageLine {
private RGB fErrorRGB;
protected Color fErrorColor;
- private static RGB fgErrorRGB= new RGB(200, 0, 0);
+ private static RGB fgErrorRGB = new RGB(200, 0, 0);
/**
* Clears the currently displayed error message and redisplayes
@@ -45,12 +45,14 @@ public class MessageLine {
public void clearErrorMessage() {
setErrorMessage(null);
}
+
/**
* Clears the currently displayed message.
*/
public void clearMessage() {
setMessage(null);
}
+
/**
* Get the currently displayed error text.
* @return The error message. If no error message is displayed <code>null</code> is returned.
@@ -58,6 +60,7 @@ public class MessageLine {
public String getErrorMessage() {
return fErrorText;
}
+
/**
* Get the currently displayed message.
* @return The message. If no message is displayed <code>null<code> is returned.
@@ -65,24 +68,27 @@ public class MessageLine {
public String getMessage() {
return fMessageText;
}
+
/**
* Creates a new message line as a child of the parent and with the given SWT stylebits.
* Error message will be shown with in the given rgb color.
*/
public MessageLine(Composite parent, int style, RGB errorRGB) {
clabel = new CLabel(parent, style);
- fDefaultColor= clabel.getForeground();
- fErrorRGB= errorRGB;
+ fDefaultColor = clabel.getForeground();
+ fErrorRGB = errorRGB;
}
+
/**
* Creates a new message line as a child of the parent and with the given SWT stylebits.
* Error message will be shown with in the rgb color 200,0,0.
*/
public MessageLine(Composite parent, int style) {
clabel = new CLabel(parent, style);
- fDefaultColor= clabel.getForeground();
- fErrorRGB= fgErrorRGB;
+ fDefaultColor = clabel.getForeground();
+ fErrorRGB = fgErrorRGB;
}
+
/**
* Creates a new message line as a child of the given parent.
* Error message will be shown with in the rgb color 200,0,0.
@@ -90,55 +96,58 @@ public class MessageLine {
public MessageLine(Composite parent) {
this(parent, SWT.LEFT);
}
+
/**
* Sets the default error color used by all message lines.
- * Note: a call to this method only affects newly created MessageLines not existing ones.
+ * Note: a call to this method only affects newly created MessageLines not existing ones.
*/
public static void setErrorColor(RGB color) {
- fgErrorRGB= color;
+ fgErrorRGB = color;
}
+
/**
* Display the given error message. A currently displayed message
* is saved and will be redisplayed when the error message is cleared.
*/
public void setErrorMessage(String message) {
- fErrorText= message;
+ fErrorText = message;
if (message == null) {
setMessage(fMessageText);
} else {
if (fErrorColor == null) {
- fErrorColor= new Color(clabel.getDisplay(), fErrorRGB);
+ fErrorColor = new Color(clabel.getDisplay(), fErrorRGB);
clabel.addDisposeListener(e -> fErrorColor.dispose());
}
clabel.setForeground(fErrorColor);
clabel.setText(message);
}
}
+
/**
* Set the message text. If the message line currently displays an error,
* the message is stored and will be shown after a call to clearErrorMessage
*/
public void setMessage(String message) {
- fMessageText= message;
+ fMessageText = message;
if (message == null)
- message= ""; //$NON-NLS-1$
+ message = ""; //$NON-NLS-1$
if (fErrorText == null) {
clabel.setForeground(fDefaultColor);
clabel.setText(message);
}
}
-
+
public boolean isDisposed() {
return clabel.isDisposed();
}
-
+
public void setAlignment(int left) {
clabel.setAlignment(left);
}
-
+
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 e9c1d47d4ca..bd461cee641 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
@@ -25,15 +25,15 @@ import org.eclipse.cdt.make.core.makefile.IDirective;
* statement : rule | macro_definition | comments | empty
* rule : inference_rule | target_rule
* inference_rule : target ':' <nl> ( <tab> command <nl> ) +
- * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
+ * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
[ ( command ) * ]
- * macro_definition : string '=' (string)*
+ * macro_definition : string '=' (string)*
* comments : ('#' (string) <nl>) *
* empty : <nl>
* command : <tab> prefix_command string <nl>
* target : string
* prefix_command : '-' | '@' | '+'
- * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
+ * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
*/
public class NullMakefile extends AbstractMakefile {
@@ -65,11 +65,11 @@ public class NullMakefile extends AbstractMakefile {
@Override
public void parse(String name, Reader makefile) {
}
-
+
@Override
public void parse(URI fileURI, Reader reader) {
}
-
+
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 3cffacf147b..e5463865112 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
@@ -38,7 +38,6 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction;
-
public class OpenDeclarationAction extends TextEditorAction {
public OpenDeclarationAction() {
@@ -96,7 +95,7 @@ public class OpenDeclarationAction extends TextEditorAction {
if (p != null) {
IEditorPart editorPart = IDE.openEditor(p, file, true);
if (editorPart instanceof MakefileEditor) {
- ((MakefileEditor)editorPart).setSelection(directive, true);
+ ((MakefileEditor) editorPart).setSelection(directive, true);
}
return editorPart;
}
@@ -109,11 +108,11 @@ public class OpenDeclarationAction extends TextEditorAction {
String editorID = "org.eclipse.cdt.make.editor"; //$NON-NLS-1$
IEditorPart editorPart = IDE.openEditor(p, input, editorID, true);
if (editorPart instanceof MakefileEditor) {
- ((MakefileEditor)editorPart).setSelection(directive, true);
+ ((MakefileEditor) editorPart).setSelection(directive, true);
}
return editorPart;
}
-
+
}
return 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 cbf314b8a40..c7e8e1604d7 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
@@ -54,42 +54,38 @@ import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
-
-
public class OpenIncludeAction extends Action {
+ private static final String PREFIX = "OpenIncludeAction."; //$NON-NLS-1$
- private static final String PREFIX= "OpenIncludeAction."; //$NON-NLS-1$
-
- private static final String DIALOG_TITLE= PREFIX + "dialog.title"; //$NON-NLS-1$
- private static final String DIALOG_MESSAGE= PREFIX + "dialog.message"; //$NON-NLS-1$
-
- private ISelectionProvider fSelectionProvider;
+ private static final String DIALOG_TITLE = PREFIX + "dialog.title"; //$NON-NLS-1$
+ private static final String DIALOG_MESSAGE = PREFIX + "dialog.message"; //$NON-NLS-1$
+ private ISelectionProvider fSelectionProvider;
public OpenIncludeAction(ISelectionProvider provider) {
super(CUIPlugin.getResourceString(PREFIX + "label")); //$NON-NLS-1$
setDescription(CUIPlugin.getResourceString(PREFIX + "description")); //$NON-NLS-1$
setToolTipText(CUIPlugin.getResourceString(PREFIX + "tooltip")); //$NON-NLS-1$
-
+
MakeUIImages.setImageDescriptors(this, MakeUIImages.T_LCL, MakeUIImages.IMG_MENU_OPEN_INCLUDE);
-
- fSelectionProvider= provider;
+
+ fSelectionProvider = provider;
}
-
+
@Override
public void run() {
- IInclude include= getIncludeStatement(fSelectionProvider.getSelection());
+ IInclude include = getIncludeStatement(fSelectionProvider.getSelection());
if (include == null) {
return;
}
-
+
try {
IResource res = include.getUnderlyingResource();
ArrayList<Object> filesFound = new ArrayList<>(4);
- String fullFileName= include.getFullFileName();
+ String fullFileName = include.getFullFileName();
if (fullFileName != null) {
- IPath fullPath= new Path(fullFileName);
+ IPath fullPath = new Path(fullFileName);
if (fullPath.isAbsolute() && fullPath.toFile().exists()) {
filesFound.add(fullPath);
}
@@ -98,7 +94,7 @@ public class OpenIncludeAction extends Action {
IProject proj = res.getProject();
String includeName = include.getElementName();
// Search in the scannerInfo information
- IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(proj);
+ IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(proj);
if (provider != null) {
IScannerInfo info = provider.getScannerInformation(res);
// XXXX this should fall back to project by itself
@@ -107,14 +103,14 @@ public class OpenIncludeAction extends Action {
}
if (info != null) {
IExtendedScannerInfo scanInfo = new ExtendedScannerInfo(info);
-
+
boolean isSystemInclude = include.isStandard();
-
+
if (!isSystemInclude) {
// search in current directory
- IPath location= include.getTranslationUnit().getLocation();
+ IPath location = include.getTranslationUnit().getLocation();
if (location != null) {
- String currentDir= location.removeLastSegments(1).toOSString();
+ String currentDir = location.removeLastSegments(1).toOSString();
findFile(new String[] { currentDir }, includeName, filesFound);
}
if (filesFound.isEmpty()) {
@@ -123,14 +119,14 @@ public class OpenIncludeAction extends Action {
findFile(localIncludePaths, includeName, filesFound);
}
}
-
+
if (filesFound.isEmpty()) {
// search in <...> include directories
String[] includePaths = scanInfo.getIncludePaths();
findFile(includePaths, includeName, filesFound);
}
}
-
+
if (filesFound.isEmpty()) {
// Fall back and search the project
findFile(proj, new Path(includeName), filesFound);
@@ -138,43 +134,43 @@ public class OpenIncludeAction extends Action {
}
}
IPath fileToOpen;
- int nElementsFound= filesFound.size();
+ int nElementsFound = filesFound.size();
if (nElementsFound == 0) {
noElementsFound();
- fileToOpen= null;
+ fileToOpen = null;
} else if (nElementsFound == 1) {
- fileToOpen= (IPath) filesFound.get(0);
+ fileToOpen = (IPath) filesFound.get(0);
} else {
- fileToOpen= chooseFile(filesFound);
+ fileToOpen = chooseFile(filesFound);
}
-
+
if (fileToOpen != null) {
EditorUtility.openInEditor(fileToOpen, include);
- }
+ }
} catch (CoreException e) {
CUIPlugin.log(e.getStatus());
}
}
/**
- *
+ *
*/
private void noElementsFound() {
MessageBox errorMsg = new MessageBox(CUIPlugin.getActiveWorkbenchShell(), SWT.ICON_ERROR | SWT.OK);
errorMsg.setText(CUIPlugin.getResourceString("OpenIncludeAction.error")); //$NON-NLS-1$
- errorMsg.setMessage (CUIPlugin.getResourceString("OpenIncludeAction.error.description")); //$NON-NLS-1$
+ errorMsg.setMessage(CUIPlugin.getResourceString("OpenIncludeAction.error.description")); //$NON-NLS-1$
errorMsg.open();
}
-
+
private boolean isInProject(IPath path) {
- return getWorkspaceRoot().getFileForLocation(path) != null;
+ return getWorkspaceRoot().getFileForLocation(path) != null;
}
-
+
/**
* Returns the path as is, if it points to a workspace resource. If the path
* does not point to a workspace resource, but there are linked workspace
* resources pointing to it, returns the paths of these resources.
- * Othervise, returns the path as is.
+ * Othervise, returns the path as is.
*/
private IPath[] resolveIncludeLink(IPath path) {
if (!isInProject(path)) {
@@ -182,22 +178,22 @@ public class OpenIncludeAction extends Action {
if (files.length > 0) {
IPath[] paths = new IPath[files.length];
for (int i = 0; i < files.length; i++) {
- paths[i] = files[i].getFullPath();
+ paths[i] = files[i].getFullPath();
}
return paths;
}
}
-
+
return new IPath[] { path };
}
private IWorkspaceRoot getWorkspaceRoot() {
return ResourcesPlugin.getWorkspace().getRoot();
}
-
+
private void findFile(String[] includePaths, String name, List<Object> list) {
// in case it is an absolute path
- IPath includeFile= new Path(name);
+ IPath includeFile = new Path(name);
if (includeFile.isAbsolute()) {
includeFile = PathUtil.getCanonicalPath(includeFile);
if (includeFile.toFile().exists()) {
@@ -217,7 +213,7 @@ public class OpenIncludeAction extends Action {
list.add(p);
}
}
- }
+ }
}
}
@@ -245,53 +241,52 @@ public class OpenIncludeAction extends Action {
}, 0);
}
-
private IPath chooseFile(ArrayList<Object> filesFound) {
- ILabelProvider renderer= new LabelProvider() {
+ ILabelProvider renderer = new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof IPath) {
- IPath file= (IPath)element;
- return file.lastSegment() + " - " + file.toString(); //$NON-NLS-1$
+ IPath file = (IPath) element;
+ return file.lastSegment() + " - " + file.toString(); //$NON-NLS-1$
}
return super.getText(element);
}
};
-
- ElementListSelectionDialog dialog= new ElementListSelectionDialog(CUIPlugin.getActiveWorkbenchShell(), renderer, false, false);
+
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(CUIPlugin.getActiveWorkbenchShell(),
+ renderer, false, false);
dialog.setTitle(CUIPlugin.getResourceString(DIALOG_TITLE));
dialog.setMessage(CUIPlugin.getResourceString(DIALOG_MESSAGE));
dialog.setElements(filesFound);
-
+
if (dialog.open() == Window.OK) {
return (IPath) dialog.getSelectedElement();
}
return null;
}
-
private static IInclude getIncludeStatement(ISelection sel) {
if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
List<?> list = ((IStructuredSelection) sel).toList();
if (list.size() == 1) {
- Object element= list.get(0);
+ Object element = list.get(0);
if (element instanceof IInclude) {
- return (IInclude)element;
+ return (IInclude) element;
}
}
}
return null;
}
-
+
public static boolean canActionBeAdded(ISelection selection) {
ICElement include = getIncludeStatement(selection);
if (include != null) {
IResource res = include.getUnderlyingResource();
if (res != null) {
- return true;
+ return true;
}
}
return false;
- }
+ }
}
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 33a715efb08..f1c336383d9 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
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
public class OverrideDefine extends DefineVariable {
public OverrideDefine(Directive parent, String name, StringBuffer value) {
@@ -22,7 +21,8 @@ public class OverrideDefine extends DefineVariable {
@Override
public String toString() {
- StringBuffer sb = new StringBuffer(GNUMakefileConstants.VARIABLE_OVERRIDE + " " + GNUMakefileConstants.VARIABLE_DEFINE); //$NON-NLS-1$
+ StringBuffer sb = new StringBuffer(
+ GNUMakefileConstants.VARIABLE_OVERRIDE + " " + GNUMakefileConstants.VARIABLE_DEFINE); //$NON-NLS-1$
sb.append(getName()).append('\n');
sb.append(getValue());
sb.append(GNUMakefileConstants.TERMINAL_ENDEF);
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 95a65408f49..2c4d0f377cb 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
@@ -61,7 +61,7 @@ public abstract class Parent extends Directive implements IParent {
public Directive[] getStatements() {
children.trimToSize();
- return children.toArray(new Directive[0]);
+ return children.toArray(new Directive[0]);
}
@Override
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 a1fa4298340..38676f30e7c 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
@@ -16,7 +16,6 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake;
import java.util.ArrayList;
import java.util.List;
-
/**
*/
public class PosixMakefileUtil {
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 db84b997e75..d5db583f817 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
@@ -40,52 +40,50 @@ import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
import org.eclipse.jface.text.source.projection.ProjectionViewer;
import org.eclipse.ui.texteditor.IDocumentProvider;
-
/**
* ProjectionMakefileUpdater
*/
public class ProjectionMakefileUpdater implements IProjectionListener {
private static class MakefileProjectionAnnotation extends ProjectionAnnotation {
-
+
private IDirective fDirective;
private boolean fIsComment;
-
+
public MakefileProjectionAnnotation(IDirective element, boolean isCollapsed, boolean isComment) {
super(isCollapsed);
fDirective = element;
fIsComment = isComment;
}
-
+
public IDirective getElement() {
return fDirective;
}
-
+
public void setElement(IDirective element) {
fDirective = element;
}
-
+
public boolean isComment() {
return fIsComment;
}
}
-
public void install(MakefileEditor editor, ProjectionViewer viewer) {
- fEditor= editor;
- fViewer= viewer;
+ fEditor = editor;
+ fViewer = viewer;
fViewer.addProjectionListener(this);
}
-
+
public void uninstall() {
if (isInstalled()) {
projectionDisabled();
fViewer.removeProjectionListener(this);
- fViewer= null;
- fEditor= null;
+ fViewer = null;
+ fEditor = null;
}
}
-
+
protected boolean isInstalled() {
return fEditor != null;
}
@@ -120,37 +118,37 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
// we have to make sure that we disable first when getting an enable
// message.
projectionDisabled();
-
- initialize();
- fParticipant= new ReconcilerParticipant();
+
+ initialize();
+ fParticipant = new ReconcilerParticipant();
fEditor.addReconcilingParticipant(fParticipant);
}
-
+
@Override
public void projectionDisabled() {
- fCachedDocument= null;
+ fCachedDocument = null;
if (fParticipant != null) {
fEditor.addReconcilingParticipant(fParticipant);
- fParticipant= null;
+ fParticipant = null;
}
}
-
+
public void initialize() {
-
+
if (!isInstalled())
return;
-
+
initializePreferences();
-
+
try {
-
- IDocumentProvider provider= fEditor.getDocumentProvider();
- fCachedDocument= provider.getDocument(fEditor.getEditorInput());
- fAllowCollapsing= true;
-
- IWorkingCopyManager manager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
- fInput= manager.getWorkingCopy(fEditor.getEditorInput());
-
+
+ IDocumentProvider provider = fEditor.getDocumentProvider();
+ fCachedDocument = provider.getDocument(fEditor.getEditorInput());
+ fAllowCollapsing = true;
+
+ IWorkingCopyManager manager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
+ fInput = manager.getWorkingCopy(fEditor.getEditorInput());
+
if (fInput != null) {
ProjectionAnnotationModel model = fEditor.getAdapter(ProjectionAnnotationModel.class);
if (model != null) {
@@ -159,10 +157,10 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
model.replaceAnnotations(null, additions);
}
}
-
+
} finally {
- fCachedDocument= null;
- fAllowCollapsing= false;
+ fCachedDocument = null;
+ fAllowCollapsing = false;
}
}
@@ -175,38 +173,38 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
}
private Map<MakefileProjectionAnnotation, Position> computeAdditions(IParent parent) {
- Map<MakefileProjectionAnnotation, Position> map= new HashMap<>();
+ Map<MakefileProjectionAnnotation, Position> map = new HashMap<>();
computeAdditions(parent.getDirectives(), map);
return map;
}
private void computeAdditions(IDirective[] elements, Map<MakefileProjectionAnnotation, Position> map) {
- for (int i= 0; i < elements.length; i++) {
- IDirective element= elements[i];
-
+ for (int i = 0; i < elements.length; i++) {
+ IDirective element = elements[i];
+
computeAdditions(element, map);
-
+
if (element instanceof IParent) {
- IParent parent= (IParent) element;
+ IParent parent = (IParent) element;
computeAdditions(parent.getDirectives(), map);
}
}
}
private void computeAdditions(IDirective element, Map<MakefileProjectionAnnotation, Position> map) {
-
- boolean createProjection= false;
-
+
+ boolean createProjection = false;
+
if (element instanceof IConditional) {
- createProjection= true;
+ createProjection = true;
} else if (element instanceof IMacroDefinition) {
- createProjection= true;
+ createProjection = true;
} else if (element instanceof IRule) {
- createProjection= true;
+ createProjection = true;
}
-
+
if (createProjection) {
- Position position= createProjectionPosition(element);
+ Position position = createProjectionPosition(element);
if (position != null) {
map.put(new MakefileProjectionAnnotation(element, fAllowCollapsing, true), position);
}
@@ -214,61 +212,60 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
}
private Position createProjectionPosition(IDirective element) {
-
+
if (fCachedDocument == null)
return null;
-
- try {
- int startLine= element.getStartLine() - 1;
- int endLine= element.getEndLine() - 1;
+
+ try {
+ int startLine = element.getStartLine() - 1;
+ int endLine = element.getEndLine() - 1;
if (startLine != endLine) {
- int offset= fCachedDocument.getLineOffset(startLine);
- int endOffset= fCachedDocument.getLineOffset(endLine + 1);
+ int offset = fCachedDocument.getLineOffset(startLine);
+ int endOffset = fCachedDocument.getLineOffset(endLine + 1);
return new Position(offset, endOffset - offset);
}
-
+
} catch (BadLocationException x) {
}
-
+
return null;
}
public void processReconcile() {
if (!isInstalled())
return;
-
- ProjectionAnnotationModel model= fEditor.getAdapter(ProjectionAnnotationModel.class);
+
+ ProjectionAnnotationModel model = fEditor.getAdapter(ProjectionAnnotationModel.class);
if (model == null)
return;
-
+
try {
- IDocumentProvider provider= fEditor.getDocumentProvider();
- fCachedDocument= provider.getDocument(fEditor.getEditorInput());
- fAllowCollapsing= false;
-
- Map<MakefileProjectionAnnotation, Position> additions= new HashMap<>();
- List<MakefileProjectionAnnotation> deletions= new ArrayList<>();
- List<MakefileProjectionAnnotation> updates= new ArrayList<>();
-
- Map<MakefileProjectionAnnotation, Position> updated= computeAdditions((IParent) fInput);
- Map<IDirective, List<MakefileProjectionAnnotation>> previous= createAnnotationMap(model);
-
-
- Iterator<MakefileProjectionAnnotation> e= updated.keySet().iterator();
+ IDocumentProvider provider = fEditor.getDocumentProvider();
+ fCachedDocument = provider.getDocument(fEditor.getEditorInput());
+ fAllowCollapsing = false;
+
+ Map<MakefileProjectionAnnotation, Position> additions = new HashMap<>();
+ List<MakefileProjectionAnnotation> deletions = new ArrayList<>();
+ List<MakefileProjectionAnnotation> updates = new ArrayList<>();
+
+ Map<MakefileProjectionAnnotation, Position> updated = computeAdditions((IParent) fInput);
+ Map<IDirective, List<MakefileProjectionAnnotation>> previous = createAnnotationMap(model);
+
+ Iterator<MakefileProjectionAnnotation> e = updated.keySet().iterator();
while (e.hasNext()) {
- MakefileProjectionAnnotation annotation= e.next();
- IDirective element= annotation.getElement();
- Position position= updated.get(annotation);
-
- List<MakefileProjectionAnnotation> annotations= previous.get(element);
+ MakefileProjectionAnnotation annotation = e.next();
+ IDirective element = annotation.getElement();
+ Position position = updated.get(annotation);
+
+ List<MakefileProjectionAnnotation> annotations = previous.get(element);
if (annotations == null) {
additions.put(annotation, position);
} else {
- Iterator<MakefileProjectionAnnotation> x= annotations.iterator();
+ Iterator<MakefileProjectionAnnotation> x = annotations.iterator();
while (x.hasNext()) {
- MakefileProjectionAnnotation a= x.next();
+ MakefileProjectionAnnotation a = x.next();
if (annotation.isComment() == a.isComment()) {
- Position p= model.getPosition(a);
+ Position p = model.getPosition(a);
if (p != null && !position.equals(p)) {
p.setOffset(position.getOffset());
p.setLength(position.getLength());
@@ -278,109 +275,109 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
break;
}
}
-
+
if (annotations.isEmpty())
previous.remove(element);
}
}
-
+
Iterator<List<MakefileProjectionAnnotation>> e2 = previous.values().iterator();
while (e.hasNext()) {
- List<MakefileProjectionAnnotation> list= e2.next();
- int size= list.size();
- for (int i= 0; i < size; i++)
+ List<MakefileProjectionAnnotation> list = e2.next();
+ int size = list.size();
+ for (int i = 0; i < size; i++)
deletions.add(list.get(i));
}
match(model, deletions, additions, updates);
- Annotation[] removals= new Annotation[deletions.size()];
+ Annotation[] removals = new Annotation[deletions.size()];
deletions.toArray(removals);
- Annotation[] changes= new Annotation[updates.size()];
+ Annotation[] changes = new Annotation[updates.size()];
updates.toArray(changes);
model.modifyAnnotations(removals, additions, changes);
-
+
} finally {
- fCachedDocument= null;
- fAllowCollapsing= true;
+ fCachedDocument = null;
+ fAllowCollapsing = true;
}
}
- private void match(ProjectionAnnotationModel model, List<MakefileProjectionAnnotation> deletions,
+ private void match(ProjectionAnnotationModel model, List<MakefileProjectionAnnotation> deletions,
Map<MakefileProjectionAnnotation, Position> additions, List<MakefileProjectionAnnotation> changes) {
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty()))
return;
-
- List<MakefileProjectionAnnotation> newDeletions= new ArrayList<>();
- List<MakefileProjectionAnnotation> newChanges= new ArrayList<>();
-
- Iterator<MakefileProjectionAnnotation> deletionIterator= deletions.iterator();
+
+ List<MakefileProjectionAnnotation> newDeletions = new ArrayList<>();
+ List<MakefileProjectionAnnotation> newChanges = new ArrayList<>();
+
+ Iterator<MakefileProjectionAnnotation> deletionIterator = deletions.iterator();
outer: while (deletionIterator.hasNext()) {
- MakefileProjectionAnnotation deleted= deletionIterator.next();
- Position deletedPosition= model.getPosition(deleted);
+ MakefileProjectionAnnotation deleted = deletionIterator.next();
+ Position deletedPosition = model.getPosition(deleted);
if (deletedPosition == null)
continue;
-
- Iterator<MakefileProjectionAnnotation> changesIterator= changes.iterator();
+
+ Iterator<MakefileProjectionAnnotation> changesIterator = changes.iterator();
while (changesIterator.hasNext()) {
- MakefileProjectionAnnotation changed= changesIterator.next();
+ MakefileProjectionAnnotation changed = changesIterator.next();
if (deleted.isComment() == changed.isComment()) {
- Position changedPosition= model.getPosition(changed);
+ Position changedPosition = model.getPosition(changed);
if (changedPosition == null)
continue;
-
+
if (deletedPosition.getOffset() == changedPosition.getOffset()) {
-
+
deletedPosition.setLength(changedPosition.getLength());
deleted.setElement(changed.getElement());
-
+
deletionIterator.remove();
newChanges.add(deleted);
-
+
changesIterator.remove();
newDeletions.add(changed);
-
+
continue outer;
}
}
}
-
- Iterator<MakefileProjectionAnnotation> additionsIterator= additions.keySet().iterator();
+
+ Iterator<MakefileProjectionAnnotation> additionsIterator = additions.keySet().iterator();
while (additionsIterator.hasNext()) {
- MakefileProjectionAnnotation added= additionsIterator.next();
+ MakefileProjectionAnnotation added = additionsIterator.next();
if (deleted.isComment() == added.isComment()) {
- Position addedPosition= additions.get(added);
-
+ Position addedPosition = additions.get(added);
+
if (deletedPosition.getOffset() == addedPosition.getOffset()) {
-
+
deletedPosition.setLength(addedPosition.getLength());
deleted.setElement(added.getElement());
-
+
deletionIterator.remove();
newChanges.add(deleted);
-
+
additionsIterator.remove();
-
+
break;
}
}
}
}
-
+
deletions.addAll(newDeletions);
changes.addAll(newChanges);
}
private Map<IDirective, List<MakefileProjectionAnnotation>> createAnnotationMap(IAnnotationModel model) {
- Map<IDirective, List<MakefileProjectionAnnotation>> map= new HashMap<>();
+ Map<IDirective, List<MakefileProjectionAnnotation>> map = new HashMap<>();
Iterator<Annotation> e = model.getAnnotationIterator();
while (e.hasNext()) {
Annotation annotation = e.next();
if (annotation instanceof MakefileProjectionAnnotation) {
- MakefileProjectionAnnotation directive= (MakefileProjectionAnnotation) annotation;
- List<MakefileProjectionAnnotation> list= map.get(directive.getElement());
+ MakefileProjectionAnnotation directive = (MakefileProjectionAnnotation) annotation;
+ List<MakefileProjectionAnnotation> 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 a4cb072b0a3..da2c1e4e817 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
@@ -46,9 +46,9 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
class ResourceChangeListener implements IResourceChangeListener {
@Override
public void resourceChanged(IResourceChangeEvent e) {
- IResourceDelta delta= e.getDelta();
+ IResourceDelta delta = e.getDelta();
if (delta != null && fResource != null) {
- IResourceDelta child= delta.findMember(fResource.getFullPath());
+ IResourceDelta child = delta.findMember(fResource.getFullPath());
if (child != null)
update(child.getMarkerDeltas());
}
@@ -60,8 +60,7 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
/** The resource. */
private IResource fResource;
/** The resource change listener. */
- private IResourceChangeListener fResourceChangeListener= new ResourceChangeListener();
-
+ private IResourceChangeListener fResourceChangeListener = new ResourceChangeListener();
/**
* Creates a marker annotation model with the given resource as the source
@@ -71,8 +70,8 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
*/
public ResourceMarkerAnnotationModel(IResource resource) {
Assert.isNotNull(resource);
- fResource= resource;
- fWorkspace= resource.getWorkspace();
+ fResource = resource;
+ fWorkspace = resource.getWorkspace();
}
@Override
@@ -87,21 +86,21 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
*/
protected void update(IMarkerDelta[] markerDeltas) {
- if (markerDeltas.length == 0)
+ if (markerDeltas.length == 0)
return;
if (markerDeltas.length == 1) {
- IMarkerDelta delta= markerDeltas[0];
+ IMarkerDelta delta = markerDeltas[0];
switch (delta.getKind()) {
- case IResourceDelta.ADDED :
- addMarkerAnnotation(delta.getMarker());
- break;
- case IResourceDelta.REMOVED :
- removeMarkerAnnotation(delta.getMarker());
- break;
- case IResourceDelta.CHANGED :
- modifyMarkerAnnotation(delta.getMarker());
- break;
+ case IResourceDelta.ADDED:
+ addMarkerAnnotation(delta.getMarker());
+ break;
+ case IResourceDelta.REMOVED:
+ removeMarkerAnnotation(delta.getMarker());
+ break;
+ case IResourceDelta.CHANGED:
+ modifyMarkerAnnotation(delta.getMarker());
+ break;
}
} else
batchedUpdate(markerDeltas);
@@ -115,39 +114,39 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
* @param markerDeltas the array of marker deltas
*/
private void batchedUpdate(IMarkerDelta[] markerDeltas) {
- HashSet<IMarker> removedMarkers= new HashSet<>(markerDeltas.length);
- HashSet<IMarker> modifiedMarkers= new HashSet<>(markerDeltas.length);
+ HashSet<IMarker> removedMarkers = new HashSet<>(markerDeltas.length);
+ HashSet<IMarker> modifiedMarkers = new HashSet<>(markerDeltas.length);
- for (int i= 0; i < markerDeltas.length; i++) {
- IMarkerDelta delta= markerDeltas[i];
+ for (int i = 0; i < markerDeltas.length; i++) {
+ IMarkerDelta delta = markerDeltas[i];
switch (delta.getKind()) {
- case IResourceDelta.ADDED:
- addMarkerAnnotation(delta.getMarker());
- break;
- case IResourceDelta.REMOVED:
- removedMarkers.add(delta.getMarker());
- break;
- case IResourceDelta.CHANGED:
- modifiedMarkers.add(delta.getMarker());
- break;
- }
+ case IResourceDelta.ADDED:
+ addMarkerAnnotation(delta.getMarker());
+ break;
+ case IResourceDelta.REMOVED:
+ removedMarkers.add(delta.getMarker());
+ break;
+ case IResourceDelta.CHANGED:
+ modifiedMarkers.add(delta.getMarker());
+ break;
+ }
}
if (modifiedMarkers.isEmpty() && removedMarkers.isEmpty())
return;
- Iterator<?> e= getAnnotationIterator(false);
+ Iterator<?> e = getAnnotationIterator(false);
while (e.hasNext()) {
- Object o= e.next();
+ Object o = e.next();
if (o instanceof MarkerAnnotation) {
- MarkerAnnotation a= (MarkerAnnotation)o;
- IMarker marker= a.getMarker();
+ MarkerAnnotation a = (MarkerAnnotation) o;
+ IMarker marker = a.getMarker();
if (removedMarkers.remove(marker))
removeAnnotation(a, false);
if (modifiedMarkers.remove(marker)) {
- Position p= createPositionFromMarker(marker);
+ Position p = createPositionFromMarker(marker);
if (p != null) {
a.update();
modifyAnnotationPosition(a, p, false);
@@ -160,7 +159,7 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
}
}
- Iterator<IMarker> iter= modifiedMarkers.iterator();
+ Iterator<IMarker> iter = modifiedMarkers.iterator();
while (iter.hasNext())
addMarkerAnnotation(iter.next());
}
@@ -176,7 +175,7 @@ public class ResourceMarkerAnnotationModel extends AbstractMarkerAnnotationModel
@Override
protected void deleteMarkers(final IMarker[] markers) throws CoreException {
fWorkspace.run((IWorkspaceRunnable) monitor -> {
- for (int i= 0; i < markers.length; ++i) {
+ for (int i = 0; i < markers.length; ++i) {
markers[i].delete();
}
}, null, IWorkspace.AVOID_UPDATE, null);
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 940ce565713..7cfb640b4be 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
@@ -58,10 +58,10 @@ public abstract class Rule extends Parent implements IRule {
@Override
public boolean equals(Object r) {
if (r instanceof Rule)
- return ((Rule)r).getTarget().equals(getTarget());
+ 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 395e687a4a2..12d741d28c9 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
@@ -42,70 +42,76 @@ public class SelectionList extends Composite {
private Object[] fElements;
protected ILabelProvider fRenderer;
private boolean fIgnoreCase;
-
+
// Implementation details
private String[] fRenderedStrings;
- private int[] fFilteredElements;
+ private int[] fFilteredElements;
private String fRememberedMatchText;
// SWT widgets
private Table fList;
private Text fText;
-
+
/**
* Adds a selection change listener to this widget.
*/
public void addSelectionListener(SelectionListener listener) {
fList.addSelectionListener(listener);
}
+
private void createList(int style) {
- fList= new Table(this, style);
+ fList = new Table(this, style);
fList.setLayoutData(new GridData(GridData.FILL_BOTH));
fList.addDisposeListener(e -> fRenderer.dispose());
}
+
private void createText() {
- fText= new Text(this, SWT.BORDER);
- GridData spec= new GridData();
- spec.grabExcessVerticalSpace= false;
- spec.grabExcessHorizontalSpace= true;
- spec.horizontalAlignment= GridData.FILL;
- spec.verticalAlignment= GridData.BEGINNING;
+ fText = new Text(this, SWT.BORDER);
+ GridData spec = new GridData();
+ spec.grabExcessVerticalSpace = false;
+ spec.grabExcessHorizontalSpace = true;
+ spec.horizontalAlignment = GridData.FILL;
+ spec.verticalAlignment = GridData.BEGINNING;
fText.setLayoutData(spec);
Listener l = evt -> filter(false);
fText.addListener(SWT.Modify, l);
}
+
/**
* Filters the list of elements according to the pattern entered
* into the text entry field.
*/
public void filter(boolean forceUpdate) {
- int k= 0;
- String text= fText.getText();
+ int k = 0;
+ String text = fText.getText();
if (!forceUpdate && text.equals(fRememberedMatchText))
return;
- fRememberedMatchText= text;
- StringMatcher matcher= new StringMatcher(text+"*", fIgnoreCase, false); //$NON-NLS-1$
- for (int i= 0; i < fElements.length; i++) {
+ fRememberedMatchText = text;
+ StringMatcher matcher = new StringMatcher(text + "*", fIgnoreCase, false); //$NON-NLS-1$
+ for (int i = 0; i < fElements.length; i++) {
if (matcher.match(fRenderedStrings[i])) {
- fFilteredElements[k]= i;
+ fFilteredElements[k] = i;
k++;
}
}
- fFilteredElements[k]= -1;
+ fFilteredElements[k] = -1;
updateListWidget(fFilteredElements, k);
}
+
/**
* Returns the currently used filter text.
*/
public String getFilter() {
return fText.getText();
}
+
/**
* Returns the selection indices.
*/
public int[] getSelectionIndices() {
return fList.getSelectionIndices();
}
+
/**
* Returns a list of selected elements. Note that the type of the elements
* returned in the list are the same as the ones passed to the selection list
@@ -114,73 +120,82 @@ public class SelectionList extends Composite {
public List<Object> getSelection() {
if (fList == null || fList.isDisposed() || fList.getSelectionCount() == 0)
return new ArrayList<>(0);
- int[] listSelection= fList.getSelectionIndices();
- List<Object> selected= new ArrayList<>(listSelection.length);
- for (int i= 0; i < listSelection.length; i++) {
+ int[] listSelection = fList.getSelectionIndices();
+ List<Object> selected = new ArrayList<>(listSelection.length);
+ for (int i = 0; i < listSelection.length; i++) {
selected.add(fElements[fFilteredElements[listSelection[i]]]);
}
return selected;
}
+
/**
* Returns <code>true</code> when the list of elements is empty.
*/
public boolean isEmptyList() {
return fElements == null || fElements.length == 0;
}
+
/**
* Creates new instance of the widget.
*/
public SelectionList(Composite parent, int style, ILabelProvider renderer, boolean ignoreCase) {
super(parent, SWT.NONE);
- fRenderer= renderer;
- fIgnoreCase= ignoreCase;
- GridLayout layout= new GridLayout();
- layout.marginHeight= 0; layout.marginWidth= 0;
+ fRenderer = renderer;
+ fIgnoreCase = ignoreCase;
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
//XXX: 1G9V58A: ITPUI:WIN2000 - Dialog.convert* methods should be static
setLayout(layout);
createText();
createList(style);
}
+
/**
* Removes a selection change listener to this widget.
*/
public void removeSelectionListener(SelectionListener listener) {
fList.removeSelectionListener(listener);
}
+
private String[] renderStrings() {
- String[] strings= new String[fElements.length];
- for (int i= 0; i < strings.length; i++) {
- strings[i]= fRenderer.getText(fElements[i]);
+ String[] strings = new String[fElements.length];
+ for (int i = 0; i < strings.length; i++) {
+ strings[i] = fRenderer.getText(fElements[i]);
}
TwoArrayQuickSort.sort(strings, fElements, fIgnoreCase);
return strings;
}
+
/**
* Select the pattern text.
*/
public void selectFilterText() {
fText.selectAll();
}
+
/**
* Sets the list of elements presented in the widget.
*/
public void setElements(List<Object> elements, boolean refilter) {
// We copy the list since we sort it.
if (elements == null)
- fElements= new Object[0];
- else
- fElements= elements.toArray();
- fFilteredElements= new int[fElements.length+1];
- fRenderedStrings= renderStrings();
+ fElements = new Object[0];
+ else
+ fElements = elements.toArray();
+ fFilteredElements = new int[fElements.length + 1];
+ fRenderedStrings = renderStrings();
if (refilter)
- filter(true);
+ filter(true);
}
+
@Override
public void setEnabled(boolean enable) {
super.setEnabled(enable);
fText.setEnabled(enable);
fList.setEnabled(enable);
}
+
/**
* Sets the filter pattern. Current only prefix filter pattern are supported.
*/
@@ -189,16 +204,19 @@ public class SelectionList extends Composite {
if (refilter)
filter(true);
}
+
@Override
public boolean setFocus() {
return fText.setFocus();
}
+
@Override
public void setFont(Font font) {
super.setFont(font);
fText.setFont(font);
fList.setFont(font);
}
+
/**
* Selects the elements in the list determined by the given
* selection indices.
@@ -206,34 +224,35 @@ public class SelectionList extends Composite {
protected void setSelection(int[] selection) {
fList.setSelection(selection);
}
+
private void updateListWidget(int[] indices, int size) {
if (fList == null || fList.isDisposed())
return;
fList.setRedraw(false);
- int itemCount= fList.getItemCount();
+ int itemCount = fList.getItemCount();
if (size < itemCount) {
- fList.remove(0, itemCount-size-1);
+ fList.remove(0, itemCount - size - 1);
}
- TableItem[] items= fList.getItems();
- for (int i= 0; i < size; i++) {
- TableItem ti= null;
+ TableItem[] items = fList.getItems();
+ for (int i = 0; i < size; i++) {
+ TableItem ti = null;
if (i < itemCount) {
- ti= items[i];
+ ti = items[i];
} else {
- ti= new TableItem(fList, i);
+ ti = new TableItem(fList, i);
}
ti.setText(fRenderedStrings[indices[i]]);
- Image img= fRenderer.getImage(fElements[indices[i]]);
+ Image img = fRenderer.getImage(fElements[indices[i]]);
if (img != null)
ti.setImage(img);
}
if (fList.getItemCount() > 0) {
fList.setSelection(0);
}
-
+
fList.setRedraw(true);
- Event event= new Event();
+ Event event = new Event();
fList.notifyListeners(SWT.Selection, event);
}
}
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 a2f18dd0e6a..abc4f9452d9 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
@@ -33,40 +33,42 @@ import org.eclipse.ui.dialogs.SelectionDialog;
* The status message must be passed over as StatusInfo object and can be
* an error, warning or ok. The OK button is enabled / disabled depending
* on the status.
- */
+ */
public abstract class SelectionStatusDialog extends SelectionDialog {
-
+
private MessageLine fStatusLine;
private IStatus fLastStatus;
private Image fImage;
private boolean fInitialSelectionSet;
- private boolean fStatusLineAboveButtons= false;
-
-
+ private boolean fStatusLineAboveButtons = false;
+
/**
* Compute the result and return it.
*/
protected abstract void computeResult();
+
@Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
if (fImage != null)
shell.setImage(fImage);
}
+
@Override
protected Control createButtonBar(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
if (fStatusLineAboveButtons) {
- layout.verticalSpacing= 0;
+ layout.verticalSpacing = 0;
} else {
- layout.numColumns= 2;
+ layout.numColumns = 2;
}
- layout.marginHeight= 0; layout.marginWidth= 0;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- fStatusLine= new MessageLine(composite);
+
+ fStatusLine = new MessageLine(composite);
fStatusLine.setAlignment(SWT.LEFT);
fStatusLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fStatusLine.setMessage(""); //$NON-NLS-1$
@@ -74,6 +76,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
super.createButtonBar(composite);
return composite;
}
+
@Override
public void create() {
super.create();
@@ -81,6 +84,7 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
updateStatus(fLastStatus);
}
}
+
/**
* Returns the first element of the initial selection or <code>null<code>
* if there isn't any initial selection.
@@ -90,8 +94,9 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
List<?> result = getInitialElementSelections();
if (result == null || result.size() == 0)
return null;
- return result.get(0);
+ return result.get(0);
}
+
/**
* Returns the first element from the list of results. Returns <code>null</code>
* if no element has been selected.
@@ -100,35 +105,39 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
* returned.
*/
public Object getPrimaryResult() {
- Object[] result= getResult();
+ Object[] result = getResult();
if (result == null || result.length == 0)
return null;
- return result[0];
+ return result[0];
}
+
public SelectionStatusDialog(Shell parent) {
super(parent);
- fInitialSelectionSet= false;
+ fInitialSelectionSet = false;
}
+
@Override
protected void okPressed() {
computeResult();
super.okPressed();
}
+
/**
* Sets the image for this dialog.
*
* @param image the dialog's image
*/
public void setImage(Image image) {
- fImage= image;
+ fImage = image;
}
@SuppressWarnings("unchecked")
protected void setInitialSelection(int position, Object element) {
List<Object> l = getInitialElementSelections();
l.set(position, element);
- fInitialSelectionSet= true;
+ fInitialSelectionSet = true;
}
+
/**
* Sets the initial selection to the given element.
*/
@@ -143,19 +152,22 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
setInitialSelections(new Object[0]);
}
}
+
@Override
public void setInitialSelections(Object[] selectedElements) {
super.setInitialSelections(selectedElements);
- fInitialSelectionSet= true;
+ fInitialSelectionSet = true;
}
+
/**
* Sets a result element at the given position.
*/
protected void setResult(int position, Object element) {
- Object[] result= getResult();
- result[position]= element;
+ Object[] result = getResult();
+ result[position] = element;
setResult(Arrays.asList(result));
}
+
/**
* Controls whether status line appears to the left of the buttons (default)
* or above them.
@@ -164,26 +176,28 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
* <code>false</code> to the right
*/
public void setStatusLineAboveButtons(boolean aboveButtons) {
- fStatusLineAboveButtons= aboveButtons;
+ fStatusLineAboveButtons = aboveButtons;
}
+
/**
* Update the status of the ok button to reflect the given status. Subclasses
* may override this method to update additional buttons.
*/
protected void updateButtonsEnableState(IStatus status) {
- Button okButton= getOkButton();
+ Button okButton = getOkButton();
if (okButton != null && !okButton.isDisposed())
okButton.setEnabled(!status.matches(IStatus.ERROR));
}
+
/**
* Update the dialog's status line to reflect the given status. It is safe to call
* this method before the dialog has been opened.
*/
protected void updateStatus(IStatus status) {
- fLastStatus= status;
+ fLastStatus = status;
if (fStatusLine != null && !fStatusLine.isDisposed()) {
- updateButtonsEnableState(status);
- StatusTool.applyToStatusLine(fStatusLine, status);
+ updateButtonsEnableState(status);
+ StatusTool.applyToStatusLine(fStatusLine, status);
}
}
}
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 e4c5e6fb3c1..9aa3b320ce9 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
@@ -28,7 +28,8 @@ public class StaticTargetRule extends InferenceRule implements IInferenceRule {
String targetPattern;
String[] prereqPatterns;
- public StaticTargetRule(Directive parent, Target target, String targetPattern, String[] prereqPatterns, Command[] commands) {
+ public StaticTargetRule(Directive parent, Target target, String targetPattern, String[] prereqPatterns,
+ Command[] commands) {
super(parent, target, commands);
this.targetPattern = targetPattern;
this.prereqPatterns = prereqPatterns.clone();
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 1d4f9f8d561..51f1bdc95e3 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
@@ -23,8 +23,8 @@ import org.eclipse.core.runtime.IStatus;
* a message describes the problem
*/
public class StatusInfo implements IStatus {
-
- public static final IStatus OK_STATUS= new StatusInfo();
+
+ public static final IStatus OK_STATUS = new StatusInfo();
private String fStatusMessage;
private int fSeverity;
@@ -41,76 +41,91 @@ public class StatusInfo implements IStatus {
* @param severity The status severity: ERROR, WARNING, INFO and OK.
* @param message The message of the status. Applies only for ERROR,
* WARNING and INFO.
- */
+ */
public StatusInfo(int severity, String message) {
- fStatusMessage= message;
- fSeverity= severity;
- }
+ fStatusMessage = message;
+ fSeverity = severity;
+ }
@Override
public IStatus[] getChildren() {
return new IStatus[0];
}
+
@Override
public int getCode() {
return fSeverity;
}
+
@Override
public Throwable getException() {
return null;
}
+
@Override
public String getMessage() {
return fStatusMessage;
}
+
@Override
public String getPlugin() {
return CUIPlugin.PLUGIN_ID;
}
+
@Override
public int getSeverity() {
return fSeverity;
}
+
public boolean isError() {
return fSeverity == IStatus.ERROR;
}
+
public boolean isInfo() {
return fSeverity == IStatus.INFO;
}
+
@Override
public boolean isMultiStatus() {
return false;
}
+
@Override
public boolean isOK() {
return fSeverity == IStatus.OK;
}
+
public boolean isWarning() {
return fSeverity == IStatus.WARNING;
}
+
@Override
public boolean matches(int severityMask) {
return (fSeverity & severityMask) != 0;
}
+
public void setError(String errorMessage) {
- fStatusMessage= errorMessage;
- fSeverity= IStatus.ERROR;
+ fStatusMessage = errorMessage;
+ fSeverity = IStatus.ERROR;
}
+
public void setInfo(String infoMessage) {
- fStatusMessage= infoMessage;
- fSeverity= IStatus.INFO;
+ fStatusMessage = infoMessage;
+ fSeverity = IStatus.INFO;
}
+
public void setOK() {
- fStatusMessage= null;
- fSeverity= IStatus.OK;
+ fStatusMessage = null;
+ fSeverity = IStatus.OK;
}
+
public void setWarning(String warningMessage) {
- fStatusMessage= warningMessage;
- fSeverity= IStatus.WARNING;
+ fStatusMessage = warningMessage;
+ fSeverity = IStatus.WARNING;
}
/**
- * Returns a string representation of the status, suitable
+ * Returns a string representation of the status, suitable
* for debugging purposes only.
*/
@Override
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusTool.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusTool.java
index 27be912cbfd..677448a8b38 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusTool.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/StatusTool.java
@@ -22,23 +22,25 @@ public class StatusTool {
* Applies the status to the status line of a dialog page
*/
public static void applyToStatusLine(MessageLine messageLine, IStatus status) {
- String[] messages= getErrorMessages(status);
+ String[] messages = getErrorMessages(status);
messageLine.setErrorMessage(messages[0]);
messageLine.setMessage(messages[1]);
}
+
/**
* Applies the status to the status line of a dialog page
*/
public static void applyToStatusLine(DialogPage page, IStatus status) {
- String[] messages= getErrorMessages(status);
+ String[] messages = getErrorMessages(status);
page.setErrorMessage(messages[0]);
page.setMessage(messages[1]);
}
+
/**
* Returns error-message / warning-message for a status
*/
public static String[] getErrorMessages(IStatus status) {
- String message= status.getMessage();
+ String message = status.getMessage();
if (status.matches(IStatus.ERROR) && !"".equals(message)) { //$NON-NLS-1$
return new String[] { message, null };
} else if (status.matches(IStatus.WARNING | IStatus.INFO)) {
@@ -47,6 +49,7 @@ public class StatusTool {
return new String[] { null, null };
}
}
+
/**
* Compare two IStatus. The more severe is returned:
* An error is more severe than a warning, and a warning is more severe
@@ -58,20 +61,21 @@ public class StatusTool {
}
return s2;
}
+
/**
* Finds the most severe status from a array of status
* An error is more severe than a warning, and a warning is more severe
* than ok.
*/
public static IStatus getMostSevere(IStatus[] status) {
- IStatus max= null;
- for (int i= 0; i < status.length; i++) {
- IStatus curr= status[i];
+ IStatus max = null;
+ for (int i = 0; i < status.length; i++) {
+ IStatus curr = status[i];
if (curr.matches(IStatus.ERROR)) {
return curr;
}
if (max == null || curr.getSeverity() > max.getSeverity()) {
- max= curr;
+ max = curr;
}
}
return max;
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 ba3a32d4d7a..749766412a5 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
@@ -27,33 +27,36 @@ public class StringMatcher {
protected String fSegments[]; //the given pattern is split into * separated segments
/* boundary value beyond which we don't need to search in the text */
- protected int fBound= 0;
+ protected int fBound = 0;
- protected static final char fSingleWildCard= '\u0000';
+ protected static final char fSingleWildCard = '\u0000';
public static class Position {
int start; //inclusive
int end; //exclusive
+
public Position(int start, int end) {
- this.start= start;
- this.end= end;
+ this.start = start;
+ this.end = end;
}
+
public int getStart() {
return start;
}
+
public int getEnd() {
return end;
}
}
/**
- * Find the first occurrence of the pattern between <code>start</code)(inclusive)
- * and <code>end</code>(exclusive).
- * @param text the String object to search in
+ * Find the first occurrence of the pattern between <code>start</code)(inclusive)
+ * and <code>end</code>(exclusive).
+ * @param text the String object to search in
* @param start the starting index of the search range, inclusive
* @param end the ending index of the search range, exclusive
- * @return an <code>StringMatcher.Position</code> object that keeps the starting
- * (inclusive) and ending positions (exclusive) of the first occurrence of the
+ * @return an <code>StringMatcher.Position</code> object that keeps the starting
+ * (inclusive) and ending positions (exclusive) of the first occurrence of the
* pattern in the specified range of the text; return null if not found or subtext
* is empty (start==end). A pair of zeros is returned if pattern is empty string
* Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
@@ -64,41 +67,42 @@ public class StringMatcher {
if (fPattern == null || text == null)
throw new IllegalArgumentException();
- int tlen= text.length();
+ int tlen = text.length();
if (start < 0)
- start= 0;
+ start = 0;
if (end > tlen)
- end= tlen;
+ end = tlen;
if (end < 0 || start >= end)
return null;
if (fLength == 0)
return new Position(start, start);
if (fIgnoreWildCards) {
- int x= posIn(text, start, end);
+ int x = posIn(text, start, end);
if (x < 0)
return null;
return new Position(x, x + fLength);
}
- int segCount= fSegments.length;
+ int segCount = fSegments.length;
if (segCount == 0) //pattern contains only '*'(s)
return new Position(start, end);
- int curPos= start;
- int matchStart= -1;
- for (int i= 0; i < segCount && curPos < end; ++i) {
- String current= fSegments[i];
- int nextMatch= regExpPosIn(text, curPos, end, current);
+ int curPos = start;
+ int matchStart = -1;
+ for (int i = 0; i < segCount && curPos < end; ++i) {
+ String current = fSegments[i];
+ int nextMatch = regExpPosIn(text, curPos, end, current);
if (nextMatch < 0)
return null;
if (i == 0)
- matchStart= nextMatch;
- curPos= nextMatch + current.length();
+ matchStart = nextMatch;
+ curPos = nextMatch + current.length();
}
return new Position(matchStart, curPos);
}
+
/**
- * StringMatcher constructor takes in a String object that is a simple
+ * StringMatcher constructor takes in a String object that is a simple
* pattern which may contain *  for 0 and many characters and
* ?  for exactly one character. Also takes as parameter a boolean object
* specifying if case should be ignored
@@ -108,15 +112,16 @@ public class StringMatcher {
public StringMatcher(String aPattern, boolean ignoreCase) {
this(aPattern, ignoreCase, false);
}
+
/**
- * StringMatcher constructor takes in a String object that is a simple
+ * StringMatcher constructor takes in a String object that is a simple
* pattern which may contain *  for 0 and many characters and
- * ?  for exactly one character.
+ * ?  for exactly one character.
*
- * Literal '*' and '?' characters must be escaped in the pattern
+ * Literal '*' and '?' characters must be escaped in the pattern
* e.g., "\*" means literal "*", etc.
*
- * Escaping any other character (including the escape character itself),
+ * Escaping any other character (including the escape character itself),
* just results in that character in the pattern.
* e.g., "\a" means "a" and "\\" means "\"
*
@@ -129,15 +134,15 @@ public class StringMatcher {
* (everything is taken literally).
*/
public StringMatcher(String aPattern, boolean ignoreCase, boolean ignoreWildCards) {
- fIgnoreCase= ignoreCase;
- fIgnoreWildCards= ignoreWildCards;
- fLength= aPattern.length();
+ fIgnoreCase = ignoreCase;
+ fIgnoreWildCards = ignoreWildCards;
+ fLength = aPattern.length();
/* convert case */
if (fIgnoreCase) {
- fPattern= aPattern.toUpperCase();
+ fPattern = aPattern.toUpperCase();
} else {
- fPattern= aPattern;
+ fPattern = aPattern;
}
if (fIgnoreWildCards) {
@@ -146,13 +151,14 @@ public class StringMatcher {
parseWildCards();
}
}
+
/**
- * Given the starting (inclusive) and the ending (exclusive) poisitions in the
- * <code>text</code>, determine if the given substring matches with aPattern
+ * Given the starting (inclusive) and the ending (exclusive) poisitions in the
+ * <code>text</code>, determine if the given substring matches with aPattern
* @return true if the specified portion of the text matches the pattern
- * @param text a String object that contains the substring to match
+ * @param text a String object that contains the substring to match
* @param start marks the starting position (inclusive) of the substring
- * @param end marks the ending index (exclusive) of the substring
+ * @param end marks the ending index (exclusive) of the substring
*/
public boolean match(String text, int start, int end) {
if (null == fPattern || null == text)
@@ -163,7 +169,7 @@ public class StringMatcher {
if (fIgnoreWildCards)
return fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
- int segCount= fSegments.length;
+ int segCount = fSegments.length;
if (segCount == 0) //pattern contains only '*'(s) or empty pattern
return true;
if (start == end)
@@ -171,19 +177,19 @@ public class StringMatcher {
if (fLength == 0)
return start == end;
- int tlen= text.length();
+ int tlen = text.length();
if (start < 0)
- start= 0;
+ start = 0;
if (end > tlen)
- end= tlen;
+ end = tlen;
- int tCurPos= start;
- int bound= end - fBound;
+ int tCurPos = start;
+ int bound = end - fBound;
if (bound < 0)
return false;
- int i= 0;
- String current= fSegments[i];
- int segLength= current.length();
+ int i = 0;
+ String current = fSegments[i];
+ int segLength = current.length();
/* process first segment */
if (!fHasLeadingStar) {
@@ -191,99 +197,102 @@ public class StringMatcher {
return false;
}
++i;
- tCurPos= tCurPos + segLength;
+ tCurPos = tCurPos + segLength;
}
/* process middle segments */
for (; i < segCount && tCurPos <= bound; ++i) {
- current= fSegments[i];
+ current = fSegments[i];
int currentMatch;
- int k= current.indexOf(fSingleWildCard);
+ int k = current.indexOf(fSingleWildCard);
if (k < 0) {
- currentMatch= textPosIn(text, tCurPos, end, current);
+ currentMatch = textPosIn(text, tCurPos, end, current);
if (currentMatch < 0)
return false;
} else {
- currentMatch= regExpPosIn(text, tCurPos, end, current);
+ currentMatch = regExpPosIn(text, tCurPos, end, current);
if (currentMatch < 0)
return false;
}
- tCurPos= currentMatch + current.length();
+ tCurPos = currentMatch + current.length();
}
/* process final segment */
if (!fHasTrailingStar && tCurPos != end) {
- int clen= current.length();
+ int clen = current.length();
return regExpRegionMatches(text, end - clen, current, 0, clen);
}
return i == segCount;
}
+
/**
- * match the given <code>text</code> with the pattern
+ * match the given <code>text</code> with the pattern
* @return true if matched eitherwise false
- * @param text a String object
+ * @param text a String object
*/
public boolean match(String text) {
return match(text, 0, text.length());
}
+
/**
* This method parses the given pattern into segments seperated by wildcard '*' characters.
* Since wildcards are not being used in this case, the pattern consists of a single segment.
*/
private void parseNoWildCards() {
- fSegments= new String[1];
- fSegments[0]= fPattern;
- fBound= fLength;
+ fSegments = new String[1];
+ fSegments[0] = fPattern;
+ fBound = fLength;
}
+
/**
* This method parses the given pattern into segments seperated by wildcard '*' characters.
*/
private void parseWildCards() {
if (fPattern.startsWith("*")) //$NON-NLS-1$
- fHasLeadingStar= true;
+ fHasLeadingStar = true;
if (fPattern.endsWith("*")) { //$NON-NLS-1$
/* make sure it's not an escaped wildcard */
if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
- fHasTrailingStar= true;
+ fHasTrailingStar = true;
}
}
Vector<String> temp = new Vector<>();
- int pos= 0;
- StringBuilder buf= new StringBuilder();
+ int pos = 0;
+ StringBuilder buf = new StringBuilder();
while (pos < fLength) {
- char c= fPattern.charAt(pos++);
+ char c = fPattern.charAt(pos++);
switch (c) {
- case '\\' :
- if (pos >= fLength) {
- buf.append(c);
+ case '\\':
+ if (pos >= fLength) {
+ buf.append(c);
+ } else {
+ char next = fPattern.charAt(pos++);
+ /* if it's an escape sequence */
+ if (next == '*' || next == '?' || next == '\\') {
+ buf.append(next);
} else {
- char next= fPattern.charAt(pos++);
- /* if it's an escape sequence */
- if (next == '*' || next == '?' || next == '\\') {
- buf.append(next);
- } else {
- /* not an escape sequence, just insert literally */
- buf.append(c);
- buf.append(next);
- }
- }
- break;
- case '*' :
- if (buf.length() > 0) {
- /* new segment */
- temp.addElement(buf.toString());
- fBound += buf.length();
- buf.setLength(0);
+ /* not an escape sequence, just insert literally */
+ buf.append(c);
+ buf.append(next);
}
- break;
- case '?' :
- /* append special character representing single match wildcard */
- buf.append(fSingleWildCard);
- break;
- default :
- buf.append(c);
+ }
+ break;
+ case '*':
+ if (buf.length() > 0) {
+ /* new segment */
+ temp.addElement(buf.toString());
+ fBound += buf.length();
+ buf.setLength(0);
+ }
+ break;
+ case '?':
+ /* append special character representing single match wildcard */
+ buf.append(fSingleWildCard);
+ break;
+ default:
+ buf.append(c);
}
}
@@ -293,44 +302,46 @@ public class StringMatcher {
fBound += buf.length();
}
- fSegments= new String[temp.size()];
+ fSegments = new String[temp.size()];
temp.copyInto(fSegments);
}
- /**
+
+ /**
* @param text a string which contains no wildcard
* @param start the starting index in the text for search, inclusive
* @param end the stopping point of search, exclusive
- * @return the starting index in the text of the pattern , or -1 if not found
+ * @return the starting index in the text of the pattern , or -1 if not found
*/
protected int posIn(String text, int start, int end) { //no wild card in pattern
- int max= end - fLength;
+ int max = end - fLength;
if (!fIgnoreCase) {
- int i= text.indexOf(fPattern, start);
+ int i = text.indexOf(fPattern, start);
if (i == -1 || i > max)
return -1;
return i;
}
- for (int i= start; i <= max; ++i) {
+ for (int i = start; i <= max; ++i) {
if (text.regionMatches(true, i, fPattern, 0, fLength))
return i;
}
return -1;
}
- /**
+
+ /**
* @param text a simple regular expression that may only contain '?'(s)
* @param start the starting index in the text for search, inclusive
* @param end the stopping point of search, exclusive
* @param p a simple regular expression that may contains '?'
- * @return the starting index in the text of the pattern , or -1 if not found
+ * @return the starting index in the text of the pattern , or -1 if not found
*/
protected int regExpPosIn(String text, int start, int end, String p) {
- int plen= p.length();
+ int plen = p.length();
- int max= end - plen;
- for (int i= start; i <= max; ++i) {
+ int max = end - plen;
+ for (int i = start; i <= max; ++i) {
if (regExpRegionMatches(text, i, p, 0, plen))
return i;
}
@@ -339,8 +350,8 @@ public class StringMatcher {
protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
while (plen-- > 0) {
- char tchar= text.charAt(tStart++);
- char pchar= p.charAt(pStart++);
+ char tchar = text.charAt(tStart++);
+ char pchar = p.charAt(pStart++);
/* process wild cards */
if (!fIgnoreWildCards) {
@@ -352,7 +363,7 @@ public class StringMatcher {
if (pchar == tchar)
continue;
if (fIgnoreCase) {
- char tc= Character.toUpperCase(tchar);
+ char tc = Character.toUpperCase(tchar);
if (tc == pchar)
continue;
}
@@ -360,26 +371,27 @@ public class StringMatcher {
}
return true;
}
- /**
+
+ /**
* @param text the string to match
* @param start the starting index in the text for search, inclusive
* @param end the stopping point of search, exclusive
* @param p a string that has no wildcard
- * @return the starting index in the text of the pattern , or -1 if not found
+ * @return the starting index in the text of the pattern , or -1 if not found
*/
protected int textPosIn(String text, int start, int end, String p) {
- int plen= p.length();
- int max= end - plen;
+ int plen = p.length();
+ int max = end - plen;
if (!fIgnoreCase) {
- int i= text.indexOf(p, start);
+ int i = text.indexOf(p, start);
if (i == -1 || i > max)
return -1;
return i;
}
- for (int i= 0; i <= max; ++i) {
+ for (int i = 0; i <= max; ++i) {
if (text.regionMatches(true, i, p, 0, plen))
return i;
}
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 124ab78ea18..b1e6b5f4702 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
@@ -21,15 +21,15 @@ import org.eclipse.cdt.make.core.makefile.ITargetRule;
* statement : rule | macro_definition | comments | empty
* rule : inference_rule | target_rule
* inference_rule : target ':' <nl> ( <tab> command <nl> ) +
- * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
+ * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] <nl>
[ ( <tab> prefix_command command ) * ]
- * macro_definition : string '=' (string)*
+ * macro_definition : string '=' (string)*
* comments : '#' (string) *
* empty : <nl>
* command : string <nl>
* target : string
* prefix_command : '-' | '@' | '+'
- * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
+ * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%"
*/
public class TargetRule extends Rule implements ITargetRule {
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 aaae510e109..21ab48eb3c8 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
@@ -24,7 +24,8 @@ public class TargetVariable extends GNUVariableDef {
boolean override;
- public TargetVariable(Directive parent, String target, String name, StringBuffer value, boolean override, int type) {
+ public TargetVariable(Directive parent, String target, String name, StringBuffer value, boolean override,
+ int type) {
super(parent, target, name, value, type);
this.override = override;
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TwoArrayQuickSort.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TwoArrayQuickSort.java
index dbec276fc01..719ab5f9d99 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TwoArrayQuickSort.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/TwoArrayQuickSort.java
@@ -16,59 +16,60 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake;
import org.eclipse.core.runtime.Assert;
-
/**
* Quick sort to sort two arrays in parallel.
*/
public class TwoArrayQuickSort {
- private static void internalSort(String[] keys, Object[] values, int left, int right, boolean ignoreCase) {
-
- int originalLeft= left;
- int originalRight= right;
-
- String mid= keys[(left + right) >>> 1];
- do {
- while (smaller(keys[left], mid, ignoreCase)) {
- left++;
- }
- while (smaller(mid, keys[right], ignoreCase)) {
- right--;
- }
- if (left <= right) {
- String tmp= keys[left];
- keys[left]= keys[right];
- keys[right]= tmp;
-
- Object tmp2= values[left];
- values[left]= values[right];
- values[right]= tmp2;
-
- left++;
- right--;
- }
+ private static void internalSort(String[] keys, Object[] values, int left, int right, boolean ignoreCase) {
+
+ int originalLeft = left;
+ int originalRight = right;
+
+ String mid = keys[(left + right) >>> 1];
+ do {
+ while (smaller(keys[left], mid, ignoreCase)) {
+ left++;
+ }
+ while (smaller(mid, keys[right], ignoreCase)) {
+ right--;
+ }
+ if (left <= right) {
+ String tmp = keys[left];
+ keys[left] = keys[right];
+ keys[right] = tmp;
+
+ Object tmp2 = values[left];
+ values[left] = values[right];
+ values[right] = tmp2;
+
+ left++;
+ right--;
+ }
} while (left <= right);
-
+
if (originalLeft < right) {
- internalSort(keys , values, originalLeft, right, ignoreCase);
- }
+ internalSort(keys, values, originalLeft, right, ignoreCase);
+ }
if (left < originalRight) {
- internalSort(keys, values, left, originalRight, ignoreCase);
- }
+ internalSort(keys, values, left, originalRight, ignoreCase);
+ }
}
+
private static boolean smaller(String left, String right, boolean ignoreCase) {
if (ignoreCase)
return left.compareToIgnoreCase(right) < 0;
- return left.compareTo(right) < 0;
+ return left.compareTo(right) < 0;
}
+
/**
* Sorts keys and values in parallel.
*/
- public static void sort(String[] keys, Object[] values, boolean ignoreCase) {
+ public static void sort(String[] keys, Object[] values, boolean ignoreCase) {
if (keys != null && values != null) {
Assert.isTrue(keys.length == values.length);
if (keys.length > 1)
- internalSort(keys, values, 0, keys.length - 1, ignoreCase);
+ internalSort(keys, values, 0, keys.length - 1, ignoreCase);
} else {
if (keys != null || values != null)
Assert.isTrue(false, "Either keys or values in null"); //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Util.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Util.java
index 3df8aacefe2..e97fcfae7a4 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Util.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/editors/automake/Util.java
@@ -41,7 +41,7 @@ public class Util {
}
public static boolean isSpace(char c) {
- return (c == ' ' || c == '\t' || c == '\r' || c == '\n');
+ return (c == ' ' || c == '\t' || c == '\r' || c == '\n');
}
public static int indexOf(String line, char c) {
@@ -61,7 +61,7 @@ public class Util {
char ch = line.charAt(i);
if (ch == '(' && prev == '$' && pprev != '\\') {
paren++;
- } else if (ch == '{' && prev == '$' && pprev != '\\') {
+ } else if (ch == '{' && prev == '$' && pprev != '\\') {
bracket++;
} else if (ch == ')' && prev != '\\') {
if (paren > 0) {
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 c5d5036c5b1..3da36aaf781 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
@@ -17,7 +17,7 @@ import org.eclipse.cdt.make.core.makefile.gnu.IVariableDefinition;
/**
*/
-public class VariableDefinition extends MacroDefinition implements IVariableDefinition {
+public class VariableDefinition extends MacroDefinition implements IVariableDefinition {
/**
* ? is Conditional
@@ -37,7 +37,7 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi
}
public VariableDefinition(Directive parent, String name, StringBuffer value, int type) {
- this(parent, "", name, value, type); //$NON-NLS-1$
+ this(parent, "", name, value, type); //$NON-NLS-1$
}
public VariableDefinition(Directive parent, String target, String name, StringBuffer value, int type) {
@@ -91,12 +91,12 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi
public boolean isSimplyExpanded() {
return type == TYPE_SIMPLE_EXPAND;
}
-
+
@Override
public boolean isConditional() {
return type == TYPE_CONDITIONAL;
}
-
+
@Override
public boolean isAppend() {
return type == TYPE_APPEND;
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 fafa1bde367..e9d8004d2a6 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
@@ -18,9 +18,9 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
-
+
/**
- * Used to scan and detect for SQL keywords
+ * Used to scan and detect for SQL keywords
*/
public class WordPartDetector {
String wordPart = ""; //$NON-NLS-1$
@@ -28,7 +28,7 @@ public class WordPartDetector {
/**
* WordPartDetector.
- * @param viewer is a text viewer
+ * @param viewer is a text viewer
* @param documentOffset into the SQL document
*/
public WordPartDetector(ITextViewer viewer, int documentOffset) {
@@ -36,13 +36,13 @@ public class WordPartDetector {
}
/**
- *
+ *
* @param doc
* @param documentOffset
*/
public WordPartDetector(IDocument doc, int documentOffset) {
offset = documentOffset - 1;
- int endOffset = documentOffset;
+ int endOffset = documentOffset;
try {
IRegion region = doc.getLineInformationOfOffset(documentOffset);
int top = region.getOffset();
@@ -51,8 +51,8 @@ public class WordPartDetector {
offset--;
}
while (endOffset < bottom && isMakefileLetter(doc.getChar(endOffset))) {
- endOffset++;
- }
+ endOffset++;
+ }
//we've been one step too far : increase the offset
offset++;
wordPart = doc.get(offset, endOffset - offset);
@@ -64,7 +64,7 @@ public class WordPartDetector {
public static boolean inMacro(ITextViewer viewer, int offset) {
return inMacro(viewer.getDocument(), offset);
}
-
+
public static boolean inMacro(IDocument document, int offset) {
boolean isMacro = false;
// Try to figure out if we are in a Macro.
@@ -84,12 +84,11 @@ public class WordPartDetector {
return isMacro;
}
-
@Override
public String toString() {
return wordPart;
}
-
+
public int getOffset() {
return offset;
}
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 b1929168a46..ea29dff6a28 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
@@ -14,7 +14,6 @@
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
-
import java.util.HashMap;
import java.util.Map;
@@ -25,13 +24,12 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorInput;
-
/**
* This working copy manager works together with a given compilation unit document provider and
* additionally offers to "overwrite" the working copy provided by this document provider.
*/
public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension {
-
+
private IMakefileDocumentProvider fDocumentProvider;
private Map<IEditorInput, IMakefile> fMap;
private boolean fIsShuttingDown;
@@ -39,59 +37,59 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
/**
* Creates a new working copy manager that co-operates with the given
* compilation unit document provider.
- *
+ *
* @param provider the provider
*/
public WorkingCopyManager(IMakefileDocumentProvider provider) {
Assert.isNotNull(provider);
- fDocumentProvider= provider;
+ fDocumentProvider = provider;
}
@Override
public void connect(IEditorInput input) throws CoreException {
fDocumentProvider.connect(input);
}
-
+
@Override
public void disconnect(IEditorInput input) {
fDocumentProvider.disconnect(input);
}
-
+
@Override
public void shutdown() {
if (!fIsShuttingDown) {
- fIsShuttingDown= true;
+ fIsShuttingDown = true;
try {
if (fMap != null) {
fMap.clear();
- fMap= null;
+ fMap = null;
}
fDocumentProvider.shutdown();
} finally {
- fIsShuttingDown= false;
+ fIsShuttingDown = false;
}
}
}
@Override
public IMakefile getWorkingCopy(IEditorInput input) {
- IMakefile unit= fMap == null ? null : (IMakefile) fMap.get(input);
+ IMakefile unit = fMap == null ? null : (IMakefile) fMap.get(input);
return unit != null ? unit : fDocumentProvider.getWorkingCopy(input);
}
-
+
@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);
}
}
-
+
@Override
public void removeWorkingCopy(IEditorInput input) {
fMap.remove(input);
if (fMap.isEmpty())
- fMap= null;
+ fMap = null;
}
}
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 7ff2d863cdd..4ed3f92a270 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
@@ -46,64 +46,64 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.osgi.service.prefs.BackingStoreException;
-
/**
* AbstraceMakeEditorPreferencePage
*/
public abstract class AbstractEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
OverlayPreferenceStore fOverlayStore;
-
- Map<Button, String> fCheckBoxes= new HashMap<>();
- private SelectionListener fCheckBoxListener= new SelectionListener() {
+
+ Map<Button, String> 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;
+ Button button = (Button) e.widget;
fOverlayStore.setValue(fCheckBoxes.get(button), button.getSelection());
}
};
-
- Map<Text, String> fTextFields= new HashMap<>();
+
+ Map<Text, String> fTextFields = new HashMap<>();
private ModifyListener fTextFieldListener = e -> {
Text text = (Text) e.widget;
fOverlayStore.setValue(fTextFields.get(text), text.getText());
};
- private Map<Text, Object> fNumberFields= new HashMap<>();
+ private Map<Text, Object> fNumberFields = new HashMap<>();
private ModifyListener fNumberFieldListener = e -> numberFieldChanged((Text) e.widget);
-
+
public AbstractEditorPreferencePage() {
super();
setPreferenceStore(AutotoolsPlugin.getDefault().getPreferenceStore());
- fOverlayStore= createOverlayStore();
+ fOverlayStore = createOverlayStore();
}
-
+
protected abstract OverlayPreferenceStore createOverlayStore();
-
+
@Override
public void init(IWorkbench workbench) {
}
-
+
protected void initializeFields() {
- Map<Button, String> checkBoxes= getCheckBoxes();
- Map<Text, String> textFields= getTextFields();
- Iterator<Button> e= checkBoxes.keySet().iterator();
+ Map<Button, String> checkBoxes = getCheckBoxes();
+ Map<Text, String> textFields = getTextFields();
+ Iterator<Button> e = checkBoxes.keySet().iterator();
while (e.hasNext()) {
- Button b= e.next();
- String key= checkBoxes.get(b);
+ Button b = e.next();
+ String key = checkBoxes.get(b);
b.setSelection(getOverlayStore().getBoolean(key));
}
-
+
Iterator<Text> e2 = textFields.keySet().iterator();
while (e.hasNext()) {
- Text t= e2.next();
- String key= textFields.get(t);
+ Text t = e2.next();
+ String key = textFields.get(t);
t.setText(getOverlayStore().getString(key));
- }
+ }
}
-
+
@Override
public boolean performOk() {
getOverlayStore().propagate();
@@ -116,27 +116,27 @@ public abstract class AbstractEditorPreferencePage extends PreferencePage implem
}
return true;
}
-
+
protected OverlayPreferenceStore getOverlayStore() {
return fOverlayStore;
}
-
+
protected OverlayPreferenceStore setOverlayStore() {
return fOverlayStore;
}
-
+
protected Map<Button, String> getCheckBoxes() {
return fCheckBoxes;
}
-
+
protected Map<Text, String> getTextFields() {
return fTextFields;
}
-
+
protected Map<Text, Object> getNumberFields() {
return fNumberFields;
}
-
+
@Override
protected void performDefaults() {
getOverlayStore().loadDefaults();
@@ -144,48 +144,49 @@ public abstract class AbstractEditorPreferencePage extends PreferencePage implem
handleDefaults();
super.performDefaults();
}
-
+
protected abstract void handleDefaults();
-
+
@Override
public void dispose() {
if (getOverlayStore() != null) {
getOverlayStore().stop();
- fOverlayStore= null;
+ fOverlayStore = null;
}
super.dispose();
}
-
- protected Button addCheckBox(Composite parent, String labelText, String key, int indentation) {
- Button checkBox= new Button(parent, SWT.CHECK);
+
+ protected Button addCheckBox(Composite parent, String labelText, String key, int indentation) {
+ Button checkBox = new Button(parent, SWT.CHECK);
checkBox.setText(labelText);
checkBox.setFont(parent.getFont());
-
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent= indentation;
- gd.horizontalSpan= 2;
+
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.horizontalIndent = indentation;
+ gd.horizontalSpan = 2;
checkBox.setLayoutData(gd);
checkBox.addSelectionListener(fCheckBoxListener);
-
+
getCheckBoxes().put(checkBox, key);
-
+
return checkBox;
}
-
- protected Control addTextField(Composite composite, String labelText, String key, int textLimit, int indentation, String[] errorMessages) {
- Font font= composite.getFont();
-
- Label label= new Label(composite, SWT.NONE);
+
+ protected Control addTextField(Composite composite, String labelText, String key, int textLimit, int indentation,
+ String[] errorMessages) {
+ Font font = composite.getFont();
+
+ Label label = new Label(composite, SWT.NONE);
label.setText(labelText);
label.setFont(font);
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent= indentation;
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.horizontalIndent = indentation;
label.setLayoutData(gd);
-
- Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
- textControl.setFont(font);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.widthHint= convertWidthInCharsToPixels(textLimit + 1);
+
+ Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
+ textControl.setFont(font);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
textControl.setLayoutData(gd);
textControl.setTextLimit(textLimit);
getTextFields().put(textControl, key);
@@ -195,44 +196,44 @@ public abstract class AbstractEditorPreferencePage extends PreferencePage implem
} else {
textControl.addModifyListener(fTextFieldListener);
}
-
+
return textControl;
}
-
+
void numberFieldChanged(Text textControl) {
- String number= textControl.getText();
- IStatus status= validatePositiveNumber(number, (String[])getNumberFields().get(textControl));
+ String number = textControl.getText();
+ IStatus status = validatePositiveNumber(number, (String[]) getNumberFields().get(textControl));
if (!status.matches(IStatus.ERROR)) {
getOverlayStore().setValue(getTextFields().get(textControl), number);
}
updateStatus(status);
}
-
+
private IStatus validatePositiveNumber(String number, String[] errorMessages) {
- StatusInfo status= new StatusInfo();
+ StatusInfo status = new StatusInfo();
if (number.length() == 0) {
status.setError(errorMessages[0]);
} else {
try {
- int value= Integer.parseInt(number);
+ int value = Integer.parseInt(number);
if (value < 0)
- status.setError(MessageFormat.format(errorMessages[1], new Object[]{number})); //$NON-NLS-1$
+ status.setError(MessageFormat.format(errorMessages[1], new Object[] { number })); //$NON-NLS-1$
} catch (NumberFormatException e) {
- status.setError(MessageFormat.format(errorMessages[1], new Object[]{number})); //$NON-NLS-1$
+ status.setError(MessageFormat.format(errorMessages[1], new Object[] { number })); //$NON-NLS-1$
}
}
return status;
}
-
+
private void updateStatus(IStatus status) {
if (!status.matches(IStatus.ERROR)) {
- Set<Text> keys= getNumberFields().keySet();
+ Set<Text> keys = getNumberFields().keySet();
for (Iterator<Text> iter = keys.iterator(); iter.hasNext();) {
Text text = iter.next();
- IStatus s= validatePositiveNumber(text.getText(), (String[])getNumberFields().get(text));
- status= s.getSeverity() > status.getSeverity() ? s : status;
+ IStatus s = validatePositiveNumber(text.getText(), (String[]) getNumberFields().get(text));
+ status = s.getSeverity() > status.getSeverity() ? s : status;
}
- }
+ }
setValid(!status.matches(IStatus.ERROR));
applyToStatusLine(this, status);
}
@@ -241,47 +242,48 @@ public abstract class AbstractEditorPreferencePage extends PreferencePage implem
* Applies the status to the status line of a dialog page.
*/
private void applyToStatusLine(DialogPage page, IStatus status) {
- String message= status.getMessage();
+ String message = status.getMessage();
switch (status.getSeverity()) {
- case IStatus.OK:
- page.setMessage(message, IMessageProvider.NONE);
- page.setErrorMessage(null);
- break;
- case IStatus.WARNING:
- page.setMessage(message, IMessageProvider.WARNING);
- page.setErrorMessage(null);
- break;
- case IStatus.INFO:
- page.setMessage(message, IMessageProvider.INFORMATION);
- page.setErrorMessage(null);
- break;
- default:
- if (message.length() == 0) {
- message= null;
- }
- page.setMessage(null);
- page.setErrorMessage(message);
- break;
+ case IStatus.OK:
+ page.setMessage(message, IMessageProvider.NONE);
+ page.setErrorMessage(null);
+ break;
+ case IStatus.WARNING:
+ page.setMessage(message, IMessageProvider.WARNING);
+ page.setErrorMessage(null);
+ break;
+ case IStatus.INFO:
+ page.setMessage(message, IMessageProvider.INFORMATION);
+ page.setErrorMessage(null);
+ break;
+ default:
+ if (message.length() == 0) {
+ message = null;
+ }
+ page.setMessage(null);
+ page.setErrorMessage(message);
+ break;
}
}
-
+
/**
* Returns an array of size 2:
* - first element is of type <code>Label</code>
* - second element is of type <code>Text</code>
* Use <code>getLabelControl</code> and <code>getTextControl</code> to get the 2 controls.
*/
- protected Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, String[] errorMessages) {
- Label labelControl= new Label(composite, SWT.NONE);
+ protected Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit,
+ int indentation, String[] errorMessages) {
+ Label labelControl = new Label(composite, SWT.NONE);
labelControl.setText(label);
labelControl.setFont(composite.getFont());
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent= indentation;
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.horizontalIndent = indentation;
labelControl.setLayoutData(gd);
-
- Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.widthHint= convertWidthInCharsToPixels(textLimit + 1);
+
+ Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
textControl.setLayoutData(gd);
textControl.setTextLimit(textLimit);
textControl.setFont(composite.getFont());
@@ -292,18 +294,18 @@ public abstract class AbstractEditorPreferencePage extends PreferencePage implem
} else {
textControl.addModifyListener(fTextFieldListener);
}
-
- return new Control[]{labelControl, textControl};
+
+ return new Control[] { labelControl, textControl };
}
-
+
protected String loadPreviewContentFromFile(String filename) {
String line;
- String separator= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- StringBuilder buffer= new StringBuilder(512);
- BufferedReader reader= null;
+ String separator = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ StringBuilder buffer = new StringBuilder(512);
+ BufferedReader reader = null;
try {
- reader= new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename)));
- while ((line= reader.readLine()) != null) {
+ reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(filename)));
+ while ((line = reader.readLine()) != null) {
buffer.append(line);
buffer.append(separator);
}
@@ -311,7 +313,10 @@ public abstract class AbstractEditorPreferencePage extends PreferencePage implem
AutotoolsUIPlugin.log(io);
} finally {
if (reader != null) {
- try { reader.close(); } catch (IOException e) {}
+ try {
+ reader.close();
+ } catch (IOException e) {
+ }
}
}
return buffer.toString();
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutoconfEditorPreferencePage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutoconfEditorPreferencePage.java
index 253b0d769e7..424e1ee087b 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutoconfEditorPreferencePage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutoconfEditorPreferencePage.java
@@ -46,40 +46,38 @@ import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.model.WorkbenchViewerComparator;
-
-
/**
* MakeEditorPreferencePage
* The page for setting the editor options.
*/
public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
- private static String[] fACVersions = {"2.13", "2.59", "2.61", "2.68"};
+ private static String[] fACVersions = { "2.13", "2.59", "2.61", "2.68" };
public static final String LATEST_AC_VERSION = fACVersions[fACVersions.length - 1];
-
- private static String[] fAMVersions = {"1.4-p6", "1.9.5", "1.9.6", "1.11.1"};
+
+ private static String[] fAMVersions = { "1.4-p6", "1.9.5", "1.9.6", "1.11.1" };
public static final String LATEST_AM_VERSION = fAMVersions[fAMVersions.length - 1];
-
+
/** The keys of the overlay store. */
private String[][] fSyntaxColorListModel;
private TableViewer fHighlightingColorListViewer;
- private final List<HighlightingColorListItem> fHighlightingColorList= new ArrayList<>(5);
+ private final List<HighlightingColorListItem> fHighlightingColorList = new ArrayList<>(5);
ColorEditor fSyntaxForegroundColorEditor;
Button fBoldCheckBox;
Button fItalicCheckBox;
-
+
// folding
protected Button fFoldingCheckbox;
-
+
// version
protected Combo fACVersionCombo;
protected Combo fAMVersionCombo;
-
+
/**
* Item in the highlighting color list.
- *
+ *
* @since 3.0
*/
private static class HighlightingColorListItem {
@@ -93,52 +91,53 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
private String fItalicKey;
/** Item color */
private Color fItemColor;
-
+
/**
* Initialize the item with the given values.
- *
+ *
* @param displayName the display name
* @param colorKey the color preference key
* @param boldKey the bold preference key
* @param italicKey the italic preference key
* @param itemColor the item color
*/
- public HighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey, Color itemColor) {
- fDisplayName= displayName;
- fColorKey= colorKey;
- fBoldKey= boldKey;
- fItalicKey= italicKey;
- fItemColor= itemColor;
+ public HighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey,
+ Color itemColor) {
+ fDisplayName = displayName;
+ fColorKey = colorKey;
+ fBoldKey = boldKey;
+ fItalicKey = italicKey;
+ fItemColor = itemColor;
}
-
+
/**
* @return the bold preference key
*/
public String getBoldKey() {
return fBoldKey;
}
-
+
/**
* @return the bold preference key
*/
public String getItalicKey() {
return fItalicKey;
}
-
+
/**
* @return the color preference key
*/
public String getColorKey() {
return fColorKey;
}
-
+
/**
* @return the display name
*/
public String getDisplayName() {
return fDisplayName;
}
-
+
/**
* @return the item color
*/
@@ -149,19 +148,19 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
/**
* Color list label provider.
- *
+ *
* @since 3.0
*/
private static class ColorListLabelProvider extends LabelProvider implements IColorProvider {
@Override
public String getText(Object element) {
- return ((HighlightingColorListItem)element).getDisplayName();
+ return ((HighlightingColorListItem) element).getDisplayName();
}
-
+
@Override
public Color getForeground(Object element) {
- return ((HighlightingColorListItem)element).getItemColor();
+ return ((HighlightingColorListItem) element).getItemColor();
}
@Override
@@ -169,10 +168,10 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
return null;
}
}
-
+
/**
* Color list content provider.
- *
+ *
* @since 3.0
*/
private static class ColorListContentProvider implements IStructuredContentProvider {
@@ -180,7 +179,7 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
@Override
@SuppressWarnings("unchecked")
public Object[] getElements(Object inputElement) {
- return ((List<Object>)inputElement).toArray();
+ return ((List<Object>) inputElement).toArray();
}
@Override
@@ -191,11 +190,9 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
-
-
/**
- *
+ *
*/
public AutoconfEditorPreferencePage() {
super();
@@ -203,98 +200,115 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
@Override
protected OverlayPreferenceStore createOverlayStore() {
- fSyntaxColorListModel= new String[][] {
- {AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_comment"), ColorManager.AUTOCONF_COMMENT_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_acmacro"), ColorManager.AUTOCONF_ACMACRO_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_ammacro"), ColorManager.AUTOCONF_AMMACRO_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_code_seq"), ColorManager.AUTOCONF_CODESEQ_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_keyword"), ColorManager.AUTOCONF_KEYWORD_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_var_ref"), ColorManager.AUTOCONF_VAR_REF_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_var_set"), ColorManager.AUTOCONF_VAR_SET_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_default"), ColorManager.AUTOCONF_DEFAULT_COLOR, null}, //$NON-NLS-1$
- };
+ fSyntaxColorListModel = new String[][] {
+ { AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_comment"), //$NON-NLS-1$
+ ColorManager.AUTOCONF_COMMENT_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_acmacro"), //$NON-NLS-1$
+ ColorManager.AUTOCONF_ACMACRO_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_ammacro"), //$NON-NLS-1$
+ ColorManager.AUTOCONF_AMMACRO_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_code_seq"), //$NON-NLS-1$
+ ColorManager.AUTOCONF_CODESEQ_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_keyword"), //$NON-NLS-1$
+ ColorManager.AUTOCONF_KEYWORD_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_var_ref"), //$NON-NLS-1$
+ ColorManager.AUTOCONF_VAR_REF_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_var_set"), //$NON-NLS-1$
+ ColorManager.AUTOCONF_VAR_SET_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconf_editor_default"), //$NON-NLS-1$
+ ColorManager.AUTOCONF_DEFAULT_COLOR, null }, };
List<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<>();
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_CONDITIONAL));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_MACRODEF));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_RULE));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION));
-
- for (int i= 0; i < fSyntaxColorListModel.length; i++) {
- String colorKey= fSyntaxColorListModel[i][1];
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_CONDITIONAL));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_MACRODEF));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_RULE));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION));
+
+ for (int i = 0; i < fSyntaxColorListModel.length; i++) {
+ String colorKey = fSyntaxColorListModel[i][1];
addTextKeyToCover(overlayKeys, colorKey);
}
-
- OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
+
+ OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
overlayKeys.toArray(keys);
return new OverlayPreferenceStore(getPreferenceStore(), keys);
}
private void addTextKeyToCover(List<OverlayPreferenceStore.OverlayKey> overlayKeys, String mainKey) {
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, mainKey));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, mainKey + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, mainKey + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ mainKey + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ mainKey + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX));
}
@Override
protected Control createContents(Composite parent) {
- AutotoolsUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(), IMakeHelpContextIds.MAKE_EDITOR_PREFERENCE_PAGE);
+ AutotoolsUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(),
+ IMakeHelpContextIds.MAKE_EDITOR_PREFERENCE_PAGE);
getOverlayStore().load();
getOverlayStore().start();
-
- TabFolder folder= new TabFolder(parent, SWT.NONE);
- folder.setLayout(new TabFolderLayout());
+
+ TabFolder folder = new TabFolder(parent, SWT.NONE);
+ folder.setLayout(new TabFolderLayout());
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- TabItem item= new TabItem(folder, SWT.NONE);
+
+ TabItem item = new TabItem(folder, SWT.NONE);
item.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.syntax")); //$NON-NLS-1$
item.setControl(createSyntaxPage(folder));
-
- item= new TabItem(folder, SWT.NONE);
+
+ item = new TabItem(folder, SWT.NONE);
item.setText(AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.folding")); //$NON-NLS-1$
item.setControl(createFoldingTabContent(folder));
-
+
// Allow end-user to select which version of autoconf to use for hover help
// and syntax checking of macros.
- item= new TabItem(folder, SWT.NONE);
+ item = new TabItem(folder, SWT.NONE);
item.setText(AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.version")); //$NON-NLS-1$
item.setControl(createVersionTabContent(folder));
-
+
initialize();
-
+
applyDialogFont(folder);
return folder;
}
private void initialize() {
-
+
initializeFields();
-
- for (int i= 0, n= fSyntaxColorListModel.length; i < n; i++) {
- fHighlightingColorList.add(
- new HighlightingColorListItem (fSyntaxColorListModel[i][0], fSyntaxColorListModel[i][1],
- fSyntaxColorListModel[i][1] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX,
- fSyntaxColorListModel[i][1] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX, null));
+
+ for (int i = 0, n = fSyntaxColorListModel.length; i < n; i++) {
+ fHighlightingColorList.add(new HighlightingColorListItem(fSyntaxColorListModel[i][0],
+ fSyntaxColorListModel[i][1],
+ fSyntaxColorListModel[i][1] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX,
+ fSyntaxColorListModel[i][1] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX, null));
}
fHighlightingColorListViewer.setInput(fHighlightingColorList);
- fHighlightingColorListViewer.setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(0)));
+ fHighlightingColorListViewer
+ .setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(0)));
- for (int i=0, n= fACVersions.length; i < n; i++) {
+ for (int i = 0, n = fACVersions.length; i < n; i++) {
fACVersionCombo.setItem(i, fACVersions[i]);
}
-
+
initializeFolding();
initializeACVersion();
initializeAMVersion();
}
void initializeFolding() {
- boolean enabled= getOverlayStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
- fFoldingCheckbox.setSelection(enabled);
+ boolean enabled = getOverlayStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
+ fFoldingCheckbox.setSelection(enabled);
}
-
+
void initializeACVersion() {
// FIXME: What do we do here? There is no PreferenceConstants value for this.
// Perhaps we should be using our own overlay store.
@@ -330,8 +344,8 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
}
void initializeDefaultFolding() {
- boolean enabled= getOverlayStore().getDefaultBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
- fFoldingCheckbox.setSelection(enabled);
+ boolean enabled = getOverlayStore().getDefaultBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
+ fFoldingCheckbox.setSelection(enabled);
}
@Override
@@ -339,65 +353,66 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
handleSyntaxColorListSelection();
initializeDefaultFolding();
}
-
+
private Control createSyntaxPage(Composite parent) {
-
- Composite colorComposite= new Composite(parent, SWT.NONE);
+
+ Composite colorComposite = new Composite(parent, SWT.NONE);
colorComposite.setLayout(new GridLayout());
- Label label= new Label(colorComposite, SWT.LEFT);
+ Label label = new Label(colorComposite, SWT.LEFT);
label.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.Foreground")); //$NON-NLS-1$
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Composite editorComposite= new Composite(colorComposite, SWT.NONE);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
+ Composite editorComposite = new Composite(colorComposite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
editorComposite.setLayout(layout);
- GridData gd= new GridData(GridData.FILL_BOTH);
- editorComposite.setLayoutData(gd);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ editorComposite.setLayoutData(gd);
- fHighlightingColorListViewer= new TableViewer(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
+ fHighlightingColorListViewer = new TableViewer(editorComposite,
+ SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
fHighlightingColorListViewer.setLabelProvider(new ColorListLabelProvider());
fHighlightingColorListViewer.setContentProvider(new ColorListContentProvider());
fHighlightingColorListViewer.setComparator(new WorkbenchViewerComparator());
- gd= new GridData(GridData.FILL_BOTH);
- gd.heightHint= convertHeightInCharsToPixels(5);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = convertHeightInCharsToPixels(5);
fHighlightingColorListViewer.getControl().setLayoutData(gd);
-
- Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
- layout= new GridLayout();
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- layout.numColumns= 2;
+
+ Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
stylesComposite.setLayout(layout);
stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- label= new Label(stylesComposite, SWT.LEFT);
+
+ label = new Label(stylesComposite, SWT.LEFT);
label.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.color")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
- fSyntaxForegroundColorEditor= new ColorEditor(stylesComposite);
- Button foregroundColorButton= fSyntaxForegroundColorEditor.getButton();
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
+ fSyntaxForegroundColorEditor = new ColorEditor(stylesComposite);
+ Button foregroundColorButton = fSyntaxForegroundColorEditor.getButton();
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
foregroundColorButton.setLayoutData(gd);
-
- fBoldCheckBox= new Button(stylesComposite, SWT.CHECK);
+
+ fBoldCheckBox = new Button(stylesComposite, SWT.CHECK);
fBoldCheckBox.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.bold")); //$NON-NLS-1$
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- gd.horizontalSpan= 2;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.horizontalSpan = 2;
fBoldCheckBox.setLayoutData(gd);
-
- fItalicCheckBox= new Button(stylesComposite, SWT.CHECK);
+
+ fItalicCheckBox = new Button(stylesComposite, SWT.CHECK);
fItalicCheckBox.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.italic")); //$NON-NLS-1$
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- gd.horizontalSpan= 2;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.horizontalSpan = 2;
fItalicCheckBox.setLayoutData(gd);
fHighlightingColorListViewer.addSelectionChangedListener(event -> handleSyntaxColorListSelection());
@@ -405,137 +420,137 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
foregroundColorButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- HighlightingColorListItem item= getHighlightingColorListItem();
- PreferenceConverter.setValue(getOverlayStore(), item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue());
+ HighlightingColorListItem item = getHighlightingColorListItem();
+ PreferenceConverter.setValue(getOverlayStore(), item.getColorKey(),
+ fSyntaxForegroundColorEditor.getColorValue());
}
});
fBoldCheckBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- HighlightingColorListItem item= getHighlightingColorListItem();
+ HighlightingColorListItem item = getHighlightingColorListItem();
getOverlayStore().setValue(item.getBoldKey(), fBoldCheckBox.getSelection());
}
});
-
+
fItalicCheckBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- HighlightingColorListItem item= getHighlightingColorListItem();
+ HighlightingColorListItem item = getHighlightingColorListItem();
getOverlayStore().setValue(item.getItalicKey(), fItalicCheckBox.getSelection());
}
});
-
+
return colorComposite;
}
-
private Composite createFoldingTabContent(TabFolder folder) {
- Composite composite= new Composite(folder, SWT.NULL);
+ Composite composite = new Composite(folder, SWT.NULL);
// assume parent page uses griddata
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL);
composite.setLayoutData(gd);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
//PixelConverter pc= new PixelConverter(composite);
//layout.verticalSpacing= pc.convertHeightInCharsToPixels(1) / 2;
composite.setLayout(layout);
-
-
+
/* check box for new editors */
- fFoldingCheckbox= new Button(composite, SWT.CHECK);
+ fFoldingCheckbox = new Button(composite, SWT.CHECK);
fFoldingCheckbox.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.foldingenable")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
fFoldingCheckbox.setLayoutData(gd);
fFoldingCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- boolean enabled= fFoldingCheckbox.getSelection();
+ boolean enabled = fFoldingCheckbox.getSelection();
getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED, enabled);
}
});
-
+
return composite;
}
private Composite createVersionTabContent(TabFolder folder) {
- Composite composite= new Composite(folder, SWT.NULL);
+ Composite composite = new Composite(folder, SWT.NULL);
// assume parent page uses griddata
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL);
composite.setLayoutData(gd);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
//PixelConverter pc= new PixelConverter(composite);
//layout.verticalSpacing= pc.convertHeightInCharsToPixels(1) / 2;
composite.setLayout(layout);
-
-
+
/* check box for new editors */
- fACVersionCombo= new Combo(composite, SWT.CHECK | SWT.DROP_DOWN | SWT.READ_ONLY);
+ fACVersionCombo = new Combo(composite, SWT.CHECK | SWT.DROP_DOWN | SWT.READ_ONLY);
fACVersionCombo.setItems(fACVersions);
fACVersionCombo.select(fACVersions.length - 1);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
fACVersionCombo.setLayoutData(gd);
fACVersionCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- int index = fACVersionCombo.getSelectionIndex();
- getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION, fACVersionCombo.getItem(index));
+ int index = fACVersionCombo.getSelectionIndex();
+ getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION,
+ fACVersionCombo.getItem(index));
}
});
-
- Label label= new Label(composite, SWT.LEFT);
+
+ Label label = new Label(composite, SWT.LEFT);
label.setText(AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.autoconfVersion")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
-
+
/* check box for new editors */
- fAMVersionCombo= new Combo(composite, SWT.CHECK | SWT.DROP_DOWN | SWT.READ_ONLY);
+ fAMVersionCombo = new Combo(composite, SWT.CHECK | SWT.DROP_DOWN | SWT.READ_ONLY);
fAMVersionCombo.setItems(fAMVersions);
fAMVersionCombo.select(fAMVersions.length - 1);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
fAMVersionCombo.setLayoutData(gd);
fAMVersionCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- int index = fAMVersionCombo.getSelectionIndex();
- getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION, fAMVersionCombo.getItem(index));
+ int index = fAMVersionCombo.getSelectionIndex();
+ getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION,
+ fAMVersionCombo.getItem(index));
}
});
-
- Label label2= new Label(composite, SWT.LEFT);
+
+ Label label2 = new Label(composite, SWT.LEFT);
label2.setText(AutotoolsPreferencesMessages.getString("AutoconfEditorPreferencePage.automakeVersion")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label2.setLayoutData(gd);
return composite;
}
void handleSyntaxColorListSelection() {
- HighlightingColorListItem item= getHighlightingColorListItem();
- RGB rgb= PreferenceConverter.getColor(getOverlayStore(), item.getColorKey());
- fSyntaxForegroundColorEditor.setColorValue(rgb);
+ HighlightingColorListItem item = getHighlightingColorListItem();
+ RGB rgb = PreferenceConverter.getColor(getOverlayStore(), item.getColorKey());
+ fSyntaxForegroundColorEditor.setColorValue(rgb);
fBoldCheckBox.setSelection(getOverlayStore().getBoolean(item.getBoldKey()));
fItalicCheckBox.setSelection(getOverlayStore().getBoolean(item.getItalicKey()));
}
-
+
/**
* Returns the current highlighting color list item.
- *
+ *
* @return the current highlighting color list item
* @since 3.0
*/
HighlightingColorListItem getHighlightingColorListItem() {
- IStructuredSelection selection= (IStructuredSelection) fHighlightingColorListViewer.getSelection();
+ IStructuredSelection selection = (IStructuredSelection) fHighlightingColorListViewer.getSelection();
return (HighlightingColorListItem) selection.getFirstElement();
}
/**
* @param preferenceStore
*/
- public static void initDefaults(IPreferenceStore prefs) {
+ public static void initDefaults(IPreferenceStore prefs) {
// Makefile Editor color preferences
PreferenceConverter.setDefault(prefs, ColorManager.AUTOCONF_COMMENT_COLOR, ColorManager.AUTOCONF_COMMENT_RGB);
PreferenceConverter.setDefault(prefs, ColorManager.AUTOCONF_DEFAULT_COLOR, ColorManager.AUTOCONF_DEFAULT_RGB);
@@ -545,7 +560,8 @@ public class AutoconfEditorPreferencePage extends AbstractEditorPreferencePage {
PreferenceConverter.setDefault(prefs, ColorManager.AUTOCONF_ACMACRO_COLOR, ColorManager.AUTOCONF_ACMACRO_RGB);
PreferenceConverter.setDefault(prefs, ColorManager.AUTOCONF_AMMACRO_COLOR, ColorManager.AUTOCONF_AMMACRO_RGB);
PreferenceConverter.setDefault(prefs, ColorManager.AUTOCONF_CODESEQ_COLOR, ColorManager.AUTOCONF_CODESEQ_RGB);
- prefs.setDefault(ColorManager.AUTOCONF_CODESEQ_COLOR + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX, true);
+ prefs.setDefault(ColorManager.AUTOCONF_CODESEQ_COLOR + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX,
+ true);
}
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutomakeEditorPreferencePage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutomakeEditorPreferencePage.java
index 6bd50ff883f..c5c5aad6d8d 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutomakeEditorPreferencePage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutomakeEditorPreferencePage.java
@@ -45,8 +45,6 @@ import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.ui.model.WorkbenchViewerComparator;
-
-
/**
* MakeEditorPreferencePage
* The page for setting the editor options.
@@ -57,18 +55,18 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage {
private String[][] fSyntaxColorListModel;
private TableViewer fHighlightingColorListViewer;
- private final List<HighlightingColorListItem> fHighlightingColorList= new ArrayList<>(5);
+ private final List<HighlightingColorListItem> fHighlightingColorList = new ArrayList<>(5);
ColorEditor fSyntaxForegroundColorEditor;
Button fBoldCheckBox;
Button fItalicCheckBox;
-
+
// folding
protected Button fFoldingCheckbox;
-
+
/**
* Item in the highlighting color list.
- *
+ *
* @since 3.0
*/
private static class HighlightingColorListItem {
@@ -82,52 +80,53 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage {
private String fItalicKey;
/** Item color */
private Color fItemColor;
-
+
/**
* Initialize the item with the given values.
- *
+ *
* @param displayName the display name
* @param colorKey the color preference key
* @param boldKey the bold preference key
* @param italicKey the italic preference key
* @param itemColor the item color
*/
- public HighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey, Color itemColor) {
- fDisplayName= displayName;
- fColorKey= colorKey;
- fBoldKey= boldKey;
- fItalicKey= italicKey;
- fItemColor= itemColor;
+ public HighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey,
+ Color itemColor) {
+ fDisplayName = displayName;
+ fColorKey = colorKey;
+ fBoldKey = boldKey;
+ fItalicKey = italicKey;
+ fItemColor = itemColor;
}
-
+
/**
* @return the bold preference key
*/
public String getBoldKey() {
return fBoldKey;
}
-
+
/**
* @return the bold preference key
*/
public String getItalicKey() {
return fItalicKey;
}
-
+
/**
* @return the color preference key
*/
public String getColorKey() {
return fColorKey;
}
-
+
/**
* @return the display name
*/
public String getDisplayName() {
return fDisplayName;
}
-
+
/**
* @return the item color
*/
@@ -138,19 +137,19 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage {
/**
* Color list label provider.
- *
+ *
* @since 3.0
*/
private static class ColorListLabelProvider extends LabelProvider implements IColorProvider {
@Override
public String getText(Object element) {
- return ((HighlightingColorListItem)element).getDisplayName();
+ return ((HighlightingColorListItem) element).getDisplayName();
}
-
+
@Override
public Color getForeground(Object element) {
- return ((HighlightingColorListItem)element).getItemColor();
+ return ((HighlightingColorListItem) element).getItemColor();
}
@Override
@@ -158,10 +157,10 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage {
return null;
}
}
-
+
/**
* Color list content provider.
- *
+ *
* @since 3.0
*/
private static class ColorListContentProvider implements IStructuredContentProvider {
@@ -169,7 +168,7 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage {
@Override
@SuppressWarnings("unchecked")
public Object[] getElements(Object inputElement) {
- return ((List<Object>)inputElement).toArray();
+ return ((List<Object>) inputElement).toArray();
}
@Override
@@ -180,11 +179,9 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage {
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
-
-
/**
- *
+ *
*/
public AutomakeEditorPreferencePage() {
super();
@@ -192,85 +189,98 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage {
@Override
protected OverlayPreferenceStore createOverlayStore() {
- fSyntaxColorListModel= new String[][] {
- {AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_comment"), ColorManager.MAKE_COMMENT_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_macro_ref"), ColorManager.MAKE_MACRO_REF_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_macro_def"), ColorManager.MAKE_MACRO_DEF_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_function"), ColorManager.MAKE_FUNCTION_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_keyword"), ColorManager.MAKE_KEYWORD_COLOR, null}, //$NON-NLS-1$
- {AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_default"), ColorManager.MAKE_DEFAULT_COLOR, null}, //$NON-NLS-1$
- };
- ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys= new ArrayList<>();
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_CONDITIONAL));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_MACRODEF));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_RULE));
-
- for (int i= 0; i < fSyntaxColorListModel.length; i++) {
- String colorKey= fSyntaxColorListModel[i][1];
+ fSyntaxColorListModel = new String[][] {
+ { AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_comment"), //$NON-NLS-1$
+ ColorManager.MAKE_COMMENT_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_macro_ref"), //$NON-NLS-1$
+ ColorManager.MAKE_MACRO_REF_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_macro_def"), //$NON-NLS-1$
+ ColorManager.MAKE_MACRO_DEF_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_function"), //$NON-NLS-1$
+ ColorManager.MAKE_FUNCTION_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_keyword"), //$NON-NLS-1$
+ ColorManager.MAKE_KEYWORD_COLOR, null },
+ { AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.makefile_editor_default"), //$NON-NLS-1$
+ ColorManager.MAKE_DEFAULT_COLOR, null }, };
+ ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<>();
+
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_CONDITIONAL));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_MACRODEF));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
+ AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_RULE));
+
+ for (int i = 0; i < fSyntaxColorListModel.length; i++) {
+ String colorKey = fSyntaxColorListModel[i][1];
addTextKeyToCover(overlayKeys, colorKey);
}
-
- OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
+
+ OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
overlayKeys.toArray(keys);
return new OverlayPreferenceStore(getPreferenceStore(), keys);
}
private void addTextKeyToCover(List<OverlayPreferenceStore.OverlayKey> overlayKeys, String mainKey) {
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, mainKey));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, mainKey + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, mainKey + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ mainKey + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING,
+ mainKey + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX));
}
@Override
protected Control createContents(Composite parent) {
- AutotoolsUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(), IMakeHelpContextIds.MAKE_EDITOR_PREFERENCE_PAGE);
+ AutotoolsUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(),
+ IMakeHelpContextIds.MAKE_EDITOR_PREFERENCE_PAGE);
getOverlayStore().load();
getOverlayStore().start();
-
- TabFolder folder= new TabFolder(parent, SWT.NONE);
- folder.setLayout(new TabFolderLayout());
+
+ TabFolder folder = new TabFolder(parent, SWT.NONE);
+ folder.setLayout(new TabFolderLayout());
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- TabItem item= new TabItem(folder, SWT.NONE);
+
+ TabItem item = new TabItem(folder, SWT.NONE);
item.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.syntax")); //$NON-NLS-1$
item.setControl(createSyntaxPage(folder));
-
- item= new TabItem(folder, SWT.NONE);
+
+ item = new TabItem(folder, SWT.NONE);
item.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.folding")); //$NON-NLS-1$
item.setControl(createFoldingTabContent(folder));
-
+
initialize();
-
+
applyDialogFont(folder);
return folder;
}
private void initialize() {
-
+
initializeFields();
-
- for (int i= 0, n= fSyntaxColorListModel.length; i < n; i++) {
- fHighlightingColorList.add(
- new HighlightingColorListItem (fSyntaxColorListModel[i][0], fSyntaxColorListModel[i][1],
- fSyntaxColorListModel[i][1] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX,
- fSyntaxColorListModel[i][1] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX, null));
+
+ for (int i = 0, n = fSyntaxColorListModel.length; i < n; i++) {
+ fHighlightingColorList.add(new HighlightingColorListItem(fSyntaxColorListModel[i][0],
+ fSyntaxColorListModel[i][1],
+ fSyntaxColorListModel[i][1] + AutotoolsEditorPreferenceConstants.EDITOR_BOLD_SUFFIX,
+ fSyntaxColorListModel[i][1] + AutotoolsEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX, null));
}
fHighlightingColorListViewer.setInput(fHighlightingColorList);
- fHighlightingColorListViewer.setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(0)));
+ fHighlightingColorListViewer
+ .setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(0)));
initializeFolding();
}
void initializeFolding() {
- boolean enabled= getOverlayStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
- fFoldingCheckbox.setSelection(enabled);
+ boolean enabled = getOverlayStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
+ fFoldingCheckbox.setSelection(enabled);
}
void initializeDefaultFolding() {
- boolean enabled= getOverlayStore().getDefaultBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
- fFoldingCheckbox.setSelection(enabled);
+ boolean enabled = getOverlayStore().getDefaultBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED);
+ fFoldingCheckbox.setSelection(enabled);
}
@Override
@@ -278,65 +288,66 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage {
handleSyntaxColorListSelection();
initializeDefaultFolding();
}
-
+
private Control createSyntaxPage(Composite parent) {
-
- Composite colorComposite= new Composite(parent, SWT.NONE);
+
+ Composite colorComposite = new Composite(parent, SWT.NONE);
colorComposite.setLayout(new GridLayout());
- Label label= new Label(colorComposite, SWT.LEFT);
+ Label label = new Label(colorComposite, SWT.LEFT);
label.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.Foreground")); //$NON-NLS-1$
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Composite editorComposite= new Composite(colorComposite, SWT.NONE);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
+ Composite editorComposite = new Composite(colorComposite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
editorComposite.setLayout(layout);
- GridData gd= new GridData(GridData.FILL_BOTH);
- editorComposite.setLayoutData(gd);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ editorComposite.setLayoutData(gd);
- fHighlightingColorListViewer= new TableViewer(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
+ fHighlightingColorListViewer = new TableViewer(editorComposite,
+ SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
fHighlightingColorListViewer.setLabelProvider(new ColorListLabelProvider());
fHighlightingColorListViewer.setContentProvider(new ColorListContentProvider());
fHighlightingColorListViewer.setComparator(new WorkbenchViewerComparator());
- gd= new GridData(GridData.FILL_BOTH);
- gd.heightHint= convertHeightInCharsToPixels(5);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = convertHeightInCharsToPixels(5);
fHighlightingColorListViewer.getControl().setLayoutData(gd);
-
- Composite stylesComposite= new Composite(editorComposite, SWT.NONE);
- layout= new GridLayout();
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- layout.numColumns= 2;
+
+ Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
stylesComposite.setLayout(layout);
stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- label= new Label(stylesComposite, SWT.LEFT);
+
+ label = new Label(stylesComposite, SWT.LEFT);
label.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.color")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
- fSyntaxForegroundColorEditor= new ColorEditor(stylesComposite);
- Button foregroundColorButton= fSyntaxForegroundColorEditor.getButton();
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
+ fSyntaxForegroundColorEditor = new ColorEditor(stylesComposite);
+ Button foregroundColorButton = fSyntaxForegroundColorEditor.getButton();
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
foregroundColorButton.setLayoutData(gd);
-
- fBoldCheckBox= new Button(stylesComposite, SWT.CHECK);
+
+ fBoldCheckBox = new Button(stylesComposite, SWT.CHECK);
fBoldCheckBox.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.bold")); //$NON-NLS-1$
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- gd.horizontalSpan= 2;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.horizontalSpan = 2;
fBoldCheckBox.setLayoutData(gd);
-
- fItalicCheckBox= new Button(stylesComposite, SWT.CHECK);
+
+ fItalicCheckBox = new Button(stylesComposite, SWT.CHECK);
fItalicCheckBox.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.italic")); //$NON-NLS-1$
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment= GridData.BEGINNING;
- gd.horizontalSpan= 2;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.horizontalSpan = 2;
fItalicCheckBox.setLayoutData(gd);
fHighlightingColorListViewer.addSelectionChangedListener(event -> handleSyntaxColorListSelection());
@@ -344,89 +355,88 @@ public class AutomakeEditorPreferencePage extends AbstractEditorPreferencePage {
foregroundColorButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- HighlightingColorListItem item= getHighlightingColorListItem();
- PreferenceConverter.setValue(getOverlayStore(), item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue());
+ HighlightingColorListItem item = getHighlightingColorListItem();
+ PreferenceConverter.setValue(getOverlayStore(), item.getColorKey(),
+ fSyntaxForegroundColorEditor.getColorValue());
}
});
fBoldCheckBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- HighlightingColorListItem item= getHighlightingColorListItem();
+ HighlightingColorListItem item = getHighlightingColorListItem();
getOverlayStore().setValue(item.getBoldKey(), fBoldCheckBox.getSelection());
}
});
-
+
fItalicCheckBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- HighlightingColorListItem item= getHighlightingColorListItem();
+ HighlightingColorListItem item = getHighlightingColorListItem();
getOverlayStore().setValue(item.getItalicKey(), fItalicCheckBox.getSelection());
}
});
-
+
return colorComposite;
}
-
private Composite createFoldingTabContent(TabFolder folder) {
- Composite composite= new Composite(folder, SWT.NULL);
+ Composite composite = new Composite(folder, SWT.NULL);
// assume parent page uses griddata
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL);
composite.setLayoutData(gd);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
//PixelConverter pc= new PixelConverter(composite);
//layout.verticalSpacing= pc.convertHeightInCharsToPixels(1) / 2;
composite.setLayout(layout);
-
-
+
/* check box for new editors */
- fFoldingCheckbox= new Button(composite, SWT.CHECK);
+ fFoldingCheckbox = new Button(composite, SWT.CHECK);
fFoldingCheckbox.setText(AutotoolsPreferencesMessages.getString("AutomakeEditorPreferencePage.foldingenable")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
fFoldingCheckbox.setLayoutData(gd);
fFoldingCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- boolean enabled= fFoldingCheckbox.getSelection();
+ boolean enabled = fFoldingCheckbox.getSelection();
getOverlayStore().setValue(AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED, enabled);
}
});
-
+
return composite;
}
void handleSyntaxColorListSelection() {
- HighlightingColorListItem item= getHighlightingColorListItem();
- RGB rgb= PreferenceConverter.getColor(getOverlayStore(), item.getColorKey());
- fSyntaxForegroundColorEditor.setColorValue(rgb);
+ HighlightingColorListItem item = getHighlightingColorListItem();
+ RGB rgb = PreferenceConverter.getColor(getOverlayStore(), item.getColorKey());
+ fSyntaxForegroundColorEditor.setColorValue(rgb);
fBoldCheckBox.setSelection(getOverlayStore().getBoolean(item.getBoldKey()));
fItalicCheckBox.setSelection(getOverlayStore().getBoolean(item.getItalicKey()));
}
-
+
/**
* Returns the current highlighting color list item.
- *
+ *
* @return the current highlighting color list item
* @since 3.0
*/
HighlightingColorListItem getHighlightingColorListItem() {
- IStructuredSelection selection= (IStructuredSelection) fHighlightingColorListViewer.getSelection();
+ IStructuredSelection selection = (IStructuredSelection) fHighlightingColorListViewer.getSelection();
return (HighlightingColorListItem) selection.getFirstElement();
}
/**
* @param preferenceStore
*/
- public static void initDefaults(IPreferenceStore prefs) {
+ public static void initDefaults(IPreferenceStore prefs) {
// Makefile Editor color preferences
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_COMMENT_COLOR, ColorManager.MAKE_COMMENT_RGB);
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_DEFAULT_COLOR, ColorManager.MAKE_DEFAULT_RGB);
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_FUNCTION_COLOR, ColorManager.MAKE_FUNCTION_RGB);
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_KEYWORD_COLOR, ColorManager.MAKE_KEYWORD_RGB);
PreferenceConverter.setDefault(prefs, ColorManager.MAKE_MACRO_DEF_COLOR, ColorManager.MAKE_MACRO_DEF_RGB);
- PreferenceConverter.setDefault(prefs, ColorManager.MAKE_MACRO_REF_COLOR, ColorManager.MAKE_MACRO_REF_RGB);
+ PreferenceConverter.setDefault(prefs, ColorManager.MAKE_MACRO_REF_COLOR, ColorManager.MAKE_MACRO_REF_RGB);
}
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsEditorPreferenceConstants.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsEditorPreferenceConstants.java
index 412eab5d5f8..f25e4f793dd 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsEditorPreferenceConstants.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsEditorPreferenceConstants.java
@@ -23,7 +23,7 @@ import org.eclipse.jface.preference.IPreferenceStore;
public class AutotoolsEditorPreferenceConstants {
/**
- *
+ *
*/
private AutotoolsEditorPreferenceConstants() {
}
@@ -34,19 +34,18 @@ public class AutotoolsEditorPreferenceConstants {
*/
public static final String CURRENT_LINE_COLOR = "org.eclipse.cdt.autotools.ui.automake.currentLineHightlightColor"; //$NON-NLS-1$
public static final String LINE_NUMBER_RULER_COLOR = "org.eclipse.cdt.autotools.ui.automake.lineNumberForegroundColor"; //$NON-NLS-1$
- public static final String PRINT_MARGIN_COLOR = "org.eclipse.cdt.autotools.ui.automake.printMarginColor"; //$NON-NLS-1$
-
+ public static final String PRINT_MARGIN_COLOR = "org.eclipse.cdt.autotools.ui.automake.printMarginColor"; //$NON-NLS-1$
+
/**
* Preference key suffix for bold text style preference keys.
- *
+ *
*/
- public static final String EDITOR_BOLD_SUFFIX= "_bold"; //$NON-NLS-1$
+ public static final String EDITOR_BOLD_SUFFIX = "_bold"; //$NON-NLS-1$
/**
* Preference key suffix for italic text style preference keys.
*/
- public static final String EDITOR_ITALIC_SUFFIX= "_italic"; //$NON-NLS-1$
-
+ public static final String EDITOR_ITALIC_SUFFIX = "_italic"; //$NON-NLS-1$
public static final String EDITOR_FOLDING_MACRODEF = "editor_folding_default_macrodef"; //$NON-NLS-1$
@@ -59,11 +58,11 @@ public class AutotoolsEditorPreferenceConstants {
public static final String EDITOR_FOLDING_LOOP = "editor_folding_default_loop"; //$NON-NLS-1$
public static final String EDITOR_FOLDING_ENABLED = "editor_folding_enabled"; //$NON-NLS-1$
-
+
public static final String AUTOCONF_VERSION = "autoconf_version";
-
+
public static final String AUTOMAKE_VERSION = "automake_version";
-
+
public static void initializeDefaultValues(IPreferenceStore store) {
store.setDefault(AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_ENABLED, false);
@@ -72,8 +71,10 @@ public class AutotoolsEditorPreferenceConstants {
store.setDefault(AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_CASE, true);
store.setDefault(AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_CONDITIONAL, true);
store.setDefault(AutotoolsEditorPreferenceConstants.EDITOR_FOLDING_LOOP, true);
- store.setDefault(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION, AutoconfEditorPreferencePage.LATEST_AC_VERSION);
- store.setDefault(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION, AutoconfEditorPreferencePage.LATEST_AM_VERSION);
+ store.setDefault(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION,
+ AutoconfEditorPreferencePage.LATEST_AC_VERSION);
+ store.setDefault(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION,
+ AutoconfEditorPreferencePage.LATEST_AM_VERSION);
}
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencePage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencePage.java
index 1ec952ed5b0..18b3eb3df54 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencePage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencePage.java
@@ -22,7 +22,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-
public class AutotoolsPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
private static final String PREF_BUILD_TARGET_IN_BACKGROUND = "MakeTargetPrefs.buildTargetInBackground"; //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencesMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencesMessages.java
index a8e22d3d346..b0bb4ccda93 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencesMessages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/AutotoolsPreferencesMessages.java
@@ -23,7 +23,7 @@ import java.util.ResourceBundle;
public class AutotoolsPreferencesMessages {
/**
- *
+ *
*/
private AutotoolsPreferencesMessages() {
}
@@ -38,6 +38,6 @@ public class AutotoolsPreferencesMessages {
} catch (NullPointerException e) {
return '#' + key + '#';
}
- }
+ }
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorEditor.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorEditor.java
index 2ab1753c7e2..f313168cbfd 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorEditor.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorEditor.java
@@ -34,38 +34,38 @@ import org.eclipse.swt.widgets.Display;
* A "button" of a certain color determined by the color picker
*/
public class ColorEditor {
-
+
private Point fExtent;
Image fImage;
RGB fColorValue;
Color fColor;
Button fButton;
-
+
public ColorEditor(Composite parent) {
-
- fButton= new Button(parent, SWT.PUSH);
- fExtent= computeImageSize(parent);
- fImage= new Image(parent.getDisplay(), fExtent.x, fExtent.y);
-
- GC gc= new GC(fImage);
+
+ fButton = new Button(parent, SWT.PUSH);
+ fExtent = computeImageSize(parent);
+ fImage = new Image(parent.getDisplay(), fExtent.x, fExtent.y);
+
+ GC gc = new GC(fImage);
gc.setBackground(fButton.getBackground());
gc.fillRectangle(0, 0, fExtent.x, fExtent.y);
gc.dispose();
-
+
fButton.setImage(fImage);
fButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
- ColorDialog colorDialog= new ColorDialog(fButton.getShell());
+ ColorDialog colorDialog = new ColorDialog(fButton.getShell());
colorDialog.setRGB(fColorValue);
RGB newColor = colorDialog.open();
if (newColor != null) {
- fColorValue= newColor;
+ fColorValue = newColor;
updateColorImage();
}
}
});
-
+
fButton.addDisposeListener(event -> {
if (fImage != null) {
fImage.dispose();
@@ -77,44 +77,44 @@ public class ColorEditor {
}
});
}
-
+
public RGB getColorValue() {
return fColorValue;
}
-
+
public void setColorValue(RGB rgb) {
- fColorValue= rgb;
+ fColorValue = rgb;
updateColorImage();
}
-
+
public Button getButton() {
return fButton;
}
-
+
protected void updateColorImage() {
-
- Display display= fButton.getDisplay();
-
- GC gc= new GC(fImage);
+
+ Display display = fButton.getDisplay();
+
+ GC gc = new GC(fImage);
gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);
-
+
if (fColor != null)
fColor.dispose();
-
- fColor= new Color(display, fColorValue);
+
+ fColor = new Color(display, fColorValue);
gc.setBackground(fColor);
gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
gc.dispose();
-
+
fButton.setImage(fImage);
}
-
+
protected Point computeImageSize(Control window) {
- GC gc= new GC(window);
- Font f= JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
+ GC gc = new GC(window);
+ Font f = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
gc.setFont(f);
- int height= gc.getFontMetrics().getHeight();
+ int height = gc.getFontMetrics().getHeight();
gc.dispose();
return new Point(height * 3 - 6, height);
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorManager.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorManager.java
index deb3a08dcaa..6bda2e046d7 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorManager.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/ColorManager.java
@@ -24,14 +24,14 @@ import org.eclipse.swt.widgets.Display;
public class ColorManager implements ISharedTextColors {
- public static final String MAKE_COMMENT_COLOR ="org.eclipse.cdt.autotools.ui.automake.editor.comment"; //$NON-NLS-1$
+ public static final String MAKE_COMMENT_COLOR = "org.eclipse.cdt.autotools.ui.automake.editor.comment"; //$NON-NLS-1$
public static final String MAKE_KEYWORD_COLOR = "org.eclipse.cdt.autotools.ui.automake.editor.keyword"; //$NON-NLS-1$
public static final String MAKE_FUNCTION_COLOR = "org.eclipse.cdt.autotools.ui.automake.editor.function"; //$NON-NLS-1$
public static final String MAKE_MACRO_REF_COLOR = "org.eclipse.cdt.autotools.ui.automake.editor.macro_ref"; //$NON-NLS-1$
public static final String MAKE_MACRO_DEF_COLOR = "org.eclipse.cdt.autotools.ui.automake.editor.macro_def"; //$NON-NLS-1$
public static final String MAKE_DEFAULT_COLOR = "org.eclipse.cdt.autotools.ui.automake.editor.default"; //$NON-NLS-1$
- public static final String AUTOCONF_COMMENT_COLOR ="org.eclipse.cdt.autotools.ui.autoconf.editor.comment"; //$NON-NLS-1$
+ public static final String AUTOCONF_COMMENT_COLOR = "org.eclipse.cdt.autotools.ui.autoconf.editor.comment"; //$NON-NLS-1$
public static final String AUTOCONF_KEYWORD_COLOR = "org.eclipse.cdt.autotools.ui.autoconf.editor.keyword"; //$NON-NLS-1$
public static final String AUTOCONF_VAR_REF_COLOR = "org.eclipse.cdt.autotools.ui.autoconf.editor.var_ref"; //$NON-NLS-1$
public static final String AUTOCONF_VAR_SET_COLOR = "org.eclipse.cdt.autotools.ui.autoconf.editor.var_set"; //$NON-NLS-1$
@@ -57,13 +57,13 @@ public class ColorManager implements ISharedTextColors {
public static final RGB AUTOCONF_DEFAULT_RGB = new RGB(0, 0, 0);
private static ColorManager fgColorManager;
-
+
private ColorManager() {
}
-
+
public static ColorManager getDefault() {
if (fgColorManager == null) {
- fgColorManager= new ColorManager();
+ fgColorManager = new ColorManager();
}
return fgColorManager;
}
@@ -74,7 +74,7 @@ public class ColorManager implements ISharedTextColors {
public void dispose() {
Iterator<Color> e = fColorTable.values().iterator();
while (e.hasNext())
- e.next().dispose();
+ e.next().dispose();
}
@Override
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/OverlayPreferenceStore.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/OverlayPreferenceStore.java
index 13c276bf540..d925c14ef9d 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/OverlayPreferenceStore.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/OverlayPreferenceStore.java
@@ -25,208 +25,206 @@ import org.eclipse.jface.util.PropertyChangeEvent;
/**
* An overlaying preference store.
*/
-class OverlayPreferenceStore implements IPreferenceStore {
-
-
+class OverlayPreferenceStore implements IPreferenceStore {
+
public static final class TypeDescriptor {
TypeDescriptor() {
}
}
-
- public static final TypeDescriptor BOOLEAN= new TypeDescriptor();
- public static final TypeDescriptor DOUBLE= new TypeDescriptor();
- public static final TypeDescriptor FLOAT= new TypeDescriptor();
- public static final TypeDescriptor INT= new TypeDescriptor();
- public static final TypeDescriptor LONG= new TypeDescriptor();
- public static final TypeDescriptor STRING= new TypeDescriptor();
-
+
+ public static final TypeDescriptor BOOLEAN = new TypeDescriptor();
+ public static final TypeDescriptor DOUBLE = new TypeDescriptor();
+ public static final TypeDescriptor FLOAT = new TypeDescriptor();
+ public static final TypeDescriptor INT = new TypeDescriptor();
+ public static final TypeDescriptor LONG = new TypeDescriptor();
+ public static final TypeDescriptor STRING = new TypeDescriptor();
+
public static class OverlayKey {
-
+
TypeDescriptor fDescriptor;
String fKey;
-
+
public OverlayKey(TypeDescriptor descriptor, String key) {
- fDescriptor= descriptor;
- fKey= key;
+ fDescriptor = descriptor;
+ fKey = key;
}
}
-
+
private class PropertyListener implements IPropertyChangeListener {
-
+
@Override
public void propertyChange(PropertyChangeEvent event) {
- OverlayKey key= findOverlayKey(event.getProperty());
+ OverlayKey key = findOverlayKey(event.getProperty());
if (key != null)
- propagateProperty(fParent, key, fStore);
+ propagateProperty(fParent, key, fStore);
}
}
-
-
+
IPreferenceStore fParent;
IPreferenceStore fStore;
private OverlayKey[] fOverlayKeys;
-
+
private PropertyListener fPropertyListener;
-
-
+
public OverlayPreferenceStore(IPreferenceStore parent, OverlayKey[] overlayKeys) {
- fParent= parent;
- fOverlayKeys= overlayKeys;
- fStore= new PreferenceStore();
+ fParent = parent;
+ fOverlayKeys = overlayKeys;
+ fStore = new PreferenceStore();
}
-
+
OverlayKey findOverlayKey(String key) {
- for (int i= 0; i < fOverlayKeys.length; i++) {
+ for (int i = 0; i < fOverlayKeys.length; i++) {
if (fOverlayKeys[i].fKey.equals(key))
return fOverlayKeys[i];
}
return null;
}
-
+
private boolean covers(String key) {
return (findOverlayKey(key) != null);
}
-
+
void propagateProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target) {
-
+
if (orgin.isDefault(key.fKey)) {
if (!target.isDefault(key.fKey))
target.setToDefault(key.fKey);
return;
}
-
- TypeDescriptor d= key.fDescriptor;
+
+ TypeDescriptor d = key.fDescriptor;
if (BOOLEAN == d) {
-
- boolean originValue= orgin.getBoolean(key.fKey);
- boolean targetValue= target.getBoolean(key.fKey);
+
+ boolean originValue = orgin.getBoolean(key.fKey);
+ boolean targetValue = target.getBoolean(key.fKey);
if (targetValue != originValue)
target.setValue(key.fKey, originValue);
-
+
} else if (DOUBLE == d) {
-
- double originValue= orgin.getDouble(key.fKey);
- double targetValue= target.getDouble(key.fKey);
+
+ double originValue = orgin.getDouble(key.fKey);
+ double targetValue = target.getDouble(key.fKey);
if (targetValue != originValue)
target.setValue(key.fKey, originValue);
-
+
} else if (FLOAT == d) {
-
- float originValue= orgin.getFloat(key.fKey);
- float targetValue= target.getFloat(key.fKey);
+
+ float originValue = orgin.getFloat(key.fKey);
+ float targetValue = target.getFloat(key.fKey);
if (targetValue != originValue)
target.setValue(key.fKey, originValue);
-
+
} else if (INT == d) {
- int originValue= orgin.getInt(key.fKey);
- int targetValue= target.getInt(key.fKey);
+ int originValue = orgin.getInt(key.fKey);
+ int targetValue = target.getInt(key.fKey);
if (targetValue != originValue)
target.setValue(key.fKey, originValue);
} else if (LONG == d) {
- long originValue= orgin.getLong(key.fKey);
- long targetValue= target.getLong(key.fKey);
+ long originValue = orgin.getLong(key.fKey);
+ long targetValue = target.getLong(key.fKey);
if (targetValue != originValue)
target.setValue(key.fKey, originValue);
} else if (STRING == d) {
- String originValue= orgin.getString(key.fKey);
- String targetValue= target.getString(key.fKey);
+ String originValue = orgin.getString(key.fKey);
+ String targetValue = target.getString(key.fKey);
if (targetValue != null && originValue != null && !targetValue.equals(originValue))
target.setValue(key.fKey, originValue);
}
}
-
+
public void propagate() {
- for (int i= 0; i < fOverlayKeys.length; i++)
+ for (int i = 0; i < fOverlayKeys.length; i++)
propagateProperty(fStore, fOverlayKeys[i], fParent);
}
-
- private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) {
- TypeDescriptor d= key.fDescriptor;
+
+ private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target,
+ boolean forceInitialization) {
+ TypeDescriptor d = key.fDescriptor;
if (BOOLEAN == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, true);
target.setValue(key.fKey, orgin.getBoolean(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));
-
+
} else if (DOUBLE == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, 1.0D);
target.setValue(key.fKey, orgin.getDouble(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));
-
+
} else if (FLOAT == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, 1.0F);
target.setValue(key.fKey, orgin.getFloat(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));
-
+
} else if (INT == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, 1);
target.setValue(key.fKey, orgin.getInt(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));
-
+
} else if (LONG == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, 1L);
target.setValue(key.fKey, orgin.getLong(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));
-
+
} else if (STRING == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, "1"); //$NON-NLS-1$
target.setValue(key.fKey, orgin.getString(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));
-
+
}
}
-
+
public void load() {
- for (int i= 0; i < fOverlayKeys.length; i++)
+ for (int i = 0; i < fOverlayKeys.length; i++)
loadProperty(fParent, fOverlayKeys[i], fStore, true);
}
-
+
public void loadDefaults() {
- for (int i= 0; i < fOverlayKeys.length; i++)
+ for (int i = 0; i < fOverlayKeys.length; i++)
setToDefault(fOverlayKeys[i].fKey);
}
-
+
public void start() {
if (fPropertyListener == null) {
- fPropertyListener= new PropertyListener();
+ fPropertyListener = new PropertyListener();
fParent.addPropertyChangeListener(fPropertyListener);
}
}
-
+
public void stop() {
- if (fPropertyListener != null) {
+ if (fPropertyListener != null) {
fParent.removePropertyChangeListener(fPropertyListener);
- fPropertyListener= null;
+ fPropertyListener = null;
}
}
-
+
@Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
fStore.addPropertyChangeListener(listener);
}
-
+
@Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
fStore.removePropertyChangeListener(listener);
}
-
+
@Override
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
fStore.firePropertyChangeEvent(name, oldValue, newValue);
@@ -236,7 +234,7 @@ class OverlayPreferenceStore implements IPreferenceStore {
public boolean contains(String name) {
return fStore.contains(name);
}
-
+
@Override
public boolean getBoolean(String name) {
return fStore.getBoolean(name);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/StatusInfo.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/StatusInfo.java
index 1b0a453770e..01e74b7cb07 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/StatusInfo.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/StatusInfo.java
@@ -18,7 +18,6 @@ import org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
-
/**
* A settable IStatus.
* Can be an error, warning, info or ok. For error, info and warning states,
@@ -43,8 +42,8 @@ public class StatusInfo implements IStatus {
* WARNING and INFO.
*/
public StatusInfo(int severity, String message) {
- fStatusMessage= message;
- fSeverity= severity;
+ fStatusMessage = message;
+ fSeverity = severity;
}
/**
@@ -87,8 +86,8 @@ public class StatusInfo implements IStatus {
*/
public void setError(String errorMessage) {
Assert.isNotNull(errorMessage);
- fStatusMessage= errorMessage;
- fSeverity= IStatus.ERROR;
+ fStatusMessage = errorMessage;
+ fSeverity = IStatus.ERROR;
}
/**
@@ -97,8 +96,8 @@ public class StatusInfo implements IStatus {
*/
public void setWarning(String warningMessage) {
Assert.isNotNull(warningMessage);
- fStatusMessage= warningMessage;
- fSeverity= IStatus.WARNING;
+ fStatusMessage = warningMessage;
+ fSeverity = IStatus.WARNING;
}
/**
@@ -107,16 +106,16 @@ public class StatusInfo implements IStatus {
*/
public void setInfo(String infoMessage) {
Assert.isNotNull(infoMessage);
- fStatusMessage= infoMessage;
- fSeverity= IStatus.INFO;
+ fStatusMessage = infoMessage;
+ fSeverity = IStatus.INFO;
}
/**
* Sets the status to OK.
*/
public void setOK() {
- fStatusMessage= null;
- fSeverity= IStatus.OK;
+ fStatusMessage = null;
+ fSeverity = IStatus.OK;
}
/*
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/TabFolderLayout.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/TabFolderLayout.java
index ca9eeaf31bb..2635eda3084 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/TabFolderLayout.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/preferences/TabFolderLayout.java
@@ -24,33 +24,33 @@ import org.eclipse.swt.widgets.Layout;
public class TabFolderLayout extends Layout {
@Override
- protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
return new Point(wHint, hHint);
-
- Control [] children = composite.getChildren ();
+
+ Control[] children = composite.getChildren();
int count = children.length;
int maxWidth = 0, maxHeight = 0;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache);
- maxWidth = Math.max (maxWidth, pt.x);
- maxHeight = Math.max (maxHeight, pt.y);
+ for (int i = 0; i < count; i++) {
+ Control child = children[i];
+ Point pt = child.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
+ maxWidth = Math.max(maxWidth, pt.x);
+ maxHeight = Math.max(maxHeight, pt.y);
}
-
+
if (wHint != SWT.DEFAULT)
- maxWidth= wHint;
+ maxWidth = wHint;
if (hHint != SWT.DEFAULT)
- maxHeight= hHint;
-
- return new Point(maxWidth, maxHeight);
-
+ maxHeight = hHint;
+
+ return new Point(maxWidth, maxHeight);
+
}
-
+
@Override
- protected void layout (Composite composite, boolean flushCache) {
- Rectangle rect= composite.getClientArea();
-
+ protected void layout(Composite composite, boolean flushCache) {
+ Rectangle rect = composite.getClientArea();
+
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; i++) {
children[i].setBounds(rect);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AbstractConfigurePropertyOptionsPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AbstractConfigurePropertyOptionsPage.java
index c6d7847e7a9..debf4c401a8 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AbstractConfigurePropertyOptionsPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AbstractConfigurePropertyOptionsPage.java
@@ -18,8 +18,7 @@ import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.PropertyChangeEvent;
-public abstract class AbstractConfigurePropertyOptionsPage extends
- FieldEditorPreferencePage {
+public abstract class AbstractConfigurePropertyOptionsPage extends FieldEditorPreferencePage {
private boolean dirty = false;
private String name;
@@ -28,16 +27,16 @@ public abstract class AbstractConfigurePropertyOptionsPage extends
this(GRID);
this.name = name;
}
-
+
protected String getName() {
return name;
}
-
+
protected AbstractConfigurePropertyOptionsPage(int style) {
super(style);
noDefaultAndApplyButton();
}
-
+
@Override
protected void createFieldEditors() {
// Get the preference store for the build settings
@@ -50,17 +49,26 @@ public abstract class AbstractConfigurePropertyOptionsPage extends
*/
@Override
public void propertyChange(PropertyChangeEvent event) {
- super.propertyChange(event);
+ super.propertyChange(event);
if (event.getProperty().equals(FieldEditor.VALUE)) {
- setDirty(true);
+ setDirty(true);
}
}
- public void setDirty(boolean b) { dirty = b; }
- public boolean isDirty() { return dirty; }
- public void storeSettings() { super.performOk(); }
+ public void setDirty(boolean b) {
+ dirty = b;
+ }
+
+ public boolean isDirty() {
+ return dirty;
+ }
+
+ public void storeSettings() {
+ super.performOk();
+ }
public abstract void updateFields();
+
public abstract void setValues();
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java
index 28ea082098d..b394401485e 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java
@@ -30,7 +30,6 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-
public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
private String TRUE = "true"; //$NON-NLS-1$
@@ -41,14 +40,14 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
private String CLEAN_MAKETARGET_TOOLTIP = "CleanMakeTarget.tooltip"; //$NON-NLS-1$
private String AUTO_BUILDNAME_LABEL = "AutoBuildName.label"; //$NON-NLS-1$
private String AUTO_BUILDNAME_TOOLTIP = "AutoBuildName.tooltip"; //$NON-NLS-1$
-
+
protected Button fCleanDelete;
protected Button fCleanMake;
protected Button fAutoName;
- protected Text fCleanMakeTarget;
+ protected Text fCleanMakeTarget;
private IProject getProject() {
- return (IProject)getCfg().getManagedProject().getOwner();
+ return (IProject) getCfg().getManagedProject().getOwner();
}
@Override
@@ -59,50 +58,53 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
@Override
public void createControls(Composite parent) {
super.createControls(parent);
- Composite composite= usercomp;
+ Composite composite = usercomp;
// assume parent page uses griddata
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
+ GridData gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
composite.setLayoutData(gd);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
//PixelConverter pc= new PixelConverter(composite);
//layout.verticalSpacing= pc.convertHeightInCharsToPixels(1) / 2;
composite.setLayout(layout);
-
+
Group g = new Group(composite, SWT.SHADOW_ETCHED_IN);
g.setText(AutotoolsPropertyMessages.getString("CleanBehavior.title"));
- gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
g.setLayoutData(gd);
- layout= new GridLayout();
- layout.numColumns= 2;
+ layout = new GridLayout();
+ layout.numColumns = 2;
g.setLayout(layout);
-
+
fCleanDelete = new Button(g, SWT.RADIO);
fCleanDelete.setText(AutotoolsPropertyMessages.getString(CLEAN_DELETE_LABEL));
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
gd.horizontalSpan = 2;
fCleanDelete.setLayoutData(gd);
fCleanMake = new Button(g, SWT.RADIO);
fCleanMake.setText(AutotoolsPropertyMessages.getString(CLEAN_MAKE_LABEL));
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
gd.horizontalSpan = 2;
fCleanMake.setLayoutData(gd);
-
+
Label label = new Label(g, SWT.LEFT);
label.setText(AutotoolsPropertyMessages.getString(CLEAN_MAKETARGET_LABEL));
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
-
+
fCleanMakeTarget = new Text(g, SWT.SINGLE | SWT.BORDER);
fCleanMakeTarget.setText(AutotoolsPropertyConstants.CLEAN_MAKE_TARGET_DEFAULT);
fCleanMakeTarget.setToolTipText(AutotoolsPropertyMessages.getString(CLEAN_MAKETARGET_TOOLTIP));
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
fCleanMakeTarget.setLayoutData(gd);
-
+
fCleanDelete.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -111,7 +113,7 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
fCleanMakeTarget.setEnabled(false);
}
});
-
+
fCleanMake.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -120,21 +122,21 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
fCleanMakeTarget.setEnabled(true);
}
});
-
+
fCleanMakeTarget.addModifyListener(e -> {
if (fCleanMakeTarget.getText().isEmpty()) {
// FIXME: should probably issue warning here, but how?
}
});
-
+
fAutoName = new Button(composite, SWT.LEFT | SWT.CHECK);
fAutoName.setText(AutotoolsPropertyMessages.getString(AUTO_BUILDNAME_LABEL));
fAutoName.setToolTipText(AutotoolsPropertyMessages.getString(AUTO_BUILDNAME_TOOLTIP));
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
gd.horizontalSpan = 2;
fAutoName.setLayoutData(gd);
-
+
initialize();
}
@@ -143,7 +145,7 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
IProject project = getProject();
if (fCleanDelete.getSelection()) {
try {
- project.setPersistentProperty(AutotoolsPropertyConstants.CLEAN_DELETE, TRUE);
+ project.setPersistentProperty(AutotoolsPropertyConstants.CLEAN_DELETE, TRUE);
} catch (CoreException ce) {
// FIXME: what can we do here?
}
@@ -159,10 +161,10 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
// FIXME: what can we do here?
}
}
-
+
if (fAutoName.getSelection()) {
try {
- project.setPersistentProperty(AutotoolsPropertyConstants.AUTO_BUILD_NAME, TRUE);
+ project.setPersistentProperty(AutotoolsPropertyConstants.AUTO_BUILD_NAME, TRUE);
} catch (CoreException ce) {
// FIXME: what can we do here?
}
@@ -180,7 +182,7 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
performOK();
}
-
+
@Override
protected void performDefaults() {
fCleanDelete.setSelection(false);
@@ -189,12 +191,12 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
fCleanMakeTarget.setEnabled(true);
fAutoName.setEnabled(true);
}
-
+
@Override
public void updateData(ICResourceDescription cfgd) {
// what to do here?
}
-
+
@Override
public void updateButtons() {
// what to do here?
@@ -227,11 +229,11 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
fCleanMake.setSelection(false);
fCleanMakeTarget.setEnabled(false);
}
-
+
if (autoName == null || autoName.equals(TRUE))
fAutoName.setSelection(true);
else
fAutoName.setSelection(false);
}
-
+
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsCategoryPropertyOptionPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsCategoryPropertyOptionPage.java
index 7481ad2574c..2c3984c67e0 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsCategoryPropertyOptionPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsCategoryPropertyOptionPage.java
@@ -40,49 +40,57 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-public class AutotoolsCategoryPropertyOptionPage extends
- AbstractConfigurePropertyOptionsPage {
+public class AutotoolsCategoryPropertyOptionPage extends AbstractConfigurePropertyOptionsPage {
private static final int MARGIN = 3;
private String catName = "";
private IAConfiguration cfg;
+
// Label class for a preference page.
static class LabelFieldEditor extends FieldEditor {
private String fTitle;
private Label fTitleLabel;
- public LabelFieldEditor( Composite parent, String title ) {
+ public LabelFieldEditor(Composite parent, String title) {
fTitle = title;
- this.createControl( parent );
+ this.createControl(parent);
}
@Override
- protected void adjustForNumColumns( int numColumns ) {
- ((GridData)fTitleLabel.getLayoutData()).horizontalSpan = 2;
+ protected void adjustForNumColumns(int numColumns) {
+ ((GridData) fTitleLabel.getLayoutData()).horizontalSpan = 2;
}
@Override
- protected void doFillIntoGrid( Composite parent, int numColumns ) {
- fTitleLabel = new Label( parent, SWT.WRAP );
- fTitleLabel.setText( fTitle );
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ fTitleLabel = new Label(parent, SWT.WRAP);
+ fTitleLabel.setText(fTitle);
GridData gd = new GridData();
gd.verticalAlignment = SWT.TOP;
gd.grabExcessHorizontalSpace = false;
gd.horizontalSpan = 2;
- fTitleLabel.setLayoutData( gd );
+ fTitleLabel.setLayoutData(gd);
}
@Override
- public int getNumberOfControls() { return 1; }
+ public int getNumberOfControls() {
+ return 1;
+ }
+
/**
* The label field editor is only used to present a text label on a preference page.
*/
@Override
- protected void doLoad() {}
+ protected void doLoad() {
+ }
+
@Override
- protected void doLoadDefault() {}
+ protected void doLoadDefault() {
+ }
+
@Override
- protected void doStore() {}
+ protected void doStore() {
+ }
}
static class VariableListEditor extends ListEditor {
@@ -304,19 +312,19 @@ public class AutotoolsCategoryPropertyOptionPage extends
};
private List<FieldEditor> fieldEditors;
-
+
public AutotoolsCategoryPropertyOptionPage(ToolListElement element, IAConfiguration cfg) {
- super(element.getName());
- this.catName = element.getName();
- this.cfg = cfg;
- fieldEditors = new ArrayList<>();
+ super(element.getName());
+ this.catName = element.getName();
+ this.cfg = cfg;
+ fieldEditors = new ArrayList<>();
}
@Override
protected void createFieldEditors() {
super.createFieldEditors();
Composite parent = getFieldEditorParent();
-
+
// Add margin
parent.setLayout(new GridLayout(1, false));
Composite area = new Composite(parent, SWT.NONE);
@@ -326,8 +334,8 @@ public class AutotoolsCategoryPropertyOptionPage extends
gl.marginRight = MARGIN;
area.setLayout(gl);
area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
-
-// FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent);
+
+ // FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent);
AutotoolsConfiguration.Option[] options = AutotoolsConfiguration.getChildOptions(catName);
for (int i = 0; i < options.length; ++i) {
AutotoolsConfiguration.Option option = options[i];
@@ -369,29 +377,29 @@ public class AutotoolsCategoryPropertyOptionPage extends
public void updateFields() {
setValues();
}
-
+
@Override
public void setValues() {
for (int i = 0; i < fieldEditors.size(); ++i) {
fieldEditors.get(i).load();
}
}
-
+
@Override
public void propertyChange(PropertyChangeEvent event) {
// allow superclass to handle as well
super.propertyChange(event);
if (event.getSource() instanceof StringFieldEditor) {
- StringFieldEditor f = (StringFieldEditor)event.getSource();
+ StringFieldEditor f = (StringFieldEditor) event.getSource();
cfg.setOption(f.getPreferenceName(), f.getStringValue());
} else if (event.getSource() instanceof BooleanFieldEditor) {
- BooleanFieldEditor b = (BooleanFieldEditor)event.getSource();
+ BooleanFieldEditor b = (BooleanFieldEditor) event.getSource();
cfg.setOption(b.getPreferenceName(), Boolean.toString(b.getBooleanValue()));
} else if (event.getSource() instanceof VariableListEditor) {
VariableListEditor v = (VariableListEditor) event.getSource();
cfg.setOption(v.getPreferenceName(), v.getVariablesValue());
}
}
-
+
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePrefStore.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePrefStore.java
index 194ebffce19..4630aa371b9 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePrefStore.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePrefStore.java
@@ -28,7 +28,7 @@ public class AutotoolsConfigurePrefStore implements IPreferenceStore {
public final static String EMPTY_STRING = "";
public final static String ALL_OPTIONS_ID = EMPTY_STRING;
-
+
private static AutotoolsConfigurePrefStore instance = null;
private ToolListElement selectedElement;
private IAConfiguration cfg;
@@ -38,18 +38,18 @@ public class AutotoolsConfigurePrefStore implements IPreferenceStore {
private AutotoolsConfigurePrefStore() {
// private constructor
}
-
+
public static AutotoolsConfigurePrefStore getInstance() {
if (instance == null)
instance = new AutotoolsConfigurePrefStore();
return instance;
}
-
+
public void setSelection(IAConfiguration cfg, ToolListElement element) {
this.cfg = cfg;
selectedElement = element;
}
-
+
@Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
listenerList.add(listener);
@@ -61,16 +61,13 @@ public class AutotoolsConfigurePrefStore implements IPreferenceStore {
}
@Override
- public void firePropertyChangeEvent(String name, Object oldValue,
- Object newValue) {
+ public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
Object[] listeners = listenerList.getListeners();
- if (listeners.length > 0 && (oldValue == null || !oldValue.equals(newValue)))
- {
+ if (listeners.length > 0 && (oldValue == null || !oldValue.equals(newValue))) {
PropertyChangeEvent pe = new PropertyChangeEvent(this, name, oldValue, newValue);
- for (int i = 0; i < listeners.length; ++i)
- {
- IPropertyChangeListener l = (IPropertyChangeListener)listeners[i];
- l.propertyChange( pe );
+ for (int i = 0; i < listeners.length; ++i) {
+ IPropertyChangeListener l = (IPropertyChangeListener) listeners[i];
+ l.propertyChange(pe);
}
}
}
@@ -78,8 +75,8 @@ public class AutotoolsConfigurePrefStore implements IPreferenceStore {
@Override
public boolean getBoolean(String name) {
IConfigureOption option = cfg.getOption(name);
- if (option != null && (option.getType() == IConfigureOption.BIN ||
- option.getType() == IConfigureOption.FLAGVALUE)) {
+ if (option != null
+ && (option.getType() == IConfigureOption.BIN || option.getType() == IConfigureOption.FLAGVALUE)) {
return Boolean.parseBoolean(option.getValue());
}
// otherwise punt
@@ -172,39 +169,50 @@ public class AutotoolsConfigurePrefStore implements IPreferenceStore {
protected void setDirty(boolean isdirty) {
this.isdirty = isdirty;
}
-
+
@Override
- public void setDefault(String name, double value) {}
+ public void setDefault(String name, double value) {
+ }
@Override
- public void setDefault(String name, float value) {}
+ public void setDefault(String name, float value) {
+ }
@Override
- public void setDefault(String name, int value) {}
+ public void setDefault(String name, int value) {
+ }
@Override
- public void setDefault(String name, long value) {}
+ public void setDefault(String name, long value) {
+ }
@Override
- public void setDefault(String name, String defaultObject) {}
+ public void setDefault(String name, String defaultObject) {
+ }
@Override
- public void setDefault(String name, boolean value) {}
+ public void setDefault(String name, boolean value) {
+ }
@Override
- public void setToDefault(String name) {}
+ public void setToDefault(String name) {
+ }
@Override
- public void setValue(String name, double value) {}
+ public void setValue(String name, double value) {
+ }
@Override
- public void setValue(String name, float value) {}
+ public void setValue(String name, float value) {
+ }
@Override
- public void setValue(String name, int value) {}
+ public void setValue(String name, int value) {
+ }
@Override
- public void setValue(String name, long value) {}
+ public void setValue(String name, long value) {
+ }
@Override
public void setValue(String name, String value) {
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyPage.java
index e31ed118aef..219b1c43a5e 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyPage.java
@@ -22,12 +22,12 @@ import org.eclipse.cdt.ui.newui.AbstractPage;
public class AutotoolsConfigurePropertyPage extends AbstractPage {
private ICConfigurationDescription cfgd;
-
+
@Override
protected boolean isSingle() {
return true;
}
-
+
/**
* Default constructor
*/
@@ -38,7 +38,7 @@ public class AutotoolsConfigurePropertyPage extends AbstractPage {
public ICConfigurationDescription getCfgd() {
return cfgd;
}
-
+
public void getAllConfigurationData() {
ICConfigurationDescription[] cfgds = getCfgsEditable();
for (int i = 0; i < cfgds.length; ++i) {
@@ -48,11 +48,11 @@ public class AutotoolsConfigurePropertyPage extends AbstractPage {
CConfigurationData data = cfgds[i].getConfigurationData();
}
}
-
+
public IAConfiguration getConfiguration(ICConfigurationDescription cfgd) {
return AutotoolsConfigurationManager.getInstance().getTmpConfiguration(getProject(), cfgd);
}
-
+
@Override
protected void cfgChanged(ICConfigurationDescription cfgd) {
this.cfgd = cfgd;
@@ -60,4 +60,3 @@ public class AutotoolsConfigurePropertyPage extends AbstractPage {
super.cfgChanged(cfgd);
}
}
-
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyTab.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyTab.java
index 414ca2708c9..03a985a6636 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyTab.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsConfigurePropertyTab.java
@@ -67,47 +67,47 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
}
private IAConfiguration getAutotoolsCfg() {
- AutotoolsConfigurePropertyPage ap = (AutotoolsConfigurePropertyPage)page;
+ AutotoolsConfigurePropertyPage ap = (AutotoolsConfigurePropertyPage) page;
// We call getConfigurationData() to get the name because if the configuration has been renamed,
// it will cause the option value handler to clone the IAConfiguration
return ap.getConfiguration(icfgd);
}
private void syncClones() {
- AutotoolsConfigurePropertyPage ap = (AutotoolsConfigurePropertyPage)page;
+ AutotoolsConfigurePropertyPage ap = (AutotoolsConfigurePropertyPage) page;
// We call getConfigurationData() to get the name because if the configuration has been renamed,
// it will cause the option value handler to clone the IAConfiguration
ap.getAllConfigurationData();
}
-
+
@Override
public IPreferenceStore getPreferenceStore() {
return settingsStore;
}
-
+
@Override
public void createControls(Composite parent) {
AutotoolsConfigurationManager.getInstance().clearTmpConfigurations(page.getProject());
syncClones();
-
+
super.createControls(parent);
- Composite composite= usercomp;
-
+ Composite composite = usercomp;
+
settingsStore = AutotoolsConfigurePrefStore.getInstance();
configToPageListMap = new HashMap<>();
-
+
// assume parent page uses griddata
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL
- | GridData.FILL_VERTICAL);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL
+ | GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
composite.setLayoutData(gd);
- GridLayout layout= new GridLayout();
+ GridLayout layout = new GridLayout();
composite.setLayout(layout);
-
+
// Create the sash form
sashForm = new SashForm(usercomp, SWT.NONE);
sashForm.setOrientation(SWT.HORIZONTAL);
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
layout = new GridLayout(2, true);
layout.marginHeight = 5;
sashForm.setLayout(layout);
@@ -116,7 +116,7 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
}
private void createSelectionArea(Composite parent) {
- fTree = new TreeViewer(parent, SWT.SINGLE|SWT.H_SCROLL|SWT.V_SCROLL|SWT.BORDER);
+ fTree = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
fTree.addSelectionChangedListener(event -> handleOptionSelection());
fTree.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
// Create a temporary default AutotoolsConfiguration to use for label info
@@ -128,29 +128,28 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
containerSC = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
containerSC.setExpandHorizontal(true);
containerSC.setExpandVertical(true);
-
+
// Add a container for the build settings page
settingsPageContainer = new Composite(containerSC, SWT.NONE);
settingsPageContainer.setLayout(new PageLayout());
containerSC.setContent(settingsPageContainer);
-// containerSC.setMinSize(settingsPageContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ // containerSC.setMinSize(settingsPageContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
settingsPageContainer.layout();
}
-
+
private void setValues() {
/*
* This method updates the context of the build property pages
* - Which configuration/resource configuration is selected
* - Which tool/option category is selected
- *
+ *
* It is called:
* - When a property page becomes visible
* - When the user changes the configuration selection
* - When the user changes the "exclude" setting for a resource
*/
-
-
+
IConfiguration icfg = getCfg(icfgd.getConfiguration());
if (icfg instanceof IMultiConfiguration) {
fTree.setInput(null);
@@ -160,7 +159,7 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
}
IAConfiguration currCfg = getAutotoolsCfg();
-
+
// Create the Tree Viewer content provider if first time
if (listprovider == null) {
listprovider = new ToolListContentProvider();
@@ -169,22 +168,23 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
// Update the selected configuration and the Tree Viewer
ToolListElement[] newElements;
-
+
fTree.setInput(currCfg);
fTree.getControl().setEnabled(true);
- newElements = (ToolListElement[])listprovider.getElements(currCfg);
+ newElements = (ToolListElement[]) listprovider.getElements(currCfg);
fTree.expandAll();
-
+
selectedElement = newElements[0];
fTree.setSelection(new StructuredSelection(selectedElement), true);
-
+
}
private void handleOptionSelection() {
// Get the selection from the tree list
- if (fTree == null) return;
+ if (fTree == null)
+ return;
IStructuredSelection selection = (IStructuredSelection) fTree.getSelection();
- ToolListElement element = (ToolListElement)selection.getFirstElement();
+ ToolListElement element = (ToolListElement) selection.getFirstElement();
if (element != null) {
displayPageForElement(element);
}
@@ -193,21 +193,21 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
if (sb != null && sb.isVisible()) {
settingsPageContainer.pack(true);
containerSC.setMinSize(settingsPageContainer.getSize());
- ((AbstractPage)page).resize();
+ ((AbstractPage) page).resize();
}
}
private void displayPageForElement(ToolListElement element) {
selectedElement = element;
settingsStore.setSelection(getAutotoolsCfg(), selectedElement);
-
+
AbstractConfigurePropertyOptionsPage oldPage = currentSettingsPage;
currentSettingsPage = null;
// Create a new settings page if necessary
List<AbstractConfigurePropertyOptionsPage> pages = getPagesForConfig();
ListIterator<AbstractConfigurePropertyOptionsPage> iter = pages.listIterator();
-
+
while (iter.hasNext()) {
AbstractConfigurePropertyOptionsPage page = iter.next();
if (page.getName().equals(element.getName())) {
@@ -217,12 +217,9 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
}
if (currentSettingsPage == null) {
if (element.getType() == IConfigureOption.TOOL) {
- currentSettingsPage = new AutotoolsToolPropertyOptionPage(
- element, getAutotoolsCfg());
- }
- else {
- currentSettingsPage = new AutotoolsCategoryPropertyOptionPage(
- element, getAutotoolsCfg());
+ currentSettingsPage = new AutotoolsToolPropertyOptionPage(element, getAutotoolsCfg());
+ } else {
+ currentSettingsPage = new AutotoolsCategoryPropertyOptionPage(element, getAutotoolsCfg());
}
pages.add(currentSettingsPage);
currentSettingsPage.setContainer(this);
@@ -230,7 +227,7 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
currentSettingsPage.createControl(settingsPageContainer);
}
}
-
+
// Make all the other pages invisible
Control[] children = settingsPageContainer.getChildren();
Control currentControl = currentSettingsPage.getControl();
@@ -240,33 +237,34 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
}
currentSettingsPage.setVisible(true);
currentSettingsPage.updateFields();
-
- if (oldPage != null && oldPage != currentSettingsPage)
+
+ if (oldPage != null && oldPage != currentSettingsPage)
oldPage.setVisible(false);
// Set the size of the scrolled area
containerSC.setMinSize(currentSettingsPage.computeSize());
settingsPageContainer.layout();
-
+
}
/**
* Answers the list of settings pages for the selected configuration
*/
private List<AbstractConfigurePropertyOptionsPage> getPagesForConfig() {
- if (getCfg() == null) return null;
+ if (getCfg() == null)
+ return null;
List<AbstractConfigurePropertyOptionsPage> pages = configToPageListMap.get(getCfg().getName());
if (pages == null) {
pages = new ArrayList<>();
- configToPageListMap.put(getCfg().getName(), pages);
+ configToPageListMap.put(getCfg().getName(), pages);
}
return pages;
}
-
+
@Override
protected void performOK() {
ICConfigurationDescription[] cfgs = page.getCfgsEditable();
- AutotoolsConfigurePropertyPage ap = (AutotoolsConfigurePropertyPage)page;
+ AutotoolsConfigurePropertyPage ap = (AutotoolsConfigurePropertyPage) page;
Map<String, IAConfiguration> cfgList = new HashMap<>();
for (int i = 0; i < cfgs.length; ++i) {
ICConfigurationDescription cd = cfgs[i];
@@ -277,12 +275,12 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
AutotoolsConfigurationManager.getInstance().replaceProjectConfigurations(project, cfgList, cfgs);
AutotoolsConfigurationManager.getInstance().clearTmpConfigurations(project);
}
-
+
@Override
protected void performCancel() {
AutotoolsConfigurationManager.getInstance().clearTmpConfigurations(page.getProject());
}
-
+
@Override
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
IProject project = page.getProject();
@@ -291,26 +289,32 @@ public class AutotoolsConfigurePropertyTab extends AbstractAutotoolsCPropertyTab
// deletions.
AutotoolsConfigurationManager.getInstance().applyConfigs(project.getName(), cfgs);
}
-
+
@Override
protected void performDefaults() {
IAConfiguration cfg = getAutotoolsCfg();
cfg.setDefaultOptions();
setValues();
}
-
+
@Override
protected void updateData(ICResourceDescription rd) {
- if (rd == null) return;
+ if (rd == null)
+ return;
icfgd = rd.getConfiguration();
setValues();
}
-
+
// IPreferencePageContainer methods
@Override
- public void updateButtons() {}
+ public void updateButtons() {
+ }
+
@Override
- public void updateMessage() {}
+ public void updateMessage() {
+ }
+
@Override
- public void updateTitle() {}
+ public void updateTitle() {
+ }
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsEditorPropertyTab.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsEditorPropertyTab.java
index 1aced2e73bb..72d2963bc60 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsEditorPropertyTab.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsEditorPropertyTab.java
@@ -27,7 +27,6 @@ import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-
public class AutotoolsEditorPropertyTab extends AbstractAutotoolsCPropertyTab {
protected Combo fACVersionCombo;
@@ -42,43 +41,43 @@ public class AutotoolsEditorPropertyTab extends AbstractAutotoolsCPropertyTab {
@Override
public void createControls(Composite parent) {
super.createControls(parent);
- Composite composite= usercomp;
-
+ Composite composite = usercomp;
+
// assume parent page uses griddata
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL);
composite.setLayoutData(gd);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
//PixelConverter pc= new PixelConverter(composite);
//layout.verticalSpacing= pc.convertHeightInCharsToPixels(1) / 2;
composite.setLayout(layout);
-
+
project = page.getProject();
-
+
/* check box for new editors */
- fACVersionCombo= new Combo(composite, SWT.CHECK | SWT.DROP_DOWN | SWT.READ_ONLY);
+ fACVersionCombo = new Combo(composite, SWT.CHECK | SWT.DROP_DOWN | SWT.READ_ONLY);
fACVersionCombo.setItems(AutotoolsPropertyConstants.fACVersions);
fACVersionCombo.select(AutotoolsPropertyConstants.fACVersions.length - 1);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
fACVersionCombo.setLayoutData(gd);
-
- Label label= new Label(composite, SWT.LEFT);
+
+ Label label = new Label(composite, SWT.LEFT);
label.setText(AutotoolsPropertyMessages.getString("ACEditor.autoconfVersion")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
-
+
/* check box for new editors */
- fAMVersionCombo= new Combo(composite, SWT.CHECK | SWT.DROP_DOWN | SWT.READ_ONLY);
+ fAMVersionCombo = new Combo(composite, SWT.CHECK | SWT.DROP_DOWN | SWT.READ_ONLY);
fAMVersionCombo.setItems(AutotoolsPropertyConstants.fAMVersions);
fAMVersionCombo.select(AutotoolsPropertyConstants.fAMVersions.length - 1);
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
fAMVersionCombo.setLayoutData(gd);
-
- Label label2= new Label(composite, SWT.LEFT);
+
+ Label label2 = new Label(composite, SWT.LEFT);
label2.setText(AutotoolsPropertyMessages.getString("ACEditor.automakeVersion")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label2.setLayoutData(gd);
initialize();
@@ -101,7 +100,8 @@ public class AutotoolsEditorPropertyTab extends AbstractAutotoolsCPropertyTab {
if (!acVerSelected.equals(acVer)) {
changed = true;
try {
- project.setPersistentProperty(AutotoolsPropertyConstants.AUTOCONF_VERSION, fACVersionCombo.getItem(index));
+ project.setPersistentProperty(AutotoolsPropertyConstants.AUTOCONF_VERSION,
+ fACVersionCombo.getItem(index));
} catch (CoreException ce) {
// Not much we can do at this point
}
@@ -112,7 +112,8 @@ public class AutotoolsEditorPropertyTab extends AbstractAutotoolsCPropertyTab {
if (!amVerSelected.equals(amVer)) {
changed = true;
try {
- project.setPersistentProperty(AutotoolsPropertyConstants.AUTOMAKE_VERSION, fAMVersionCombo.getItem(index));
+ project.setPersistentProperty(AutotoolsPropertyConstants.AUTOMAKE_VERSION,
+ fAMVersionCombo.getItem(index));
} catch (CoreException ce) {
// Not much we can do here either
}
@@ -121,19 +122,21 @@ public class AutotoolsEditorPropertyTab extends AbstractAutotoolsCPropertyTab {
// Notify any Autoconf editors that are open for this project that macro versioning
// has changed.
if (changed)
- AutotoolsPropertyManager.getDefault().notifyPropertyListeners(project, AutotoolsPropertyConstants.AUTOCONF_MACRO_VERSIONING);
+ AutotoolsPropertyManager.getDefault().notifyPropertyListeners(project,
+ AutotoolsPropertyConstants.AUTOCONF_MACRO_VERSIONING);
}
-
+
@Override
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
performOK();
}
-
+
@Override
public void performDefaults() {
// For default Autoconf and Automake versions, use the setting from the
// Autotools preference dialog.
- String version = AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION);
+ String version = AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION);
String[] items = fACVersionCombo.getItems();
// Try and find which list item matches the current preference stored and
// select it in the list.
@@ -146,7 +149,8 @@ public class AutotoolsEditorPropertyTab extends AbstractAutotoolsCPropertyTab {
i = items.length - 1;
fACVersionCombo.select(i);
- version = AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION);
+ version = AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getString(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION);
items = fAMVersionCombo.getItems();
// Try and find which list item matches the current preference stored and
// select it in the list
@@ -158,12 +162,12 @@ public class AutotoolsEditorPropertyTab extends AbstractAutotoolsCPropertyTab {
i = items.length - 1;
fAMVersionCombo.select(i);
}
-
+
@Override
public void updateData(ICResourceDescription cfgd) {
// Nothing to do
}
-
+
@Override
public void updateButtons() {
// Nothing to do
@@ -173,13 +177,14 @@ public class AutotoolsEditorPropertyTab extends AbstractAutotoolsCPropertyTab {
initializeACVersion();
initializeAMVersion();
}
-
+
void initializeACVersion() {
String version = "";
try {
version = project.getPersistentProperty(AutotoolsPropertyConstants.AUTOCONF_VERSION);
if (version == null)
- version = AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION);
+ version = AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION);
} catch (CoreException e) {
// do nothing
}
@@ -195,13 +200,14 @@ public class AutotoolsEditorPropertyTab extends AbstractAutotoolsCPropertyTab {
i = items.length - 1;
fACVersionCombo.select(i);
}
-
+
void initializeAMVersion() {
String version = "";
try {
version = project.getPersistentProperty(AutotoolsPropertyConstants.AUTOMAKE_VERSION);
if (version == null)
- version = AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION);
+ version = AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getString(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION);
} catch (CoreException e) {
// do nothing
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsGeneralPropertyPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsGeneralPropertyPage.java
index 144beccddf4..26f44999ad1 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsGeneralPropertyPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsGeneralPropertyPage.java
@@ -18,8 +18,10 @@ public class AutotoolsGeneralPropertyPage extends AbstractPage {
protected boolean isSingle() {
return false;
}
-
+
@Override
- protected boolean showsConfig() { return false; }
+ protected boolean showsConfig() {
+ return false;
+ }
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsHeadPropertyPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsHeadPropertyPage.java
index 9d23736b606..8d2d6a2f34d 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsHeadPropertyPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsHeadPropertyPage.java
@@ -20,6 +20,8 @@ public class AutotoolsHeadPropertyPage extends AbstractPage {
}
@Override
- protected boolean showsConfig() { return false; }
+ protected boolean showsConfig() {
+ return false;
+ }
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyManager.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyManager.java
index 9e2a4107fd3..3f19a7112a7 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyManager.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyManager.java
@@ -23,20 +23,19 @@ public class AutotoolsPropertyManager implements IPropertyChangeManager {
private static volatile AutotoolsPropertyManager fInstance;
private Map<IProject, ListenerList<IProjectPropertyListener>> projectList;
-
+
private AutotoolsPropertyManager() {
projectList = new HashMap<>();
}
-
+
public static AutotoolsPropertyManager getDefault() {
if (fInstance == null)
fInstance = new AutotoolsPropertyManager();
return fInstance;
}
-
+
@Override
- public synchronized void addProjectPropertyListener(IProject project,
- IProjectPropertyListener listener) {
+ public synchronized void addProjectPropertyListener(IProject project, IProjectPropertyListener listener) {
ListenerList<IProjectPropertyListener> list = projectList.get(project);
if (list == null) {
list = new ListenerList<>();
@@ -51,14 +50,13 @@ public class AutotoolsPropertyManager implements IPropertyChangeManager {
if (list != null) {
Object[] listeners = list.getListeners();
for (int i = 0; i < listeners.length; ++i) {
- ((IProjectPropertyListener)listeners[i]).handleProjectPropertyChanged(project, property);
+ ((IProjectPropertyListener) listeners[i]).handleProjectPropertyChanged(project, property);
}
}
}
@Override
- public synchronized void removeProjectPropertyListener(IProject project,
- IProjectPropertyListener listener) {
+ public synchronized void removeProjectPropertyListener(IProject project, IProjectPropertyListener listener) {
ListenerList<IProjectPropertyListener> list = projectList.get(project);
if (list != null)
list.remove(listener);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyMessages.java
index df2ff9ae412..5d6b203977a 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyMessages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsPropertyMessages.java
@@ -23,7 +23,7 @@ import java.util.ResourceBundle;
public class AutotoolsPropertyMessages {
/**
- *
+ *
*/
private AutotoolsPropertyMessages() {
}
@@ -38,6 +38,6 @@ public class AutotoolsPropertyMessages {
} catch (NullPointerException e) {
return '#' + key + '#';
}
- }
+ }
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolPropertyOptionPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolPropertyOptionPage.java
index 97997d56af0..c982fc7969f 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolPropertyOptionPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolPropertyOptionPage.java
@@ -26,17 +26,16 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-public class AutotoolsToolPropertyOptionPage extends
- AbstractConfigurePropertyOptionsPage {
+public class AutotoolsToolPropertyOptionPage extends AbstractConfigurePropertyOptionsPage {
private static final int MARGIN = 3;
private String toolName = "";
private IAConfiguration cfg;
-
+
public AutotoolsToolPropertyOptionPage(ToolListElement element, IAConfiguration cfg) {
- super(element.getName());
- this.toolName = element.getName();
- this.cfg = cfg;
+ super(element.getName());
+ this.toolName = element.getName();
+ this.cfg = cfg;
}
@Override
@@ -53,11 +52,9 @@ public class AutotoolsToolPropertyOptionPage extends
area.setLayout(gl);
area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
FontMetrics fm = AbstractCPropertyTab.getFontMetrics(area);
- commandStringField = new StringFieldEditor(toolName,
- ConfigureMessages.getString(COMMAND),
- area);
+ commandStringField = new StringFieldEditor(toolName, ConfigureMessages.getString(COMMAND), area);
commandStringField.setEmptyStringAllowed(false);
- GridData gd = ((GridData)commandStringField.getTextControl(area).getLayoutData());
+ GridData gd = ((GridData) commandStringField.getTextControl(area).getLayoutData());
gd.grabExcessHorizontalSpace = true;
gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 3);
addField(commandStringField);
@@ -65,7 +62,7 @@ public class AutotoolsToolPropertyOptionPage extends
allOptionFieldEditor = new MultiLineTextFieldEditor(AutotoolsConfigurePrefStore.ALL_OPTIONS_ID,
ConfigureMessages.getString(ALL_OPTIONS), area);
allOptionFieldEditor.getTextControl(area).setEditable(false);
-// gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData());
+ // gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData());
gd.grabExcessHorizontalSpace = true;
gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);
addField(allOptionFieldEditor);
@@ -87,22 +84,22 @@ public class AutotoolsToolPropertyOptionPage extends
public void updateFields() {
allOptionFieldEditor.load();
}
-
+
@Override
- public void setValues(){
+ public void setValues() {
commandStringField.load();
updateFields();
}
-
+
@Override
public void propertyChange(PropertyChangeEvent event) {
// allow superclass to handle as well
super.propertyChange(event);
- if(event.getSource() == commandStringField){
+ if (event.getSource() == commandStringField) {
cfg.setOption(toolName, commandStringField.getStringValue());
updateFields();
}
}
-
+
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolsPropertyTab.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolsPropertyTab.java
index 6a7fa3c8fdb..39931cc1419 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolsPropertyTab.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsToolsPropertyTab.java
@@ -33,7 +33,7 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
public static final String DEFAULT_AUTOHEADER = "autoheader"; //$NON-NLS-1$
public static final String DEFAULT_AUTORECONF = "autoreconf"; //$NON-NLS-1$
public static final String DEFAULT_LIBTOOLIZE = "libtoolize"; //$NON-NLS-1$
-
+
protected Text fAclocalPath;
protected Text fAutomakePath;
protected Text fAutoconfPath;
@@ -42,11 +42,10 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
protected Text fLibtoolizePath;
private IProject project;
-
private IProject getProject() {
return page.getProject();
}
-
+
@Override
public boolean canBeVisible() {
return true;
@@ -55,89 +54,96 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
@Override
public void createControls(Composite parent) {
super.createControls(parent);
- Composite composite= usercomp;
-
+ Composite composite = usercomp;
+
// assume parent page uses griddata
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
+ GridData gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
composite.setLayoutData(gd);
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
//PixelConverter pc= new PixelConverter(composite);
//layout.verticalSpacing= pc.convertHeightInCharsToPixels(1) / 2;
composite.setLayout(layout);
-
+
project = getProject();
-
- Label label= new Label(composite, SWT.LEFT);
+
+ Label label = new Label(composite, SWT.LEFT);
label.setText(AutotoolsPropertyMessages.getString("Autotools.aclocalPath")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label.setLayoutData(gd);
-
+
/* text window for aclocal path */
fAclocalPath = new Text(composite, SWT.BORDER | SWT.SINGLE);
fAclocalPath.setToolTipText(AutotoolsPropertyMessages.getString("Autotools.aclocalPath.tooltip")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
fAclocalPath.setLayoutData(gd);
-
- Label label2= new Label(composite, SWT.LEFT);
+
+ Label label2 = new Label(composite, SWT.LEFT);
label2.setText(AutotoolsPropertyMessages.getString("Autotools.automakePath")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label2.setLayoutData(gd);
-
+
/* text window for automake path */
fAutomakePath = new Text(composite, SWT.BORDER | SWT.SINGLE);
fAutomakePath.setToolTipText(AutotoolsPropertyMessages.getString("Autotools.automakePath.tooltip")); //$NON-NLS-1#
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
fAutomakePath.setLayoutData(gd);
-
+
Label label3 = new Label(composite, SWT.LEFT);
label3.setText(AutotoolsPropertyMessages.getString("Autotools.autoconfPath")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label3.setLayoutData(gd);
-
+
/* text window for autoconf path */
fAutoconfPath = new Text(composite, SWT.BORDER | SWT.SINGLE);
fAutoconfPath.setToolTipText(AutotoolsPropertyMessages.getString("Autotools.autoconfPath.tooltip")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
fAutoconfPath.setLayoutData(gd);
- Label label4= new Label(composite, SWT.LEFT);
+ Label label4 = new Label(composite, SWT.LEFT);
label4.setText(AutotoolsPropertyMessages.getString("Autotools.autoheaderPath")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label4.setLayoutData(gd);
-
+
/* text window for autoheader path */
fAutoheaderPath = new Text(composite, SWT.BORDER | SWT.SINGLE);
fAutoheaderPath.setToolTipText(AutotoolsPropertyMessages.getString("Autotools.autoheaderPath.tooltip")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
fAutoheaderPath.setLayoutData(gd);
- Label label5= new Label(composite, SWT.LEFT);
+ Label label5 = new Label(composite, SWT.LEFT);
label5.setText(AutotoolsPropertyMessages.getString("Autotools.autoreconfPath")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label5.setLayoutData(gd);
-
+
/* text window for autoreconf path */
fAutoreconfPath = new Text(composite, SWT.BORDER | SWT.SINGLE);
fAutoreconfPath.setToolTipText(AutotoolsPropertyMessages.getString("Autotools.autoreconfPath.tooltip")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
fAutoreconfPath.setLayoutData(gd);
- Label label6= new Label(composite, SWT.LEFT);
+ Label label6 = new Label(composite, SWT.LEFT);
label6.setText(AutotoolsPropertyMessages.getString("Autotools.libtoolizePath")); //$NON-NLS-1$
- gd= new GridData();
- gd.horizontalAlignment= GridData.BEGINNING;
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
label6.setLayoutData(gd);
-
+
/* text window for libtoolize path */
fLibtoolizePath = new Text(composite, SWT.BORDER | SWT.SINGLE);
fLibtoolizePath.setToolTipText(AutotoolsPropertyMessages.getString("Autotools.libtoolizePath.tooltip")); //$NON-NLS-1$
- gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ gd = new GridData(
+ GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
fLibtoolizePath.setLayoutData(gd);
initialize();
@@ -165,7 +171,7 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
// Not much we can do at this point
}
}
-
+
try {
automakePath = project.getPersistentProperty(AutotoolsPropertyConstants.AUTOMAKE_TOOL);
} catch (CoreException e1) {
@@ -180,7 +186,7 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
// Not much we can do at this point
}
}
-
+
try {
autoconfPath = project.getPersistentProperty(AutotoolsPropertyConstants.AUTOCONF_TOOL);
} catch (CoreException e1) {
@@ -225,7 +231,7 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
// Not much we can do at this point
}
}
-
+
try {
libtoolizePath = project.getPersistentProperty(AutotoolsPropertyConstants.LIBTOOLIZE_TOOL);
} catch (CoreException e1) {
@@ -241,12 +247,12 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
}
}
}
-
+
@Override
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
performOK();
}
-
+
@Override
public void performDefaults() {
// For default tool settings, simply default the base tool names
@@ -257,12 +263,12 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
fAutoreconfPath.setText(DEFAULT_AUTORECONF);
fLibtoolizePath.setText(DEFAULT_LIBTOOLIZE);
}
-
+
@Override
public void updateData(ICResourceDescription cfgd) {
// Nothing to do
}
-
+
@Override
public void updateButtons() {
// Nothing to do
@@ -275,38 +281,38 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
String autoheaderPath = null;
String autoreconfPath = null;
String libtoolizePath = null;
-
+
try {
aclocalPath = project.getPersistentProperty(AutotoolsPropertyConstants.ACLOCAL_TOOL);
} catch (CoreException e1) {
// do nothing
}
-
+
if (aclocalPath == null)
aclocalPath = DEFAULT_ACLOCAL;
-
+
fAclocalPath.setText(aclocalPath);
-
+
try {
automakePath = project.getPersistentProperty(AutotoolsPropertyConstants.AUTOMAKE_TOOL);
} catch (CoreException e1) {
// do nothing
}
-
+
if (automakePath == null)
automakePath = DEFAULT_AUTOMAKE;
-
+
fAutomakePath.setText(automakePath);
-
+
try {
autoconfPath = project.getPersistentProperty(AutotoolsPropertyConstants.AUTOCONF_TOOL);
} catch (CoreException e1) {
// do nothing
}
-
+
if (autoconfPath == null)
autoconfPath = DEFAULT_AUTOCONF;
-
+
fAutoconfPath.setText(autoconfPath);
try {
@@ -314,10 +320,10 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
} catch (CoreException e1) {
// do nothing
}
-
+
if (autoheaderPath == null)
autoheaderPath = DEFAULT_AUTOHEADER;
-
+
fAutoheaderPath.setText(autoheaderPath);
try {
@@ -325,10 +331,10 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
} catch (CoreException e1) {
// do nothing
}
-
+
if (autoreconfPath == null)
autoreconfPath = DEFAULT_AUTORECONF;
-
+
fAutoreconfPath.setText(autoreconfPath);
try {
@@ -336,11 +342,11 @@ public class AutotoolsToolsPropertyTab extends AbstractAutotoolsCPropertyTab {
} catch (CoreException e1) {
// do nothing
}
-
+
if (libtoolizePath == null)
libtoolizePath = DEFAULT_LIBTOOLIZE;
-
+
fLibtoolizePath.setText(libtoolizePath);
}
-
+
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IProjectPropertyListener.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IProjectPropertyListener.java
index c1cd3fb6840..d1ed4deee31 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IProjectPropertyListener.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IProjectPropertyListener.java
@@ -19,10 +19,10 @@ public interface IProjectPropertyListener {
/**
* Handler for property changes
- *
+ *
* @param project the project to which the property changed
* @param property the name of the property changed
*/
void handleProjectPropertyChanged(IProject project, String property);
-
+
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IPropertyChangeManager.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IPropertyChangeManager.java
index d63c30f6985..1f257e76e87 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IPropertyChangeManager.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/IPropertyChangeManager.java
@@ -19,25 +19,25 @@ public interface IPropertyChangeManager {
/**
* Add a project property listener for given project.
- *
+ *
* @param project the project to which the listener is interested
* @param listener the listener to notify
*/
void addProjectPropertyListener(IProject project, IProjectPropertyListener listener);
-
+
/**
* Remove a project property listener.
- *
+ *
* @param listener the listener to remove
*/
void removeProjectPropertyListener(IProject project, IProjectPropertyListener listener);
-
+
/**
* Notify all listeners of project that a property has changed.
- *
+ *
* @param project the project for which the property has changed
* @param property the property that has changed
*/
void notifyPropertyListeners(IProject project, String property);
-
+
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListContentProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListContentProvider.java
index bc3107b7a35..e127fafd03a 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListContentProvider.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListContentProvider.java
@@ -23,7 +23,7 @@ import org.eclipse.jface.viewers.Viewer;
public class ToolListContentProvider implements ITreeContentProvider {
private ToolListElement[] elements;
-
+
private ToolListElement[] createElements() {
ArrayList<ToolListElement> toolList = new ArrayList<>();
AutotoolsConfiguration.Option[] options = AutotoolsConfiguration.getTools();
@@ -32,8 +32,7 @@ public class ToolListContentProvider implements ITreeContentProvider {
String optName = opt.getName();
ToolListElement tool = new ToolListElement(optName, IConfigureOption.TOOL);
toolList.add(tool);
- AutotoolsConfiguration.Option[] categories =
- AutotoolsConfiguration.getChildOptions(optName);
+ AutotoolsConfiguration.Option[] categories = AutotoolsConfiguration.getChildOptions(optName);
for (int j = 0; j < categories.length; ++j) {
String catName = categories[j].getName();
ToolListElement newItem = new ToolListElement(catName, IConfigureOption.CATEGORY);
@@ -42,23 +41,23 @@ public class ToolListContentProvider implements ITreeContentProvider {
}
return toolList.toArray(new ToolListElement[toolList.size()]);
}
-
+
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof AutotoolsConfiguration) {
return elements.clone();
}
- return ((ToolListElement)parentElement).getChildren();
+ return ((ToolListElement) parentElement).getChildren();
}
@Override
public Object getParent(Object element) {
- return ((ToolListElement)element).getParent();
+ return ((ToolListElement) element).getParent();
}
@Override
public boolean hasChildren(Object element) {
- return ((ToolListElement)element).hasChildren();
+ return ((ToolListElement) element).hasChildren();
}
@Override
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListElement.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListElement.java
index e28d5968d31..f6ac847665f 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListElement.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListElement.java
@@ -17,43 +17,43 @@ import java.util.ArrayList;
import java.util.List;
public class ToolListElement {
-
+
private List<ToolListElement> children;
private ToolListElement parent;
private String name;
private int type;
-
+
public ToolListElement(String name, int type) {
this.name = name;
this.type = type;
this.children = new ArrayList<>();
}
-
+
public void setParent(ToolListElement p) {
parent = p;
}
-
+
public ToolListElement getParent() {
return parent;
}
-
+
public String getName() {
return name;
}
-
+
public int getType() {
return type;
}
-
+
public void addChild(ToolListElement e) {
children.add(e);
e.setParent(this);
}
-
+
public boolean hasChildren() {
return children.size() > 0;
}
-
+
public Object[] getChildren() {
return children.toArray();
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListLabelProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListLabelProvider.java
index 67f555fd4bd..2522184b653 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListLabelProvider.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/ToolListLabelProvider.java
@@ -22,42 +22,42 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
-
+
public class ToolListLabelProvider extends LabelProvider {
private final Image IMG_TOOL = AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_CFG_TOOL);
private final Image IMG_CAT = AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_CFG_CATEGORY);
- private static final String ERROR_UNKNOWN_ELEMENT = "ConfigurePropertyPage.error.Unknown_tree_element"; //$NON-NLS-1$
+ private static final String ERROR_UNKNOWN_ELEMENT = "ConfigurePropertyPage.error.Unknown_tree_element"; //$NON-NLS-1$
private ImageDescriptor descriptor = null;
private ResourceManager manager = null;
private IAConfiguration cfg = null;
-
+
public ToolListLabelProvider(IAConfiguration cfg) {
this.cfg = cfg;
}
-
+
public IAConfiguration getCfg() {
return cfg;
}
-
+
public void setCfg(IAConfiguration cfg) {
this.cfg = cfg;
}
-
+
@Override
public Image getImage(Object element) {
if (!(element instanceof ToolListElement)) {
throw unknownElement(element);
}
Image defaultImage = IMG_CAT;
- ToolListElement toolListElement = (ToolListElement)element;
+ ToolListElement toolListElement = (ToolListElement) element;
IConfigureOption cat = cfg.getOption(toolListElement.getName());
-
+
if (cat == null) {
defaultImage = IMG_TOOL;
}
-
- // Use default icon for display
+
+ // Use default icon for display
return defaultImage;
}
@@ -66,13 +66,12 @@ public class ToolListLabelProvider extends LabelProvider {
if (!(element instanceof ToolListElement)) {
throw unknownElement(element);
}
- ToolListElement toolListElement = (ToolListElement)element;
+ ToolListElement toolListElement = (ToolListElement) element;
IConfigureOption cat = cfg.getOption(toolListElement.getName());
-
+
if (cat == null) {
return toolListElement.getName();
- }
- else {
+ } else {
return cat.getDescription();
}
}
@@ -81,15 +80,15 @@ public class ToolListLabelProvider extends LabelProvider {
return new RuntimeException(UIMessages.getFormattedString(ERROR_UNKNOWN_ELEMENT, element.getClass().getName()));
}
- /**
- * Disposing any images that were allocated for it.
- *
- * @since 3.0
- */
- @Override
+ /**
+ * Disposing any images that were allocated for it.
+ *
+ * @since 3.0
+ */
+ @Override
public void dispose() {
- if (descriptor != null && manager != null) {
- manager.destroyImage(descriptor);
- }
- };
+ if (descriptor != null && manager != null) {
+ manager.destroyImage(descriptor);
+ }
+ };
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfPrototype.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfPrototype.java
index a287239e714..6a11736264d 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfPrototype.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfPrototype.java
@@ -22,46 +22,46 @@ public class AutoconfPrototype {
protected List<Integer> minParms;
protected List<Integer> maxParms;
protected List<List<String>> parmList;
-
+
public AutoconfPrototype() {
numPrototypes = 0;
minParms = new ArrayList<>();
maxParms = new ArrayList<>();
parmList = new ArrayList<>();
}
-
+
public String getName() {
return name;
}
-
+
public void setName(String newName) {
name = newName;
}
-
+
public int getNumPrototypes() {
return numPrototypes;
}
-
+
public void setNumPrototypes(int num) {
numPrototypes = num;
}
-
+
public int getMinParms(int prototypeNum) {
return minParms.get(prototypeNum).intValue();
}
-
+
public void setMinParms(int prototypeNum, int value) {
minParms.add(prototypeNum, Integer.valueOf(value));
}
-
+
public int getMaxParms(int prototypeNum) {
return maxParms.get(prototypeNum).intValue();
}
-
+
public void setMaxParms(int prototypeNum, int value) {
maxParms.add(prototypeNum, Integer.valueOf(value));
}
-
+
public String getParmName(int prototypeNum, int parmNum) {
List<String> parms = parmList.get(prototypeNum);
return parms.get(parmNum);
@@ -74,13 +74,12 @@ public class AutoconfPrototype {
if (parmList.size() == prototypeNum) {
parms = new ArrayList<>();
parmList.add(parms);
- }
- else
+ } else
parms = parmList.get(prototypeNum);
if (parms.size() == parmNum)
- parms.add(value);
+ parms.add(value);
else
parms.set(parmNum, value);
}
-
+
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java
index 6bfd9673450..341c267d8e3 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java
@@ -71,7 +71,6 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
-
public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
public static final String LOCAL_AUTOCONF_MACROS_DOC_NAME = "macros/acmacros";
@@ -81,16 +80,20 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
private static class AutotoolsHoverDoc {
public Document[] documents = new Document[2];
+
public AutotoolsHoverDoc(Document acDocument, Document amDocument) {
this.documents[0] = acDocument;
this.documents[1] = amDocument;
}
+
public Document getAcDocument() {
return documents[0];
}
+
public Document getAmDocument() {
return documents[1];
}
+
public Document[] getDocuments() {
return documents;
}
@@ -106,37 +109,35 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
private static IBindingService fBindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class);
public static String getAutoconfMacrosDocName(String version) {
- return AUTOCONF_MACROS_DOC_NAME + "-" //$NON-NLS-1$
- + version
- + ".xml"; //$NON-NLS-1$
+ return AUTOCONF_MACROS_DOC_NAME + "-" //$NON-NLS-1$
+ + version + ".xml"; //$NON-NLS-1$
}
public static String getLocalAutoconfMacrosDocName(String version) {
- return LOCAL_AUTOCONF_MACROS_DOC_NAME + "-" //$NON-NLS-1$
- + version
- + ".xml"; //$NON-NLS-1$
+ return LOCAL_AUTOCONF_MACROS_DOC_NAME + "-" //$NON-NLS-1$
+ + version + ".xml"; //$NON-NLS-1$
}
/* Get the preferences default for the autoconf macros document name. */
public static String getDefaultAutoconfMacrosVer() {
- return AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION);
+ return AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getString(AutotoolsEditorPreferenceConstants.AUTOCONF_VERSION);
}
public static String getAutomakeMacrosDocName(String version) {
- return AUTOMAKE_MACROS_DOC_NAME + "-" //$NON-NLS-1$
- + version
- + ".xml"; //$NON-NLS-1$
+ return AUTOMAKE_MACROS_DOC_NAME + "-" //$NON-NLS-1$
+ + version + ".xml"; //$NON-NLS-1$
}
-
+
public static String getLocalAutomakeMacrosDocName(String version) {
- return LOCAL_AUTOMAKE_MACROS_DOC_NAME + "-" //$NON-NLS-1$
- + version
- + ".xml"; //$NON-NLS-1$
+ return LOCAL_AUTOMAKE_MACROS_DOC_NAME + "-" //$NON-NLS-1$
+ + version + ".xml"; //$NON-NLS-1$
}
-
+
/* Get the preferences default for the autoconf macros document name. */
public static String getDefaultAutomakeMacrosVer() {
- return AutotoolsPlugin.getDefault().getPreferenceStore().getString(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION);
+ return AutotoolsPlugin.getDefault().getPreferenceStore()
+ .getString(AutotoolsEditorPreferenceConstants.AUTOMAKE_VERSION);
}
protected static Document getACDoc(String acDocVer) {
@@ -178,18 +179,17 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
if (docStream != null)
docStream.close();
}
- } catch (FileNotFoundException|MalformedURLException|URISyntaxException e) {
+ } catch (FileNotFoundException | MalformedURLException | URISyntaxException e) {
AutotoolsPlugin.log(e);
}
acDocument = doc;
- }
- catch (IOException ioe) {
+ } catch (IOException ioe) {
}
}
acHoverDocs.put(acDocVer, acDocument);
return acDocument;
}
-
+
protected static Document getAMDoc(String amDocVer) {
Document amDocument = null;
if (amHoverDocs == null) {
@@ -229,12 +229,11 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
if (docStream != null)
docStream.close();
}
- } catch (FileNotFoundException|MalformedURLException|URISyntaxException e) {
+ } catch (FileNotFoundException | MalformedURLException | URISyntaxException e) {
AutotoolsPlugin.log(e);
}
amDocument = doc;
- }
- catch (IOException ioe) {
+ } catch (IOException ioe) {
}
}
amHoverDocs.put(amDocVer, amDocument);
@@ -245,7 +244,7 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
String acDocVer = getDefaultAutoconfMacrosVer();
String amDocVer = getDefaultAutomakeMacrosVer();
if (input instanceof IFileEditorInput) {
- IFileEditorInput fe = (IFileEditorInput)input;
+ IFileEditorInput fe = (IFileEditorInput) input;
IFile f = fe.getFile();
IProject p = f.getProject();
try {
@@ -328,7 +327,7 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
}
buffer.append(prototype).append("</I>)<br>"); //$NON-NLS-1$
}
- if (nodeName.equals("synopsis")) { //$NON-NLS-1$
+ if (nodeName.equals("synopsis")) { //$NON-NLS-1$
Node textNode = n.getLastChild();
buffer.append("<br><B>Synopsis:</B> ");
buffer.append(textNode.getNodeValue());
@@ -344,13 +343,13 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
return null;
}
-
+
public static AutoconfMacro[] getMacroList(AutoconfEditor editor) {
IEditorInput input = editor.getEditorInput();
AutotoolsHoverDoc hoverdoc = getHoverDoc(input);
return getMacroList(hoverdoc);
}
-
+
private static AutoconfMacro[] getMacroList(AutotoolsHoverDoc hoverdoc) {
if (acHoverMacros == null) {
acHoverMacros = new HashMap<>();
@@ -433,7 +432,7 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
++prototypeCount;
int parmCount = 0;
int minParmCount = -1;
- p.setNumPrototypes(prototypeCount + 1);
+ p.setNumPrototypes(prototypeCount + 1);
NodeList varList = n.getChildNodes();
for (int j = 0; j < varList.getLength(); ++j) {
Node v = varList.item(j);
@@ -445,9 +444,8 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
String parm = parmNode.getNodeValue();
// Check for first optional parameter which means
// we know the minimum number of parameters needed.
- if (minParmCount < 0 && (parm.charAt(0) == '[' ||
- parm.startsWith("...")))
- minParmCount = parmCount - 1;
+ if (minParmCount < 0 && (parm.charAt(0) == '[' || parm.startsWith("...")))
+ minParmCount = parmCount - 1;
// Old style documentation sometimes had '[' in
// prototypes so look for one at end of a parm too.
else if (minParmCount < 0 && parm.endsWith("["))
@@ -493,8 +491,7 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
* region for the whole selection.
*/
Point selectedRange = textViewer.getSelectedRange();
- if (selectedRange.x >= 0 && selectedRange.y > 0
- && offset >= selectedRange.x
+ if (selectedRange.x >= 0 && selectedRange.y > 0 && offset >= selectedRange.x
&& offset <= selectedRange.x + selectedRange.y)
return new Region(selectedRange.x, selectedRange.y);
else {
@@ -526,7 +523,8 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
if (fBindingService == null)
return null;
- String keySequence= fBindingService.getBestActiveBindingFormattedFor(IAutotoolEditorActionDefinitionIds.SHOW_TOOLTIP);
+ String keySequence = fBindingService
+ .getBestActiveBindingFormattedFor(IAutotoolEditorActionDefinitionIds.SHOW_TOOLTIP);
if (keySequence == null)
return null;
@@ -540,24 +538,25 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
*/
protected static String getStyleSheet() {
if (fgStyleSheet == null) {
- Bundle bundle= Platform.getBundle(AutotoolsUIPlugin.PLUGIN_ID);
- URL styleSheetURL= bundle.getEntry("/AutoconfHoverStyleSheet.css"); //$NON-NLS-1$
+ Bundle bundle = Platform.getBundle(AutotoolsUIPlugin.PLUGIN_ID);
+ URL styleSheetURL = bundle.getEntry("/AutoconfHoverStyleSheet.css"); //$NON-NLS-1$
if (styleSheetURL != null) {
try {
- styleSheetURL= FileLocator.toFileURL(styleSheetURL);
- try (BufferedReader reader= new BufferedReader(new InputStreamReader(styleSheetURL.openStream()))) {
- StringBuilder buffer= new StringBuilder(200);
- String line= reader.readLine();
+ styleSheetURL = FileLocator.toFileURL(styleSheetURL);
+ try (BufferedReader reader = new BufferedReader(
+ new InputStreamReader(styleSheetURL.openStream()))) {
+ StringBuilder buffer = new StringBuilder(200);
+ String line = reader.readLine();
while (line != null) {
buffer.append(line);
buffer.append('\n');
- line= reader.readLine();
+ line = reader.readLine();
}
- fgStyleSheet= buffer.toString();
+ fgStyleSheet = buffer.toString();
}
} catch (IOException ex) {
AutotoolsUIPlugin.log(ex);
- fgStyleSheet= ""; //$NON-NLS-1$
+ fgStyleSheet = ""; //$NON-NLS-1$
}
}
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/HoverMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/HoverMessages.java
index 8445c6af763..8584353318f 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/HoverMessages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/HoverMessages.java
@@ -18,15 +18,14 @@ import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-
/**
* AutoconfEditorMessages
*/
public class HoverMessages {
- private static final String RESOURCE_BUNDLE= HoverMessages.class.getName();
+ private static final String RESOURCE_BUNDLE = HoverMessages.class.getName();
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+ private static ResourceBundle fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
private HoverMessages() {
}
@@ -38,53 +37,55 @@ public class HoverMessages {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
}
+
/**
* Gets a string from the resource bundle and formats it with the argument
- *
+ *
* @param key the string used to get the bundle value, must not be null
* @since 3.0
*/
public static String getFormattedString(String key, Object arg) {
- String format= null;
+ String format = null;
try {
- format= fgResourceBundle.getString(key);
+ format = fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
if (arg == null)
- arg= ""; //$NON-NLS-1$
+ arg = ""; //$NON-NLS-1$
return MessageFormat.format(format, new Object[] { arg });
}
+
/**
* Gets a string from the resource bundle and formats it with the arguments
- *
+ *
* @param key the string used to get the bundle value, must not be null
* @since 3.0
*/
public static String getFormattedString(String key, Object arg1, Object arg2) {
- String format= null;
+ String format = null;
try {
- format= fgResourceBundle.getString(key);
+ format = fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
if (arg1 == null)
- arg1= ""; //$NON-NLS-1$
+ arg1 = ""; //$NON-NLS-1$
if (arg2 == null)
- arg2= ""; //$NON-NLS-1$
+ arg2 = ""; //$NON-NLS-1$
return MessageFormat.format(format, new Object[] { arg1, arg2 });
}
-
+
/**
* Gets a string from the resource bundle and formats it with the argument
- *
+ *
* @param key the string used to get the bundle value, must not be null
* @since 3.0
*/
public static String getFormattedString(String key, boolean arg) {
- String format= null;
+ String format = null;
try {
- format= fgResourceBundle.getString(key);
+ format = fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java
index b5e4717ffc1..58638db8c46 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizard.java
@@ -37,15 +37,15 @@ import org.eclipse.jface.wizard.IWizard;
public class AutotoolsBuildWizard extends AbstractCWizard {
public static final String OTHERS_LABEL = AutotoolsWizardMessages.getResourceString("AutotoolsBuildWizard.1"); //$NON-NLS-1$
public static final String AUTOTOOLS_PROJECTTYPE_ID = "org.eclipse.linuxtools.cdt.autotools.core.projectType"; //$NON-NLS-1$
-
+
/**
* @since 5.1
*/
public static final String EMPTY_PROJECT = AutotoolsWizardMessages.getResourceString("AutotoolsBuildWizard.2"); //$NON-NLS-1$
public static final String AUTOTOOLS_TOOLCHAIN_ID = "org.eclipse.linuxtools.cdt.autotools.core.toolChain"; //$NON-NLS-1$
-
+
/**
- * Creates and returns an array of items to be displayed
+ * Creates and returns an array of items to be displayed
*/
@Override
public EntryDescriptor[] createItems(boolean supportedOnly, IWizard wizard) {
@@ -63,7 +63,7 @@ public class AutotoolsBuildWizard extends AbstractCWizard {
IProjectType pt = e.getValue();
AutotoolsBuildWizardHandler h = new AutotoolsBuildWizardHandler(pt, parent, wizard);
IToolChain[] tcs = ManagedBuildManager.getExtensionToolChains(pt);
- for(int i = 0; i < tcs.length; i++){
+ for (int i = 0; i < tcs.length; i++) {
IToolChain t = tcs[i];
IToolChain parent = t;
@@ -74,7 +74,7 @@ public class AutotoolsBuildWizard extends AbstractCWizard {
if (!parent.getId().equals(AUTOTOOLS_TOOLCHAIN_ID))
continue;
- if(t.isSystemObject())
+ if (t.isSystemObject())
continue;
if (!isValid(t, supportedOnly, wizard))
continue;
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizardHandler.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizardHandler.java
index 6da0a63ba22..3f6d1e03433 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizardHandler.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsBuildWizardHandler.java
@@ -49,7 +49,8 @@ public class AutotoolsBuildWizardHandler extends MBSWizardHandler {
}
@Override
- public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
+ public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor)
+ throws CoreException {
super.createProject(project, defaults, onFinish, monitor);
// Fix for bug #312298
// Following is required to get around the fact that the Scanner Discovery BuildInfo isn't
@@ -91,9 +92,9 @@ public class AutotoolsBuildWizardHandler extends MBSWizardHandler {
@Override
public void convertProject(IProject proj, IProgressMonitor monitor) throws CoreException {
- super.convertProject(proj, monitor);
+ super.convertProject(proj, monitor);
AutotoolsNewProjectNature.addAutotoolsNature(proj, monitor);
-
+
// For each IConfiguration, create a corresponding Autotools Configuration
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(proj);
IConfiguration[] cfgs = info.getManagedProject().getConfigurations();
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizard.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizard.java
index 077b37148a3..69b7c15ebb5 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizard.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizard.java
@@ -69,18 +69,15 @@ public class AutotoolsProjectImportWizard extends NewMakeProjFromExisting {
// Add the configuration selection page
projectConfigurationPage = new CProjectPlatformPage(PREFIX);
- projectConfigurationPage.setTitle(AutotoolsUIPlugin
- .getResourceString(CONF_TITLE));
- projectConfigurationPage.setDescription(AutotoolsUIPlugin
- .getResourceString(CONF_DESC));
+ projectConfigurationPage.setTitle(AutotoolsUIPlugin.getResourceString(CONF_TITLE));
+ projectConfigurationPage.setDescription(AutotoolsUIPlugin.getResourceString(CONF_DESC));
addPage(projectConfigurationPage);
// add custom pages
MBSCustomPageManager.init();
// add stock pages
- MBSCustomPageManager.addStockPage(projectConfigurationPage,
- CProjectPlatformPage.PAGE_ID);
+ MBSCustomPageManager.addStockPage(projectConfigurationPage, CProjectPlatformPage.PAGE_ID);
}
@@ -107,21 +104,16 @@ public class AutotoolsProjectImportWizard extends NewMakeProjFromExisting {
// Create Project
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(
- projectName);
+ IProject project = workspace.getRoot().getProject(projectName);
- IProjectDescription description = workspace
- .newProjectDescription(projectName);
- IPath defaultLocation = workspace.getRoot().getLocation()
- .append(projectName);
+ IProjectDescription description = workspace.newProjectDescription(projectName);
+ IPath defaultLocation = workspace.getRoot().getLocation().append(projectName);
Path location = new Path(locationStr);
- if (!location.isEmpty()
- && !location.equals(defaultLocation)) {
+ if (!location.isEmpty() && !location.equals(defaultLocation)) {
description.setLocation(location);
}
- CCorePlugin.getDefault().createCDTProject(description,
- project, monitor);
+ CCorePlugin.getDefault().createCDTProject(description, project, monitor);
// C++ natures
if (isCPP) {
@@ -129,34 +121,27 @@ public class AutotoolsProjectImportWizard extends NewMakeProjFromExisting {
}
// Set up build information
- ICProjectDescriptionManager pdMgr = CoreModel.getDefault()
- .getProjectDescriptionManager();
- ICProjectDescription projDesc = pdMgr
- .createProjectDescription(project, false);
- ManagedBuildInfo info = ManagedBuildManager
- .createBuildInfo(project);
+ ICProjectDescriptionManager pdMgr = CoreModel.getDefault().getProjectDescriptionManager();
+ ICProjectDescription projDesc = pdMgr.createProjectDescription(project, false);
+ ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
ManagedProject mProj = new ManagedProject(projDesc);
info.setManagedProject(mProj);
monitor.worked(1);
CfgHolder cfgHolder = new CfgHolder(toolChain, null);
String s = toolChain == null ? "0" : ((ToolChain) toolChain).getId(); //$NON-NLS-1$
- Configuration config = new Configuration(mProj,
- (ToolChain) toolChain,
- ManagedBuildManager.calculateChildId(s, null),
- cfgHolder.getName());
+ Configuration config = new Configuration(mProj, (ToolChain) toolChain,
+ ManagedBuildManager.calculateChildId(s, null), cfgHolder.getName());
IBuilder builder = config.getEditableBuilder();
builder.setManagedBuildOn(false);
CConfigurationData data = config.getConfigurationData();
- projDesc.createConfiguration(
- ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
+ projDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
monitor.worked(1);
pdMgr.setProjectDescription(project, projDesc);
// Convert the created project to an Autotools project
- page.convertProject(
- project, monitor, projectName);
+ page.convertProject(project, monitor, projectName);
} catch (Throwable e) {
}
monitor.done();
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizardPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizardPage.java
index fceee12f408..501032e3603 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizardPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsProjectImportWizardPage.java
@@ -45,16 +45,13 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
@SuppressWarnings("restriction")
-public class AutotoolsProjectImportWizardPage extends
- NewMakeProjFromExistingPage {
+public class AutotoolsProjectImportWizardPage extends NewMakeProjFromExistingPage {
private Button langc;
private Button langcpp;
protected AutotoolsProjectImportWizardPage() {
- setTitle(AutotoolsWizardMessages
- .getResourceString("ImportWizardPage.title"));
- setDescription(AutotoolsWizardMessages
- .getResourceString("ImportWizardPage.description"));
+ setTitle(AutotoolsWizardMessages.getResourceString("ImportWizardPage.title"));
+ setDescription(AutotoolsWizardMessages.getResourceString("ImportWizardPage.description"));
}
protected IProjectType getProjectType() {
@@ -62,8 +59,7 @@ public class AutotoolsProjectImportWizardPage extends
}
protected IConfiguration[] getSelectedConfigurations() {
- return ((AutotoolsProjectImportWizard) getWizard())
- .getSelectedConfigurations();
+ return ((AutotoolsProjectImportWizard) getWizard()).getSelectedConfigurations();
}
@Override
@@ -95,13 +91,11 @@ public class AutotoolsProjectImportWizardPage extends
}
};
- langc = ControlFactory.createRadioButton(group,
- CUIMessages.ConvertProjectWizardPage_CProject, "C ", //$NON-NLS-1$
+ langc = ControlFactory.createRadioButton(group, CUIMessages.ConvertProjectWizardPage_CProject, "C ", //$NON-NLS-1$
cListener);
langc.setSelection(true);
- langcpp = ControlFactory.createRadioButton(group,
- CUIMessages.ConvertProjectWizardPage_CppProject, "C++ ", //$NON-NLS-1$
+ langcpp = ControlFactory.createRadioButton(group, CUIMessages.ConvertProjectWizardPage_CppProject, "C++ ", //$NON-NLS-1$
cListener);
langcpp.setSelection(false);
}
@@ -111,49 +105,39 @@ public class AutotoolsProjectImportWizardPage extends
return getSelectedConfigurations()[0].getToolChain();
}
- public void convertProject(IProject project, IProgressMonitor monitor,
- String projectID) throws CoreException {
+ public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException {
monitor.beginTask(
- AutotoolsUIPlugin
- .getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 7); //$NON-NLS-1$
+ AutotoolsUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 7); //$NON-NLS-1$
IConfiguration defaultCfg = null;
try {
- monitor.subTask(AutotoolsUIPlugin
- .getResourceString("adding project nature"));
+ monitor.subTask(AutotoolsUIPlugin.getResourceString("adding project nature"));
ManagedCProjectNature.addManagedNature(project, SubMonitor.convert(monitor, 1));
AutotoolsNewProjectNature.addAutotoolsNature(project, SubMonitor.convert(monitor, 1));
- monitor.subTask(AutotoolsUIPlugin
- .getResourceString("adding builder"));
+ monitor.subTask(AutotoolsUIPlugin.getResourceString("adding builder"));
AutotoolsNewProjectNature.addAutotoolsBuilder(project, SubMonitor.convert(monitor, 1));
- project.setPersistentProperty(
- AutotoolsPropertyConstants.SCANNER_USE_MAKE_W,
+ project.setPersistentProperty(AutotoolsPropertyConstants.SCANNER_USE_MAKE_W,
AutotoolsPropertyConstants.TRUE);
// Specify false for override in next call as override can cause the
// method to throw an
// exception.
- CCorePlugin.getDefault()
- .mapCProjectOwner(project, projectID, false);
+ CCorePlugin.getDefault().mapCProjectOwner(project, projectID, false);
// Add the ManagedProject to the project
IManagedProject newManagedProject = null;
IManagedBuildInfo info = null;
try {
info = ManagedBuildManager.createBuildInfo(project);
- newManagedProject = ManagedBuildManager.createManagedProject(
- project, getProjectType());
+ newManagedProject = ManagedBuildManager.createManagedProject(project, getProjectType());
if (newManagedProject != null) {
for (int i = 0; i < getSelectedConfigurations().length; i++) {
IConfiguration config = getSelectedConfigurations()[i];
int id = ManagedBuildManager.getRandomNumber();
- IConfiguration newConfig = newManagedProject
- .createConfiguration(config, config.getId()
- + "." + id); //$NON-NLS-1$
- newConfig.setArtifactName(newManagedProject
- .getDefaultArtifactName());
+ IConfiguration newConfig = newManagedProject.createConfiguration(config,
+ config.getId() + "." + id); //$NON-NLS-1$
+ newConfig.setArtifactName(newManagedProject.getDefaultArtifactName());
}
// Now add the first supported config in the list as the
// default
- IConfiguration[] newConfigs = newManagedProject
- .getConfigurations();
+ IConfiguration[] newConfigs = newManagedProject.getConfigurations();
for (int i = 0; i < newConfigs.length; i++) {
if (newConfigs[i].isSupported()) {
defaultCfg = newConfigs[i];
@@ -165,10 +149,8 @@ public class AutotoolsProjectImportWizardPage extends
defaultCfg = newConfigs[0];
if (defaultCfg != null) {
- ManagedBuildManager.setDefaultConfiguration(project,
- defaultCfg);
- ManagedBuildManager.setSelectedConfiguration(project,
- defaultCfg);
+ ManagedBuildManager.setDefaultConfiguration(project, defaultCfg);
+ ManagedBuildManager.setSelectedConfiguration(project, defaultCfg);
}
ManagedBuildManager.setNewProjectVersion(project);
AutotoolsNewMakeGenerator m = new AutotoolsNewMakeGenerator();
@@ -185,8 +167,7 @@ public class AutotoolsProjectImportWizardPage extends
}
// Save the build options
- monitor.subTask(AutotoolsUIPlugin
- .getResourceString("saving project"));
+ monitor.subTask(AutotoolsUIPlugin.getResourceString("saving project"));
if (info != null) {
info.setValid(true);
ManagedBuildManager.saveBuildInfo(project, true);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsWizardMessages.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsWizardMessages.java
index 8b8aa297a82..5bed53071ff 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsWizardMessages.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/AutotoolsWizardMessages.java
@@ -10,7 +10,7 @@
*
* Contributors:
* IBM - Initial API and implementation
- * Red Hat - Copy from org.eclipse.cdt.wizards to here plus rename
+ * Red Hat - Copy from org.eclipse.cdt.wizards to here plus rename
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.wizards;
@@ -40,7 +40,7 @@ public class AutotoolsWizardMessages {
}
public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getResourceString(key), (Object[])args);
+ return MessageFormat.format(getResourceString(key), (Object[]) args);
}
public static String getResourceString(String key) {
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/CProjectPlatformPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/CProjectPlatformPage.java
index a4fd899c055..62276658b5e 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/CProjectPlatformPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/CProjectPlatformPage.java
@@ -43,11 +43,10 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
-
/**
- * Class that implements the project type and configuration selection page in the new
+ * Class that implements the project type and configuration selection page in the new
* project wizard for managed builder projects.
- *
+ *
* @since 1.2
*/
public class CProjectPlatformPage extends WizardPage {
@@ -61,13 +60,13 @@ public class CProjectPlatformPage extends WizardPage {
private static final String TARGET_LABEL = LABEL + ".platform"; //$NON-NLS-1$
private static final String TARGET_TIP = TIP + ".platform"; //$NON-NLS-1$
private static final String FORCEDCONFIG_TIP = TIP + ".forcedconfigs"; //$NON-NLS-1$
-
+
// support for exporting data to custom wizard pages
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.platformPage"; //$NON-NLS-1$
public static final String PROJECT_TYPE = "projectType"; //$NON-NLS-1$
public static final String TOOLCHAIN = "toolchain"; //$NON-NLS-1$
public static final String NATURE = "nature"; //$NON-NLS-1$
-
+
protected Text platformSelection;
private List<Object> selectedConfigurations;
protected IProjectType projectType;
@@ -84,7 +83,8 @@ public class CProjectPlatformPage extends WizardPage {
public CProjectPlatformPage(String pageName) {
super(pageName);
setPageComplete(false);
- projectType = ManagedBuildManager.getExtensionProjectType("org.eclipse.linuxtools.cdt.autotools.core.projectType"); //$NON-NLS-1$
+ projectType = ManagedBuildManager
+ .getExtensionProjectType("org.eclipse.linuxtools.cdt.autotools.core.projectType"); //$NON-NLS-1$
selectedConfigurations = new ArrayList<>(0);
showAllConfigsForced = false;
}
@@ -94,7 +94,7 @@ public class CProjectPlatformPage extends WizardPage {
return validatePage() && getNextPage() != null;
}
- private void createConfigSelectionGroup (Composite parent) {
+ private void createConfigSelectionGroup(Composite parent) {
// Create the group composite
Composite composite = new Composite(parent, SWT.NULL);
composite.setFont(parent.getFont());
@@ -106,8 +106,8 @@ public class CProjectPlatformPage extends WizardPage {
configLabel.setFont(composite.getFont());
configLabel.setText(AutotoolsWizardMessages.getResourceString(CONFIG_LABEL));
- Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.MULTI
- | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
+ Table table = new Table(composite,
+ SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
table.setLayoutData(new GridData(GridData.FILL_BOTH));
table.setHeaderVisible(true);
table.setLinesVisible(false);
@@ -124,7 +124,7 @@ public class CProjectPlatformPage extends WizardPage {
tableViewer.addSelectionChangedListener(e -> handleConfigurationSelectionChange());
}
-
+
/**
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@@ -149,14 +149,13 @@ public class CProjectPlatformPage extends WizardPage {
// Select configuration
populateConfigurations();
setPageComplete(validatePage());
-
+
// Do the nasty
setErrorMessage(null);
setMessage(null);
setControl(composite);
}
-
private void createTypeSelectGroup(Composite parent) {
// Create the group composite
Composite composite = new Composite(parent, SWT.NULL);
@@ -170,12 +169,12 @@ public class CProjectPlatformPage extends WizardPage {
platformLabel.setText(AutotoolsWizardMessages.getResourceString(TARGET_LABEL));
platformSelection = new Text(composite, SWT.READ_ONLY);
-// platformSelection = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
+ // platformSelection = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
platformSelection.setFont(composite.getFont());
platformSelection.setToolTipText(AutotoolsWizardMessages.getResourceString(TARGET_TIP));
platformSelection.setText("GNU Autotools"); //$NON-NLS-1$
platformSelection.addDisposeListener(e -> platformSelection = null);
-
+
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
// Make this the same as NewCProjectWizardPage.SIZING_TEXT_FIELD_WIDTH
gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH + 50;
@@ -183,9 +182,9 @@ public class CProjectPlatformPage extends WizardPage {
}
public IProject getProject() {
- return ((NewCProjectWizard)getWizard()).getNewProject();
+ return ((NewCProjectWizard) getWizard()).getNewProject();
}
-
+
/**
* @return
*/
@@ -195,7 +194,7 @@ public class CProjectPlatformPage extends WizardPage {
/**
* Returns the selected project type.
- *
+ *
* @return IProjectType Selected type or <code>null</code> if an invalid selection
* has been made.
*/
@@ -207,52 +206,51 @@ public class CProjectPlatformPage extends WizardPage {
// Get the selections from the table viewer
selectedConfigurations.clear();
selectedConfigurations.addAll(Arrays.asList(tableViewer.getCheckedElements()));
-
+
// support for publishing the toolchains for the selected configs so that custom wizard
// pages will know which toolchains have been selected
-
+
// get the toolchains from the selected configs and put them into a set
Set<IToolChain> toolchainSet = new LinkedHashSet<>();
- for(int k = 0; k < selectedConfigurations.size(); k++)
- {
+ for (int k = 0; k < selectedConfigurations.size(); k++) {
IConfiguration config = (IConfiguration) selectedConfigurations.get(k);
IToolChain toolchain = config.getToolChain();
toolchainSet.add(toolchain);
}
-
+
// publish the set of selected toolchains with the custom page manager
MBSCustomPageManager.addPageProperty(PAGE_ID, TOOLCHAIN, toolchainSet);
-
+
// TODO: Don't know where this goes and how to find true nature
- MBSCustomPageManager.addPageProperty(CProjectPlatformPage.PAGE_ID, CProjectPlatformPage.NATURE, CProjectNature.C_NATURE_ID);
-
+ MBSCustomPageManager.addPageProperty(CProjectPlatformPage.PAGE_ID, CProjectPlatformPage.NATURE,
+ CProjectNature.C_NATURE_ID);
+
setPageComplete(validatePage());
}
/**
* Populate the table viewer with either all known configurations
* or only with the supported configurations depending on whether a user
- * has chosen to display unsupported configurations or not
+ * has chosen to display unsupported configurations or not
* By default, only supported configurations are selected.
*/
private void populateConfigurations() {
if (projectType == null)
return;
IConfiguration selected[] = null;
-
+
configurations = filterSupportedConfigurations(projectType.getConfigurations());
selected = configurations;
-
+
// Check for buildable configs on this platform
if (selected.length == 0) {
// Indicate that there are no buildable configurations on this platform for this project
// type and that all configurations will be selected
setMessage(AutotoolsWizardMessages.getResourceString(FORCEDCONFIG_TIP), WARNING);
- }
- else {
+ } else {
setMessage(null, NONE);
}
-
+
tableViewer.setInput(configurations);
tableViewer.setCheckedElements(selected);
handleConfigurationSelectionChange();
@@ -262,29 +260,28 @@ public class CProjectPlatformPage extends WizardPage {
* Returns the array of supported configurations found in the configurations
* passed to this method
*/
- IConfiguration[] filterSupportedConfigurations(IConfiguration cfgs[]){
+ IConfiguration[] filterSupportedConfigurations(IConfiguration cfgs[]) {
ArrayList<IConfiguration> supported = new ArrayList<>();
String os = Platform.getOS();
String arch = Platform.getOSArch();
for (int i = 0; i < cfgs.length; i++) {
// First, filter on supported state
- if (cfgs[i].isSupported()) {
+ if (cfgs[i].isSupported()) {
// Now, apply the OS and ARCH filters to determine if the configuration should be shown
// Determine if the configuration's tool-chain supports this OS & Architecture.
IToolChain tc = cfgs[i].getToolChain();
List<String> osList = Arrays.asList(tc.getOSList());
- if (osList.contains("all") || osList.contains(os)) { //$NON-NLS-1$
+ if (osList.contains("all") || osList.contains(os)) { //$NON-NLS-1$
List<String> archList = Arrays.asList(tc.getArchList());
if (archList.contains("all") || archList.contains(arch)) { //$NON-NLS-1$
- supported.add(cfgs[i]);
+ supported.add(cfgs[i]);
}
- }
+ }
}
}
return supported.toArray(new IConfiguration[supported.size()]);
}
-
/**
* @return
@@ -295,7 +292,7 @@ public class CProjectPlatformPage extends WizardPage {
setErrorMessage(null);
return true;
} else {
- setErrorMessage(AutotoolsWizardMessages.getResourceString("PlatformBlock.message.error.noconfigs")); //$NON-NLS-1$
+ setErrorMessage(AutotoolsWizardMessages.getResourceString("PlatformBlock.message.error.noconfigs")); //$NON-NLS-1$
return false;
}
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationContentProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationContentProvider.java
index f635e2adf3a..fba8a59116b 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationContentProvider.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationContentProvider.java
@@ -22,7 +22,7 @@ public class ConfigurationContentProvider implements IStructuredContentProvider
@Override
public Object[] getElements(Object parent) {
// The content is an array of configurations
- Object array[] = (Object[])parent;
+ Object array[] = (Object[]) parent;
return (array == null || array.length == 0) ? new Object[0] : array;
}
@@ -31,9 +31,6 @@ public class ConfigurationContentProvider implements IStructuredContentProvider
}
@Override
- public void inputChanged(
- Viewer viewer,
- Object oldInput,
- Object newInput) {
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java
index 62f24ea1abd..172691d0fc2 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java
@@ -14,28 +14,25 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.wizards;
-
import org.eclipse.cdt.internal.autotools.ui.AutotoolsUIPluginImages;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
+public class ConfigurationLabelProvider extends LabelProvider implements ITableLabelProvider {
+ private final Image IMG_CFG = AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_BUILD_CONFIG);
-public class ConfigurationLabelProvider extends LabelProvider implements ITableLabelProvider {
- private final Image IMG_CFG =
- AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_BUILD_CONFIG);
-
- //
+ //
@Override
public String getColumnText(Object obj, int index) {
if (obj instanceof IConfiguration) {
IConfiguration tmpConfig = (IConfiguration) obj;
-
- if( (tmpConfig.getDescription() == null)|| (tmpConfig.getDescription().isEmpty()) )
+
+ if ((tmpConfig.getDescription() == null) || (tmpConfig.getDescription().isEmpty()))
return ((IConfiguration) obj).getName();
else
- return ( tmpConfig.getName() + " ( " + tmpConfig.getDescription() + " )"); //$NON-NLS-1$ //$NON-NLS-2$
+ return (tmpConfig.getName() + " ( " + tmpConfig.getDescription() + " )"); //$NON-NLS-1$ //$NON-NLS-2$
}
return "";
}
@@ -45,4 +42,3 @@ public class ConfigurationLabelProvider extends LabelProvider implements ITableL
return IMG_CFG;
}
}
-
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizard.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizard.java
index af49c013610..30756c9793b 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizard.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizard.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.wizards;
-
import java.lang.reflect.InvocationTargetException;
import org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin;
@@ -30,9 +29,8 @@ import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
-
/**
- * This wizard provides a method by which the user can
+ * This wizard provides a method by which the user can
* add a C nature to a project that previously had no nature associated with it.
*/
public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
@@ -41,28 +39,29 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
private static final String WZ_DESC = "WizardAutotoolsProjectConversion.description"; //$NON-NLS-1$
private static final String PREFIX = "WizardAutotoolsConversion"; //$NON-NLS-1$
private static final String WINDOW_TITLE = "WizardAutotoolsConversion.windowTitle"; //$NON-NLS-1$
- protected static final String CONF_TITLE = PREFIX + ".config.title"; //$NON-NLS-1$
- protected static final String CONF_DESC = PREFIX + ".config.desc"; //$NON-NLS-1$
- protected static final String MSG_SAVE = PREFIX + ".message.save"; //$NON-NLS-1$
- protected static final String OPTIONS_TITLE = PREFIX + ".options.title"; //$NON-NLS-1$
- protected static final String OPTIONS_DESC = PREFIX + ".options.desc"; //$NON-NLS-1$
+ protected static final String CONF_TITLE = PREFIX + ".config.title"; //$NON-NLS-1$
+ protected static final String CONF_DESC = PREFIX + ".config.desc"; //$NON-NLS-1$
+ protected static final String MSG_SAVE = PREFIX + ".message.save"; //$NON-NLS-1$
+ protected static final String OPTIONS_TITLE = PREFIX + ".options.title"; //$NON-NLS-1$
+ protected static final String OPTIONS_DESC = PREFIX + ".options.desc"; //$NON-NLS-1$
public static final String NULL_INDEXER_ID = "org.eclipse.cdt.core.nullindexer"; //$NON-NLS-1$
-
+
protected CProjectPlatformPage projectConfigurationPage;
protected NewAutotoolsProjectOptionPage optionPage;
protected IProject curProject;
-
+
/**
* ConvertToAutotoolsConversionWizard Wizard constructor
*/
public ConvertToAutotoolsProjectWizard() {
this(getWindowTitleResource(), getWzDescriptionResource());
}
+
/**
* ConvertToAutotoolsConversionWizard Wizard constructor
- *
+ *
* @param title
* @param desc
*/
@@ -73,7 +72,7 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
/**
* Method getWzDescriptionResource, allows Wizard description label value
* to be changed by subclasses
- *
+ *
* @return String
*/
protected static String getWzDescriptionResource() {
@@ -83,7 +82,7 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
/**
* Method getWzTitleResource, allows Wizard description label value
* to be changed by subclasses
- *
+ *
* @return String
*/
protected static String getWzTitleResource() {
@@ -93,7 +92,7 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
/**
* Method getWindowTitleResource, allows Wizard Title label value to be
* changed by subclasses
- *
+ *
* @return String
*/
protected static String getWindowTitleResource() {
@@ -102,7 +101,7 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
/**
* Method getPrefix, allows prefix value to be changed by subclasses
- *
+ *
* @return String
*/
protected static String getPrefix() {
@@ -111,13 +110,13 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
/**
* Method addPages adds our Simple to C conversion Wizard page.
- *
+ *
* @see Wizard#createPages
*/
@Override
public void addPages() {
addPage(mainPage = new ConvertToAutotoolsProjectWizardPage(getPrefix(), this));
-
+
// Add the configuration selection page
projectConfigurationPage = new CProjectPlatformPage(PREFIX);
projectConfigurationPage.setTitle(AutotoolsUIPlugin.getResourceString(CONF_TITLE));
@@ -129,10 +128,10 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
optionPage.setTitle(AutotoolsUIPlugin.getResourceString(OPTIONS_TITLE));
optionPage.setDescription(AutotoolsUIPlugin.getResourceString(OPTIONS_DESC));
addPage(optionPage);
-
+
// add custom pages
MBSCustomPageManager.init();
-
+
// add stock pages
MBSCustomPageManager.addStockPage(fMainPage, NewCProjectWizardPage.PAGE_ID);
MBSCustomPageManager.addStockPage(projectConfigurationPage, CProjectPlatformPage.PAGE_ID);
@@ -152,14 +151,14 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
return projectConfigurationPage.getSelectedConfigurations();
}
- protected void setCurrentProject (IProject project) {
+ protected void setCurrentProject(IProject project) {
curProject = project;
}
-
+
public IProject getProject() {
return curProject;
}
-
+
@SuppressWarnings("deprecation")
public void applyOptions(IProject project, IProgressMonitor monitor) {
// When applying the project options, we need to specify which
@@ -169,18 +168,20 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
// applying options will ask the wizard (us) to get the project which
// we will report is the current project being converted.
setCurrentProject(project);
- optionPage.performApply(monitor);
- }
-
+ optionPage.performApply(monitor);
+ }
+
@Override
protected void doRun(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(AutotoolsUIPlugin.getResourceString("WizardAutotoolsProjectConversion.monitor.convertingToMakeProject"), 2); //$NON-NLS-1$
+ monitor.beginTask(
+ AutotoolsUIPlugin.getResourceString("WizardAutotoolsProjectConversion.monitor.convertingToMakeProject"), //$NON-NLS-1$
+ 2);
try {
super.doRun(SubMonitor.convert(monitor, 5));
} finally {
monitor.done();
}
-
+
}
@Override
@@ -192,25 +193,23 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
@Override
protected void doRunEpilogue(IProgressMonitor monitor) {
// Get my initializer to run
-// if (project == null)
-// return;
-//
-// IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
-// if (initResult.getCode() != IStatus.OK) {
-// // At this point, I can live with a failure
-// ManagedBuilderUIPlugin.log(initResult);
-// }
-
+ // if (project == null)
+ // return;
+ //
+ // IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
+ // if (initResult.getCode() != IStatus.OK) {
+ // // At this point, I can live with a failure
+ // ManagedBuilderUIPlugin.log(initResult);
+ // }
+
// execute any operations specified by custom pages
IRunnableWithProgress operations[] = MBSCustomPageManager.getOperations();
-
- if (operations != null)
- {
- for(int k = 0; k < operations.length; k++)
- {
+
+ if (operations != null) {
+ for (int k = 0; k < operations.length; k++) {
try {
- operations[k].run(monitor);
- } catch(InvocationTargetException |InterruptedException e) {
+ operations[k].run(monitor);
+ } catch (InvocationTargetException | InterruptedException e) {
//TODO: what should we do?
}
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizardPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizardPage.java
index 19ad695e6bc..ef85c2263d3 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizardPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConvertToAutotoolsProjectWizardPage.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.ui.wizards;
-
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
import org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin;
import org.eclipse.cdt.core.CCorePlugin;
@@ -37,7 +36,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
-
/**
*
* ConvertToAutotoolsProjectWizardPage
@@ -56,14 +54,14 @@ import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
* </p>
*/
public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPage {
-
- private static final String WZ_TITLE = "WizardAutotoolsProjectConversion.title"; //$NON-NLS-1$
- private static final String WZ_DESC = "WizardAutotoolsProjectConversion.description"; //$NON-NLS-1$
- private static final String PREFIX = "WizardAutotoolsProjectConversion";
- protected static final String MSG_ADD_NATURE = PREFIX + ".message.add_nature"; //$NON-NLS-1$
- protected static final String MSG_ADD_BUILDER = PREFIX + ".message.add_builder"; //$NON-NLS-1$
- protected static final String MSG_SAVE = PREFIX + ".message.save"; //$NON-NLS-1$
-
+
+ private static final String WZ_TITLE = "WizardAutotoolsProjectConversion.title"; //$NON-NLS-1$
+ private static final String WZ_DESC = "WizardAutotoolsProjectConversion.description"; //$NON-NLS-1$
+ private static final String PREFIX = "WizardAutotoolsProjectConversion";
+ protected static final String MSG_ADD_NATURE = PREFIX + ".message.add_nature"; //$NON-NLS-1$
+ protected static final String MSG_ADD_BUILDER = PREFIX + ".message.add_builder"; //$NON-NLS-1$
+ protected static final String MSG_SAVE = PREFIX + ".message.save"; //$NON-NLS-1$
+
/**
* Constructor for ConvertToStdMakeProjectWizardPage.
* @param pageName
@@ -72,58 +70,59 @@ public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPag
super(pageName);
setWizard(wizard);
}
-
- /**
- * Method getWzTitleResource returns the correct Title Label for this class
- * overriding the default in the superclass.
- */
- @Override
- protected String getWzTitleResource(){
- return AutotoolsUIPlugin.getResourceString(WZ_TITLE);
- }
-
- /**
- * Method getWzDescriptionResource returns the correct description
- * Label for this class overriding the default in the superclass.
- */
- @Override
- protected String getWzDescriptionResource(){
- return AutotoolsUIPlugin.getResourceString(WZ_DESC);
- }
-
- /**
- * Method isCandidate returns true for all projects.
- *
- * @param project
- * @return boolean
- */
- @Override
- public boolean isCandidate(IProject project) {
- return true; // all
- }
-
- protected IProjectType getProjectType() {
- return ((ConvertToAutotoolsProjectWizard)getWizard()).getProjectType();
- }
-
- protected IConfiguration[] getSelectedConfigurations() {
- return ((ConvertToAutotoolsProjectWizard)getWizard()).getSelectedConfigurations();
- }
-
- protected void applyOptions(IProject project, IProgressMonitor monitor) {
- ((ConvertToAutotoolsProjectWizard)getWizard()).applyOptions(project, monitor);
- }
-
+
+ /**
+ * Method getWzTitleResource returns the correct Title Label for this class
+ * overriding the default in the superclass.
+ */
+ @Override
+ protected String getWzTitleResource() {
+ return AutotoolsUIPlugin.getResourceString(WZ_TITLE);
+ }
+
+ /**
+ * Method getWzDescriptionResource returns the correct description
+ * Label for this class overriding the default in the superclass.
+ */
+ @Override
+ protected String getWzDescriptionResource() {
+ return AutotoolsUIPlugin.getResourceString(WZ_DESC);
+ }
+
+ /**
+ * Method isCandidate returns true for all projects.
+ *
+ * @param project
+ * @return boolean
+ */
+ @Override
+ public boolean isCandidate(IProject project) {
+ return true; // all
+ }
+
+ protected IProjectType getProjectType() {
+ return ((ConvertToAutotoolsProjectWizard) getWizard()).getProjectType();
+ }
+
+ protected IConfiguration[] getSelectedConfigurations() {
+ return ((ConvertToAutotoolsProjectWizard) getWizard()).getSelectedConfigurations();
+ }
+
+ protected void applyOptions(IProject project, IProgressMonitor monitor) {
+ ((ConvertToAutotoolsProjectWizard) getWizard()).applyOptions(project, monitor);
+ }
+
@Override
public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException {
- monitor.beginTask(AutotoolsUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 7); //$NON-NLS-1$
+ monitor.beginTask(
+ AutotoolsUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 7); //$NON-NLS-1$
IConfiguration defaultCfg = null;
Boolean convertingNewAutotoolsProject = false;
try {
super.convertProject(project, SubMonitor.convert(monitor, 1), projectID);
// Bug 289834 - Converting C Autotools project to C++ loses configurations
if (project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) {
- convertingNewAutotoolsProject = true; // set this for finally clause
+ convertingNewAutotoolsProject = true; // set this for finally clause
return; // We have converted C to C++ or vice-versa for an existing Autotools project and are done
}
// Otherwise, we must scrap existing configurations as they will have tool settings we cannot use
@@ -135,7 +134,8 @@ public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPag
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_BUILDER));
AutotoolsNewProjectNature.addAutotoolsBuilder(project, SubMonitor.convert(monitor, 1));
// FIXME: Default scanner property: make -w - eventually we want to use Make core's build scanner
- project.setPersistentProperty(AutotoolsPropertyConstants.SCANNER_USE_MAKE_W, AutotoolsPropertyConstants.TRUE);
+ project.setPersistentProperty(AutotoolsPropertyConstants.SCANNER_USE_MAKE_W,
+ AutotoolsPropertyConstants.TRUE);
// Specify false for override in next call as override can cause the method to throw an
// exception.
CCorePlugin.getDefault().mapCProjectOwner(project, projectID, false);
@@ -147,27 +147,27 @@ public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPag
IProjectType parent = getProjectType();
newManagedProject = ManagedBuildManager.createManagedProject(project, parent);
if (newManagedProject != null) {
- IConfiguration [] selectedConfigs = getSelectedConfigurations();
+ IConfiguration[] selectedConfigs = getSelectedConfigurations();
for (int i = 0; i < selectedConfigs.length; i++) {
IConfiguration config = selectedConfigs[i];
int id = ManagedBuildManager.getRandomNumber();
- IConfiguration newConfig = newManagedProject.createConfiguration(config, config.getId() + "." + id); //$NON-NLS-1$
+ IConfiguration newConfig = newManagedProject.createConfiguration(config,
+ config.getId() + "." + id); //$NON-NLS-1$
newConfig.setArtifactName(newManagedProject.getDefaultArtifactName());
}
// Now add the first supported config in the list as the default
IConfiguration[] newConfigs = newManagedProject.getConfigurations();
- for(int i = 0; i < newConfigs.length; i++) {
- if(newConfigs[i].isSupported()){
+ for (int i = 0; i < newConfigs.length; i++) {
+ if (newConfigs[i].isSupported()) {
defaultCfg = newConfigs[i];
break;
}
}
-
- if(defaultCfg == null && newConfigs.length > 0)
+
+ if (defaultCfg == null && newConfigs.length > 0)
defaultCfg = newConfigs[0];
-
-
- if(defaultCfg != null) {
+
+ if (defaultCfg != null) {
ManagedBuildManager.setDefaultConfiguration(project, defaultCfg);
ManagedBuildManager.setSelectedConfiguration(project, defaultCfg);
}
@@ -212,8 +212,8 @@ public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPag
@Override
public void createControl(Composite parent) {
super.createControl(parent);
- IStructuredSelection sel = ((BasicNewResourceWizard)getWizard()).getSelection();
- if ( sel != null) {
+ IStructuredSelection sel = ((BasicNewResourceWizard) getWizard()).getSelection();
+ if (sel != null) {
tableViewer.setCheckedElements(sel.toArray());
setPageComplete(validatePage());
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ManagedProjectOptionBlock.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ManagedProjectOptionBlock.java
index 5e16a1b1171..526fb5b63fa 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ManagedProjectOptionBlock.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ManagedProjectOptionBlock.java
@@ -25,13 +25,12 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.PlatformUI;
-
@SuppressWarnings("deprecation")
public class ManagedProjectOptionBlock extends TabFolderOptionBlock {
private ErrorParserBlock errParserBlock;
private BinaryParserBlock binaryParserBlock;
-
+
/**
* @param parent
*/
@@ -49,29 +48,30 @@ public class ManagedProjectOptionBlock extends TabFolderOptionBlock {
public BinaryParserBlock getBinaryParserBlock() {
return binaryParserBlock;
}
-
+
public ErrorParserBlock getErrorParserBlock() {
return errParserBlock;
}
-
+
@Override
public Control createContents(Composite parent) {
- Control control = super.createContents( parent );
- ((GridLayout)((Composite)control).getLayout()).marginWidth = 1;
+ Control control = super.createContents(parent);
+ ((GridLayout) ((Composite) control).getLayout()).marginWidth = 1;
GridData gd = new GridData(GridData.FILL_BOTH);
- ((Composite)control).setLayoutData(gd);
+ ((Composite) control).setLayoutData(gd);
- if (getErrorParserBlock()!= null)
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getErrorParserBlock().getControl(), CDTHelpContextIds.MAN_PROJ_ERROR_PARSER);
+ if (getErrorParserBlock() != null)
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getErrorParserBlock().getControl(),
+ CDTHelpContextIds.MAN_PROJ_ERROR_PARSER);
return control;
- }
+ }
public void updateValues() {
- if (getErrorParserBlock()!= null) {
+ if (getErrorParserBlock() != null) {
getErrorParserBlock().updateValues();
}
- if (getBinaryParserBlock()!= null) {
+ if (getBinaryParserBlock() != null) {
// TODO
//getBinaryParserBlock().updateValues();
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/NewAutotoolsProjectOptionPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/NewAutotoolsProjectOptionPage.java
index f1a4e9632fe..5d3886fb0d6 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/NewAutotoolsProjectOptionPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/NewAutotoolsProjectOptionPage.java
@@ -30,16 +30,14 @@ import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ui.PlatformUI;
-
@SuppressWarnings("deprecation")
public class NewAutotoolsProjectOptionPage extends NewCProjectWizardOptionPage {
-
+
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.projectOptionsPage"; //$NON-NLS-1$
-
+
public static class ManagedWizardOptionBlock extends ManagedProjectOptionBlock {
-
+
NewAutotoolsProjectOptionPage parent;
-
public ManagedWizardOptionBlock(NewAutotoolsProjectOptionPage parentPage) {
super(parentPage);
@@ -50,7 +48,7 @@ public class NewAutotoolsProjectOptionPage extends NewCProjectWizardOptionPage {
AutotoolsReferenceBlock() {
super();
}
-
+
@Override
public void performApply(IProgressMonitor monitor) {
try {
@@ -61,6 +59,7 @@ public class NewAutotoolsProjectOptionPage extends NewCProjectWizardOptionPage {
}
}
}
+
public void updateProjectTypeProperties() {
}
@@ -70,14 +69,14 @@ public class NewAutotoolsProjectOptionPage extends NewCProjectWizardOptionPage {
// Bug 406711 - Remove the IndexerBlock as this causes an exception to occur
// because the project handle isn't set up. It is not needed.
}
-
- public void setupHelpContextIds(){
+
+ public void setupHelpContextIds() {
List<ICOptionPage> pages = getOptionPages();
-
+
Iterator<ICOptionPage> iter = pages.iterator();
- for( int i = 0; i < 3 && iter.hasNext(); i++ ) {
+ for (int i = 0; i < 3 && iter.hasNext(); i++) {
ICOptionPage page = iter.next();
-
+
String id = null;
if (page instanceof ReferenceBlock) {
id = CDTHelpContextIds.MAN_PROJ_WIZ_PROJECTS_TAB;
@@ -88,7 +87,7 @@ public class NewAutotoolsProjectOptionPage extends NewCProjectWizardOptionPage {
}
}
}
-
+
protected ManagedWizardOptionBlock optionBlock;
/**
@@ -107,7 +106,7 @@ public class NewAutotoolsProjectOptionPage extends NewCProjectWizardOptionPage {
@Override
public IProject getProject() {
if (getWizard() instanceof ConvertToAutotoolsProjectWizard)
- return ((ConvertToAutotoolsProjectWizard)getWizard()).getProject();
+ return ((ConvertToAutotoolsProjectWizard) getWizard()).getProject();
return null;
}
@@ -115,20 +114,19 @@ public class NewAutotoolsProjectOptionPage extends NewCProjectWizardOptionPage {
public Preferences getPreferences() {
return ManagedBuilderUIPlugin.getDefault().getPluginPreferences();
}
-
+
public void updateProjectTypeProperties() {
// Update the error parser list
optionBlock.updateProjectTypeProperties();
}
-
- public void setupHelpContextIds(){
+
+ public void setupHelpContextIds() {
optionBlock.setupHelpContextIds();
}
-
+
@Override
- public IWizardPage getNextPage()
- {
+ public IWizardPage getNextPage() {
return MBSCustomPageManager.getNextPage(PAGE_ID); // get first custom page, if any
}
-
+
}
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ReferenceBlock.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ReferenceBlock.java
index 73ecd43f38e..6177dabacfe 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ReferenceBlock.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ReferenceBlock.java
@@ -44,20 +44,20 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
/**
* @deprecated as of CDT 4.0. This Block was used for New Project Wizard
* for 3.X style projects.
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
*/
@Deprecated
public class ReferenceBlock extends AbstractCOptionPage {
- private static final String PREFIX = "ReferenceBlock"; //$NON-NLS-1$ //$NON-NLS-1$
- private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$ //$NON-NLS-1$
- private static final String DESC = PREFIX + ".desc"; //$NON-NLS-1$ //$NON-NLS-1$
+ private static final String PREFIX = "ReferenceBlock"; //$NON-NLS-1$
+ private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
+ private static final String DESC = PREFIX + ".desc"; //$NON-NLS-1$
private CheckboxTableViewer referenceProjectsViewer;
private static final int PROJECT_LIST_MULTIPLIER = 10;
-
+
public ReferenceBlock() {
super(CUIPlugin.getResourceString(LABEL));
setDescription(CUIPlugin.getResourceString(DESC));
@@ -81,7 +81,7 @@ public class ReferenceBlock extends AbstractCOptionPage {
if (!(element instanceof IWorkspace))
return new Object[0];
ArrayList<IProject> aList = new ArrayList<>(15);
- final IProject[] projects = ((IWorkspace)element).getRoot().getProjects();
+ final IProject[] projects = ((IWorkspace) element).getRoot().getProjects();
for (int i = 0; i < projects.length; i++) {
if (CoreModel.hasCNature(projects[i])) {
// Do not show the actual project being look at
@@ -96,7 +96,7 @@ public class ReferenceBlock extends AbstractCOptionPage {
};
}
- protected void initializeValues () {
+ protected void initializeValues() {
if (getContainer().getProject() != null) {
try {
IProject[] referenced = getContainer().getProject().getReferencedProjects();
@@ -115,7 +115,7 @@ public class ReferenceBlock extends AbstractCOptionPage {
Object[] elements = referenceProjectsViewer.getCheckedElements();
IProject[] projects = new IProject[elements.length];
System.arraycopy(elements, 0, projects, 0, elements.length);
- return projects;
+ return projects;
}
@Override
@@ -130,15 +130,10 @@ public class ReferenceBlock extends AbstractCOptionPage {
lbldata.horizontalSpan = 1;
label.setLayoutData(lbldata);
-
- referenceProjectsViewer =
- CheckboxTableViewer.newCheckList(composite, SWT.TOP | SWT.BORDER);
+ referenceProjectsViewer = CheckboxTableViewer.newCheckList(composite, SWT.TOP | SWT.BORDER);
GridData data = new GridData(GridData.FILL_BOTH);
data.grabExcessHorizontalSpace = true;
- data.heightHint =
- getDefaultFontHeight(
- referenceProjectsViewer.getTable(),
- PROJECT_LIST_MULTIPLIER);
+ data.heightHint = getDefaultFontHeight(referenceProjectsViewer.getTable(), PROJECT_LIST_MULTIPLIER);
//Only set a height hint if it will not result in a cut off dialog
referenceProjectsViewer.getTable().setLayoutData(data);
@@ -176,7 +171,7 @@ public class ReferenceBlock extends AbstractCOptionPage {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
- monitor.beginTask(AutotoolsWizardMessages.getResourceString("ReferenceBlock_task_ReferenceProjects"), 1);
+ monitor.beginTask(AutotoolsWizardMessages.getResourceString("ReferenceBlock_task_ReferenceProjects"), 1);
try {
IProjectDescription description = project.getDescription();
description.setReferencedProjects(refProjects);
@@ -184,7 +179,7 @@ public class ReferenceBlock extends AbstractCOptionPage {
} catch (CoreException e) {
}
}
-
+
}
@Override

Back to the top