From 2a1cddd71635c39ae336ba43bb89cecbfb09e21f Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Thu, 17 Nov 2011 17:34:21 -0500 Subject: [PATCH] auto-clean: @Override annotations + organize imports + unnecessary casts/$NON-NLS + trailing white spaces --- .../builder/tests/CDataProviderTests.java | 35 +- .../builder/tests/StandardBuildTests.java | 61 +- .../tests/MakefileReaderProviderTests.java | 47 +- .../core/tests/StandardBuildTestHelper.java | 43 +- .../GCCPerFileBOPConsoleParserTests.java | 16 +- .../TestScannerInfoCollector.java | 6 +- .../eclipse/cdt/make/core/MakeBuilder.java | 9 +- .../eclipse/cdt/make/core/MakeCorePlugin.java | 31 +- .../cdt/make/core/MakeProjectNature.java | 12 +- .../cdt/make/core/MakeScannerInfo.java | 6 +- .../cdt/make/core/MakeScannerProvider.java | 13 +- .../cdt/make/core/makefile/IDirective.java | 5 +- .../cdt/make/core/makefile/ITarget.java | 1 + .../scannerconfig/DiscoveredScannerInfo.java | 34 +- .../scannerconfig/ScannerConfigNature.java | 30 +- .../make/internal/core/BuildInfoFactory.java | 47 +- .../cdt/make/internal/core/MakeProject.java | 2 + .../cdt/make/internal/core/MakeTarget.java | 35 +- .../make/internal/core/MakeTargetManager.java | 19 +- .../dataprovider/ConfigSupportNature.java | 4 + .../core/makefile/AbstractMakefile.java | 24 +- .../make/internal/core/makefile/Command.java | 6 +- .../internal/core/makefile/Directive.java | 4 + .../core/makefile/MacroDefinition.java | 7 + .../internal/core/makefile/NullMakefile.java | 12 +- .../make/internal/core/makefile/Parent.java | 5 +- .../cdt/make/internal/core/makefile/Rule.java | 4 +- .../internal/core/makefile/SpecialRule.java | 3 +- .../internal/core/makefile/TargetRule.java | 7 +- .../core/makefile/gnu/Conditional.java | 20 +- .../core/makefile/gnu/GNUMakefile.java | 28 +- .../core/makefile/gnu/GNUMakefileChecker.java | 1 + .../makefile/gnu/GNUMakefileValidator.java | 16 +- .../internal/core/makefile/gnu/Include.java | 5 +- .../internal/core/makefile/gnu/Terminal.java | 2 + .../internal/core/makefile/gnu/UnExport.java | 1 + .../internal/core/makefile/gnu/VPath.java | 2 + .../core/makefile/gnu/VariableDefinition.java | 14 +- .../core/makefile/posix/PosixMakefile.java | 16 +- .../CDataDiscoveredInfoCalculator.java | 269 ++--- .../DiscoveredPathContainer.java | 11 +- .../scannerconfig/DiscoveredPathInfo.java | 29 +- .../scannerconfig/DiscoveredPathManager.java | 92 +- .../DiscoveredScannerInfoStore.java | 49 +- .../PerFileDiscoveredPathContainer.java | 12 +- .../ScannerConfigInfoFactory.java | 40 +- .../gnu/AbstractGCCBOPConsoleParser.java | 44 +- .../gnu/GCCPerFileBOPConsoleParser.java | 14 +- .../gnu/GCCPerFileSIPConsoleParser.java | 17 +- .../gnu/GCCScannerInfoConsoleParser.java | 13 +- .../gnu/GCCSpecsConsoleParser.java | 15 +- .../core/scannerconfig/jobs/SCJobsUtil.java | 40 +- .../scannerconfig2/DefaultRunSIProvider.java | 48 +- .../scannerconfig2/DefaultSIFileReader.java | 26 +- .../scannerconfig2/PerFileSICollector.java | 179 ++-- .../scannerconfig2/PerProjectSICollector.java | 117 ++- .../scannerconfig2/SCMarkerGenerator.java | 16 +- .../ScannerConfigInfoFactory2.java | 234 +++-- .../internal/ui/MakeEnvironmentBlock.java | 59 +- .../cdt/make/internal/ui/MakeStartup.java | 3 +- .../cdt/make/internal/ui/MakeUIPlugin.java | 11 +- .../make/internal/ui/MultipleInputDialog.java | 101 +- .../ui/actions/FoldingActionGroup.java | 50 +- .../compare/MakefileContentViewerCreator.java | 11 +- .../ui/compare/MakefileMergeViewer.java | 7 +- .../dnd/AbstractContainerAreaDropAdapter.java | 7 + .../ui/dnd/AbstractSelectionDragAdapter.java | 3 + .../dnd/FileTransferDropTargetListener.java | 1 + .../dnd/LocalTransferDragSourceListener.java | 1 + .../dnd/LocalTransferDropTargetListener.java | 1 + .../internal/ui/dnd/MakeTargetDndUtil.java | 4 +- .../MakeTargetTransferDragSourceListener.java | 1 + .../MakeTargetTransferDropTargetListener.java | 1 + .../dnd/TextTransferDragSourceListener.java | 1 + .../dnd/TextTransferDropTargetListener.java | 4 +- .../ui/editor/MakefileContentOutlinePage.java | 11 +- .../ui/editor/MakefileDocumentProvider.java | 24 +- .../MakefileDocumentSetupParticipant.java | 11 +- .../internal/ui/editor/MakefileEditor.java | 44 +- .../ui/editor/ProjectionMakefileUpdater.java | 117 ++- .../ui/editor/WorkingCopyManager.java | 18 +- .../internal/ui/part/CheckboxTablePart.java | 2 + .../ui/part/SharedPartWithButtons.java | 2 + .../AbstractMakefileEditorPreferencePage.java | 86 +- .../internal/ui/preferences/ColorEditor.java | 33 +- .../ui/preferences/MakePreferencePage.java | 21 +- .../MakefileEditorPreferencePage.java | 108 +- .../MakefileSettingsPreferencePage.java | 1 + .../NewMakeProjectPreferencePage.java | 12 +- .../preferences/OverlayPreferenceStore.java | 127 ++- .../internal/ui/preferences/StatusInfo.java | 9 + .../ui/properties/MakePropertyPage.java | 10 +- .../DiscoveredElementLabelProvider.java | 14 +- .../make/internal/ui/text/ColorManager.java | 6 +- .../ui/text/CompletionProposalComparator.java | 7 +- .../ui/text/makefile/MacroDefinitionRule.java | 5 +- .../makefile/MakefileAnnotationHover.java | 9 +- .../ui/text/makefile/MakefileCodeScanner.java | 7 +- .../makefile/MakefileCompletionProcessor.java | 12 +- .../makefile/MakefileReconcilingStrategy.java | 17 +- .../ui/text/makefile/MakefileTextHover.java | 14 +- .../text/makefile/MakefileWordDetector.java | 2 + .../cdt/make/ui/MakeContentProvider.java | 48 +- .../cdt/make/ui/MakeLabelProvider.java | 4 +- .../org/eclipse/cdt/make/ui/TargetBuild.java | 3 +- .../cdt/make/ui/TargetListViewerPart.java | 17 +- .../make/ui/actions/AbstractTargetAction.java | 8 +- .../ui/actions/BuildLastTargetHandler.java | 7 +- .../make/ui/actions/BuildTargetAction.java | 19 +- .../make/ui/actions/BuildTargetHandler.java | 7 +- .../ui/actions/UpdateMakeProjectAction.java | 7 + .../AbstractDiscoveryOptionsBlock.java | 49 +- .../make/ui/dialogs/BuildTargetDialog.java | 4 +- .../dialogs/DiscoveredPathContainerPage.java | 84 +- .../ui/dialogs/GCCPerFileSCDProfilePage.java | 53 +- .../dialogs/GCCPerProjectSCDProfilePage.java | 81 +- .../dialogs/MBSPerProjectSCDProfilePage.java | 28 +- .../cdt/make/ui/dialogs/MakeTargetDialog.java | 3 + .../cdt/make/ui/dialogs/SettingsBlock.java | 25 +- .../ui/views/FilterEmtpyFoldersAction.java | 3 +- .../eclipse/cdt/make/ui/views/MakeView.java | 28 +- .../wizards/UpdateMakeProjectWizardPage.java | 4 + .../testplugin/AbstractBuilderTest.java | 1 + .../testplugin/BuildSystemTestHelper.java | 43 +- .../testplugin/ManagedBuildTestHelper.java | 173 +-- .../testplugin/ResourceDeltaVerifier.java | 9 +- .../tests/GCCSpecsConsoleParserTest.java | 2 + .../AlwaysOffApplicabilityCalculator.java | 9 +- .../AlwaysOnApplicabilityCalculator.java | 9 +- .../tests/BidirectionalPathConverter.java | 3 +- .../tests/BuildDescriptionModelTests.java | 748 ++++++------- .../core/tests/BuildFileGenerator.java | 12 +- .../core/tests/BuildSystem40Tests.java | 183 ++-- .../tests/CmdLineApplicabilityCalculator.java | 9 +- .../tests/CustomOptionCommandGenerator.java | 9 +- .../DefaultFortranDependencyCalculator.java | 50 +- .../ManagedBuildCommandLineGenerator.java | 1 + .../tests/ManagedBuildCommandLineInfo.java | 8 + .../core/tests/ManagedBuildCoreTests20.java | 384 +++---- ...nagedBuildCoreTests_SharedToolOptions.java | 183 ++-- ...ManagedBuildDependencyCalculatorTests.java | 66 +- .../tests/ManagedBuildEnvironmentTests.java | 165 +-- .../tests/ManagedProject21MakefileTests.java | 112 +- .../tests/ManagedProject30MakefileTests.java | 225 ++-- .../core/tests/ManagedProjectUpdateTests.java | 97 +- .../core/tests/MultiVersionSupportTests.java | 213 ++-- .../tests/OneDirectionalPathConverter.java | 3 +- .../core/tests/OptionEnablementTests.java | 192 ++-- .../core/tests/ProjectConverter.java | 7 +- .../core/tests/ProjectConverter20.java | 7 +- .../core/tests/ProjectConverter21.java | 7 +- .../core/tests/ResourceBuildCoreTests.java | 334 +++--- .../tests/Test30_2_CommandLineGenerator.java | 9 +- .../core/tests/TestConfigElement.java | 14 +- .../tests/TestConfigurationNameProvider.java | 5 +- .../core/tests/TestLinkerNameProvider.java | 7 +- .../managedbuilder/core/tests/TestMacro.java | 86 +- .../core/tests/TestManagedConfigProvider.java | 9 +- .../core/tests/TestPathConverter1.java | 1 + .../core/tests/TestProjectConverter.java | 7 +- .../projectmodel/tests/ProjectModelTests.java | 254 ++--- .../scannerconfig/ScannerConfigNature.java | 28 +- .../CfgDiscoveredPathManager.java | 88 +- .../PerFileSettingsCalculator.java | 255 ++--- .../scannerconfig/jobs/CfgSCJobsUtil.java | 42 +- .../CfgScannerConfigInfoFactory2.java | 75 +- .../core/IResourceConfiguration.java | 115 +- .../managedbuilder/core/IToolReference.java | 45 +- .../core/ManagedBuildManager.java | 55 +- .../core/ManagedCProjectNature.java | 28 +- .../core/ManagedOptionValueHandler.java | 35 +- .../core/ResourceChangeHandler2.java | 35 +- .../envvar/IBuildEnvironmentVariable.java | 26 +- .../internal/buildmodel/BuildCommand.java | 8 +- .../internal/buildmodel/BuildDescription.java | 26 +- .../BuildDescriptionGnuMakefileGenerator.java | 47 +- .../internal/buildmodel/BuildIOType.java | 23 +- .../internal/buildmodel/BuildResource.java | 59 +- .../buildmodel/BuildStateManager.java | 35 +- .../internal/buildmodel/BuildStep.java | 180 ++-- .../internal/buildmodel/CommandBuilder.java | 85 +- .../buildmodel/ConfigurationBuildState.java | 35 +- .../DefaultBuildDescriptionFactory.java | 12 +- .../buildmodel/DescriptionBuilder.java | 64 +- .../buildmodel/ProjectBuildState.java | 36 +- .../internal/buildmodel/StepBuilder.java | 47 +- .../buildproperties/BuildProperties.java | 50 +- .../buildproperties/BuildProperty.java | 22 +- .../buildproperties/BuildPropertyManager.java | 42 +- .../buildproperties/BuildPropertyType.java | 8 +- .../internal/core/AdditionalInput.java | 65 +- ...leanExpressionApplicabilityCalculator.java | 56 +- .../internal/core/BuildObject.java | 26 +- .../internal/core/BuildObjectProperties.java | 22 +- .../internal/core/CommonBuilder.java | 3 + .../core/ConfigurationNameProvider.java | 7 +- .../internal/core/ConfigurationV2.java | 135 +-- .../core/DefaultManagedConfigElement.java | 12 +- .../internal/core/EnvVarBuildPath.java | 36 +- .../internal/core/FolderInfo.java | 25 + .../core/GnuConfigurationNameProvider.java | 1 + .../internal/core/HeadlessBuilder.java | 3 + .../internal/core/HoldsOptions.java | 174 +-- .../internal/core/InputOrder.java | 79 +- .../internal/core/InputType.java | 63 +- .../internal/core/ManagedBuildInfo.java | 317 +++--- .../core/ManagedCommandLineGenerator.java | 31 +- .../internal/core/ManagedCommandLineInfo.java | 12 +- .../core/ManagedConfigStorageElement.java | 30 +- .../internal/core/ManagedMakeProject.java | 24 +- .../internal/core/ManagedProject.java | 129 ++- .../internal/core/MapStorageElement.java | 66 +- .../internal/core/ModificationStatus.java | 17 +- .../internal/core/MultiFileInfo.java | 12 + .../internal/core/MultiFolderInfo.java | 24 +- .../internal/core/MultiResourceInfo.java | 64 +- .../managedbuilder/internal/core/Option.java | 443 ++++---- .../internal/core/OptionCategory.java | 154 +-- .../internal/core/OptionReference.java | 199 ++-- .../internal/core/OutputType.java | 206 ++-- .../internal/core/ProjectType.java | 157 +-- .../internal/core/ResourceChangeHandler.java | 61 +- .../internal/core/ResourceConfiguration.java | 213 ++-- .../internal/core/ResourceInfo.java | 127 ++- .../internal/core/ResourceInfoContainer.java | 35 +- .../internal/core/SupportedProperties.java | 58 +- .../managedbuilder/internal/core/Target.java | 204 ++-- .../internal/core/TargetPlatform.java | 131 ++- .../managedbuilder/internal/core/Tool.java | 831 ++++++++------- .../internal/core/ToolChain.java | 587 ++++++----- .../internal/core/ToolReference.java | 302 ++++-- .../BuildEnvironmentContributor.java | 32 +- .../BuildVariablesContributor.java | 16 +- .../ConfigurationDataProvider.java | 128 +-- .../ExternalExtensionMacroSupplier.java | 54 +- .../dataprovider/ProjectConverter.java | 135 +-- .../dataprovider/ResourcePropertyHolder.java | 32 +- .../internal/enablement/AndExpression.java | 12 +- .../CheckBuildPropertyExpression.java | 26 +- .../enablement/CheckHolderExpression.java | 10 +- .../enablement/CheckOptionExpression.java | 70 +- .../enablement/CheckStringExpression.java | 34 +- .../internal/enablement/FalseExpression.java | 2 + .../enablement/HasNatureExpression.java | 20 +- .../internal/enablement/OrExpression.java | 12 +- .../envvar/EnvironmentVariableProvider.java | 89 +- .../ExternalExtensionEnvironmentSupplier.java | 36 +- .../envvar/MbsEnvironmentSupplier.java | 16 +- .../StoredBuildPathEnvironmentContainer.java | 62 +- .../macros/BuildCdtVariablesSupplierBase.java | 6 + .../internal/macros/BuildMacro.java | 5 +- .../internal/macros/BuildMacroProvider.java | 74 +- .../internal/macros/BuildMacroStatus.java | 11 +- .../macros/BuildfileMacroSubstitutor.java | 51 +- .../macros/DefaultMacroContextInfo.java | 48 +- .../macros/FileContextBuildMacroValues.java | 18 +- .../internal/macros/FileContextData.java | 7 +- .../internal/macros/MbsMacroSupplier.java | 166 +-- .../internal/macros/OptionContextData.java | 17 +- .../ManagedBuildCPathEntryContainer.java | 5 + .../ConfigurationModification.java | 46 +- .../internal/tcmodification/ConflictSet.java | 48 +- .../tcmodification/FileInfoModification.java | 11 +- .../FolderInfoModification.java | 114 +- .../internal/tcmodification/ObjectSet.java | 18 +- .../tcmodification/PathComparator.java | 31 +- .../ToolChainModificationManager.java | 60 +- .../internal/tcmodification/ToolListMap.java | 55 +- .../tcmodification/ToolListModification.java | 179 ++-- .../managedbuilder/macros/IBuildMacro.java | 10 +- .../gnu/DefaultGCCDependencyCalculator.java | 75 +- .../gnu/DefaultGCCDependencyCalculator2.java | 11 +- ...faultGCCDependencyCalculator2Commands.java | 73 +- .../gnu/DefaultGCCDependencyCalculator3.java | 21 +- ...faultGCCDependencyCalculator3Commands.java | 111 +- ...efaultGCCDependencyCalculatorPreBuild.java | 11 +- ...CDependencyCalculatorPreBuildCommands.java | 84 +- .../gnu/GnuLinkOutputNameProvider.java | 27 +- .../makegen/gnu/GnuMakefileGenerator.java | 21 +- .../makegen/gnu/ManagedBuildGnuToolInfo.java | 192 ++-- .../DefaultIndexerDependencyCalculator.java | 17 +- .../DefaultNoDependencyCalculator.java | 7 +- .../pdomdepgen/PDOMDependencyCalculator.java | 24 +- .../pdomdepgen/PDOMDependencyGenerator.java | 13 +- .../UpdateManagedProject21.java | 20 +- .../UpdateManagedProjectManager.java | 87 +- .../processes/ExcludeResources.java | 35 +- .../cdt/newmake/core/MakeScannerInfo.java | 6 +- .../cdt/newmake/core/MakeScannerProvider.java | 9 +- .../gnu/cygwin/CygwinPathResolver.java | 87 +- ...ygwinConfigurationEnvironmentSupplier.java | 18 +- .../cygwin/IsGnuCygwinToolChainSupported.java | 25 +- .../MingwEnvironmentVariableSupplier.java | 42 +- .../gnu/mingw/MingwIsToolChainSupported.java | 9 +- .../gnu/ui/ProfAppCalculator.java | 11 +- .../ui/tests/TestCProjectPlatformPage.java | 41 +- .../ui/tests/util/TestConfiguration.java | 108 +- .../ui/tests/util/TestFolderInfo.java | 44 +- .../ui/tests/util/TestProjectType.java | 30 +- .../ui/tests/util/TestToolchain.java | 60 +- .../wizardPages/AlwaysPresentWizardPage.java | 16 +- .../tests/wizardPages/NatureAWizardPage.java | 18 +- .../tests/wizardPages/NatureBWizardPage.java | 18 +- .../wizardPages/ProjectTypeDWizardPage.java | 18 +- .../wizardPages/ProjectTypeEWizardPage.java | 18 +- .../ui/tests/wizardPages/TestRunnable.java | 6 +- .../wizardPages/ToolchainCWizardPage.java | 18 +- .../wizardPages/ToolchainCv20WizardPage.java | 18 +- .../wizardPages/ToolchainFWizardPage.java | 18 +- .../actions/BuildAllConfigurationsAction.java | 5 +- .../internal/ui/actions/BuildFilesAction.java | 50 +- .../actions/CleanAllConfigurationsAction.java | 5 +- .../ui/actions/CleanAndBuildAction.java | 11 +- .../ui/actions/CleanAndBuildDialog.java | 43 +- .../internal/ui/actions/CleanFilesAction.java | 25 +- .../ui/actions/ConvertTargetAction.java | 25 +- .../ui/actions/ConvertTargetDialog.java | 50 +- .../ui/properties/ArtifactTab.java | 65 +- .../ui/properties/BuildOptionSettingsUI.java | 220 ++-- .../ui/properties/BuildStepsTab.java | 110 +- .../ui/properties/CPropertyVarsTab.java | 139 +-- .../ui/properties/DiscoveryTab.java | 84 +- .../FileListControlFieldEditor.java | 39 +- .../NewBuildConfigurationDialog.java | 103 +- .../ui/properties/NewCfgDialog.java | 147 +-- .../ui/properties/NewVarDialog.java | 91 +- .../ui/properties/RefreshPolicyTab.java | 207 ++-- .../properties/ToolListContentProvider.java | 22 +- .../ui/properties/ToolSelectionDialog.java | 134 +-- .../ui/properties/ToolSettingsPrefStore.java | 100 +- .../ui/properties/ToolSettingsTab.java | 16 +- .../ui/wizards/CDTConfigWizardPage.java | 37 +- .../ui/wizards/ConvertToMakeWizardPage.java | 27 +- .../ui/wizards/MBSCustomPage.java | 31 +- .../ui/wizards/MBSCustomPageData.java | 54 +- .../ui/wizards/NewMakeProjFromExisting.java | 23 +- .../wizards/NewMakeProjFromExistingPage.java | 51 +- .../core/dom/parser/upc/DOMToUPCTokenMap.java | 31 +- .../core/dom/parser/upc/IUPCNodeFactory.java | 7 +- .../dom/parser/upc/UPCASTNodeFactory.java | 43 +- .../parser/upc/UPCSecondaryParserFactory.java | 7 +- .../eclipse/cdt/core/dom/upc/UPCLanguage.java | 26 +- .../ast/IUPCASTCompositeTypeSpecifier.java | 5 +- .../dom/upc/ast/IUPCASTDeclSpecifier.java | 45 +- .../ast/IUPCASTElaboratedTypeSpecifier.java | 3 +- .../upc/ast/IUPCASTEnumerationSpecifier.java | 3 +- .../dom/upc/ast/IUPCASTForallStatement.java | 33 +- .../dom/upc/ast/IUPCASTKeywordExpression.java | 23 +- .../upc/ast/IUPCASTSimpleDeclSpecifier.java | 3 +- .../ast/IUPCASTSynchronizationStatement.java | 43 +- .../ast/IUPCASTTypeIdSizeofExpression.java | 13 +- .../upc/ast/IUPCASTTypedefNameSpecifier.java | 5 +- .../upc/ast/IUPCASTUnarySizeofExpression.java | 13 +- .../dom/parser/upc/UPCExpressionParser.java | 992 +++++++++--------- .../parser/upc/UPCExpressionParserprs.java | 144 ++- .../parser/upc/UPCNoCastExpressionParser.java | 987 ++++++++--------- .../upc/UPCNoCastExpressionParserprs.java | 144 ++- .../core/dom/parser/upc/UPCParser.java | 971 ++++++++--------- .../core/dom/parser/upc/UPCParserprs.java | 144 ++- .../parser/upc/UPCSizeofExpressionParser.java | 975 ++++++++--------- .../upc/UPCSizeofExpressionParserprs.java | 144 ++- .../upc/ast/UPCASTCompositeTypeSpecifier.java | 26 +- .../ast/UPCASTElaboratedTypeSpecifier.java | 28 +- .../upc/ast/UPCASTEnumerationSpecifier.java | 22 +- .../parser/upc/ast/UPCASTForallStatement.java | 32 +- .../upc/ast/UPCASTKeywordExpression.java | 23 +- .../parser/upc/ast/UPCASTLayoutQualifier.java | 32 +- .../upc/ast/UPCASTSimpleDeclSpecifier.java | 24 +- .../ast/UPCASTSynchronizationStatement.java | 26 +- .../upc/ast/UPCASTTypeIdSizeofExpression.java | 12 +- .../upc/ast/UPCASTTypedefNameSpecifier.java | 22 +- .../upc/ast/UPCASTUnarySizeofExpression.java | 10 +- 372 files changed, 13453 insertions(+), 10533 deletions(-) mode change 100755 => 100644 build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyCalculatorTests.java mode change 100755 => 100644 build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java mode change 100755 => 100644 build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java mode change 100755 => 100644 build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java mode change 100755 => 100644 build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3Commands.java mode change 100755 => 100644 build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuild.java mode change 100755 => 100644 build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuildCommands.java diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/CDataProviderTests.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/CDataProviderTests.java index 5fe246c8886..fe7753a8533 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/CDataProviderTests.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/CDataProviderTests.java @@ -38,27 +38,27 @@ public class CDataProviderTests extends TestCase { public static Test suite() { TestSuite suite = new TestSuite(CDataProviderTests.class); - + // // Add the relevant tests to the suite // suite.addTest(new StandardBuildTests("testProjectCreation")); // suite.addTest(new StandardBuildTests("testProjectSettings")); // suite.addTest(new StandardBuildTests("testProjectConversion")); // suite.addTest(new StandardBuildTests("testProjectCleanup")); -// +// // suite.addTestSuite(ScannerConfigConsoleParserTests.class); // suite.addTestSuite(ScannerConfigDiscoveryTests.class); - + return suite; } - + public void testCData() throws Exception { IProject project = createProject("a1"); ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project); assertNotNull("project description should not be null", projDes); - + ICConfigurationDescription cfgs[] = projDes.getConfigurations(); assertEquals(1, cfgs.length); - + int lssNum = cfgs[0].getRootFolderDescription().getLanguageSettings().length; int rcDessNum = cfgs[0].getResourceDescriptions().length; assertTrue(rcDessNum > 0); @@ -67,9 +67,9 @@ public class CDataProviderTests extends TestCase { assertEquals(2, projDes.getConfigurations().length); assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length); assertEquals(rcDessNum, cfg2.getResourceDescriptions().length); - + CCorePlugin.getDefault().setProjectDescription(project, projDes); - + projDes = CCorePlugin.getDefault().getProjectDescription(project); assertEquals(2, projDes.getConfigurations().length); cfgs = projDes.getConfigurations(); @@ -89,16 +89,16 @@ public class CDataProviderTests extends TestCase { assertEquals(2, projDes.getConfigurations().length); assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length); assertEquals(rcDessNum, cfg2.getResourceDescriptions().length); - + project.delete(false, true, new NullProgressMonitor()); - + project = ResourcesPlugin.getWorkspace().getRoot().getProject("a1"); project.create(new NullProgressMonitor()); project.open(new NullProgressMonitor()); - + projDes = CCorePlugin.getDefault().getProjectDescription(project); assertNotNull("project description should not be null", projDes); - + cfgs = projDes.getConfigurations(); assertEquals(2, cfgs.length); cfg2 = cfgs[0]; @@ -106,18 +106,19 @@ public class CDataProviderTests extends TestCase { assertEquals(2, projDes.getConfigurations().length); assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length); assertEquals(rcDessNum, cfg2.getResourceDescriptions().length); - + cfg2 = cfgs[1]; assertNotNull(cfg2); assertEquals(2, projDes.getConfigurations().length); assertEquals(lssNum, cfg2.getRootFolderDescription().getLanguageSettings().length); assertEquals(rcDessNum, cfg2.getResourceDescriptions().length); } - + private IProject createProject(final String name) throws CoreException { final Object[] result = new Object[1]; ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - + + @Override public void run(IProgressMonitor monitor) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject(name); @@ -132,7 +133,7 @@ public class CDataProviderTests extends TestCase { if (!project.isOpen()) { project.open(null); } - + description = project.getDescription(); // ICommand[] commands = description.getBuildSpec(); // for (int i = 0; i < commands.length; ++i) { @@ -152,6 +153,6 @@ public class CDataProviderTests extends TestCase { result[0] = project; } }, null); - return (IProject)result[0]; + return (IProject)result[0]; } } diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/StandardBuildTests.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/StandardBuildTests.java index c35167cf6f7..c5c20ec8d9e 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/StandardBuildTests.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/builder/tests/StandardBuildTests.java @@ -50,43 +50,43 @@ public class StandardBuildTests extends TestCase { public static Test suite() { TestSuite suite = new TestSuite(StandardBuildTests.class.getName()); - + // Add the relevant tests to the suite suite.addTest(new StandardBuildTests("testProjectCreation")); suite.addTest(new StandardBuildTests("testProjectSettings")); suite.addTest(new StandardBuildTests("testProjectConversion")); suite.addTest(new StandardBuildTests("testProjectCleanup")); - + return suite; } - + private void checkDefaultProjectSettings(IProject project) throws Exception { assertNotNull(project); IMakeBuilderInfo defaultInfo = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, true); - + IMakeBuilderInfo builderInfo = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID); // Check the rest of the project information assertEquals(defaultInfo.isDefaultBuildCmd(), builderInfo.isDefaultBuildCmd()); assertEquals(defaultInfo.isStopOnError(), builderInfo.isStopOnError()); assertEquals(defaultInfo.getBuildCommand(), builderInfo.getBuildCommand()); assertEquals(defaultInfo.getBuildArguments(), builderInfo.getBuildArguments()); - assertEquals(defaultInfo.getBuildLocation(), builderInfo.getBuildLocation()); + assertEquals(defaultInfo.getBuildLocation(), builderInfo.getBuildLocation()); - assertEquals(defaultInfo.isAutoBuildEnable(), builderInfo.isAutoBuildEnable()); - assertEquals(defaultInfo.getAutoBuildTarget(), builderInfo.getAutoBuildTarget()); - assertEquals(defaultInfo.isIncrementalBuildEnabled(), builderInfo.isIncrementalBuildEnabled()); - assertEquals(defaultInfo.getIncrementalBuildTarget(), builderInfo.getIncrementalBuildTarget()); - assertEquals(defaultInfo.isFullBuildEnabled(), builderInfo.isFullBuildEnabled()); + assertEquals(defaultInfo.isAutoBuildEnable(), builderInfo.isAutoBuildEnable()); + assertEquals(defaultInfo.getAutoBuildTarget(), builderInfo.getAutoBuildTarget()); + assertEquals(defaultInfo.isIncrementalBuildEnabled(), builderInfo.isIncrementalBuildEnabled()); + assertEquals(defaultInfo.getIncrementalBuildTarget(), builderInfo.getIncrementalBuildTarget()); + assertEquals(defaultInfo.isFullBuildEnabled(), builderInfo.isFullBuildEnabled()); assertEquals(defaultInfo.getFullBuildTarget(), builderInfo.getFullBuildTarget()); - assertEquals(defaultInfo.isCleanBuildEnabled(), builderInfo.isCleanBuildEnabled()); + assertEquals(defaultInfo.isCleanBuildEnabled(), builderInfo.isCleanBuildEnabled()); assertEquals(defaultInfo.getCleanBuildTarget(), builderInfo.getCleanBuildTarget()); - + } - + private void checkOverriddenProjectSettings(IProject project) throws Exception { assertNotNull(project); - + // Check the rest of the project information IMakeBuilderInfo builderInfo = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID); assertEquals(OFF, builderInfo.isDefaultBuildCmd()); @@ -97,17 +97,18 @@ public class StandardBuildTests extends TestCase { } /** - * Create a new project named name or return the project in + * Create a new project named name or return the project in * the workspace of the same name if it exists. - * + * * @param name The name of the project to create or retrieve. - * @return + * @return * @throws CoreException */ private IProject createProject(final String name) throws CoreException { final Object[] result = new Object[1]; ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - + + @Override public void run(IProgressMonitor monitor) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject(name); @@ -116,7 +117,7 @@ public class StandardBuildTests extends TestCase { } else { project.refreshLocal(IResource.DEPTH_INFINITE, null); } - + if (!project.isOpen()) { project.open(null); } @@ -124,13 +125,13 @@ public class StandardBuildTests extends TestCase { result[0] = project; } }, null); - return (IProject)result[0]; + return (IProject)result[0]; } /** - * Remove the IProject with the name specified in the argument from the + * Remove the IProject with the name specified in the argument from the * receiver's workspace. - * + * * @param name */ private void removeProject(String name) { @@ -161,10 +162,10 @@ public class StandardBuildTests extends TestCase { fail("StandardBuildTest testProjectConversion failed opening project: " + e.getLocalizedMessage()); } assertNotNull(project); - + // Check the settings (they should be the override values) checkOverriddenProjectSettings(project); - + // Now convert the project try { CCorePlugin.getDefault().convertProjectFromCtoCC(project, new NullProgressMonitor()); @@ -190,19 +191,19 @@ public class StandardBuildTests extends TestCase { } catch (CoreException e) { fail("StandardBuildTest testProjectConversion failed getting nature: " + e.getLocalizedMessage()); } - + // Nothing should have changed in the settings checkOverriddenProjectSettings(project); } /** - * + * */ public void testProjectCreation() throws Exception { // Create a new project IProject project = null; try { - project = createProject(PROJECT_NAME); + project = createProject(PROJECT_NAME); // Convert the new project to a standard make project MakeProjectNature.addNature(project, null); } catch (CoreException e) { @@ -225,7 +226,7 @@ public class StandardBuildTests extends TestCase { // Check the default settings checkDefaultProjectSettings(project); } - + public void testProjectSettings() throws Exception { // Get the project IProject project = null; @@ -235,7 +236,7 @@ public class StandardBuildTests extends TestCase { fail("StandardBuildTest testProjectSettings failed opening project: " + e.getLocalizedMessage()); } assertNotNull(project); - + // Use the build info for the rest of the settings IMakeBuilderInfo builderInfo = MakeCorePlugin.createBuildInfo(project, MakeBuilder.BUILDER_ID); builderInfo.setStopOnError(ON); @@ -253,7 +254,7 @@ public class StandardBuildTests extends TestCase { } catch (CoreException e) { fail ("StandardBuildTest testProjectSettings failed to open project " + e.getLocalizedMessage()); } - + // Retest checkOverriddenProjectSettings(project); } diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/MakefileReaderProviderTests.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/MakefileReaderProviderTests.java index 553d808c70b..888598ae09e 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/MakefileReaderProviderTests.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/MakefileReaderProviderTests.java @@ -54,7 +54,7 @@ public class MakefileReaderProviderTests extends TestCase { basePath + "incl" }; } - + public void testNoReaderProvider() throws Exception { IPath path = new Path("data/Makefile.main"); File file = getPluginRelativeFile(path); @@ -80,13 +80,14 @@ public class MakefileReaderProviderTests extends TestCase { public void testInputStreamReaderProvider() throws Exception { IPath path = new Path("Makefile.main"); - + // get base directory for searches final URL url = getPluginRelativeURL(new Path("data").addTrailingSeparator()); IMakefile makefile = MakeCorePlugin.createMakefile( URIUtil.toURI(path), true, inclDirs, new IMakefileReaderProvider() { + @Override public Reader getReader(URI fileURI) throws IOException { URL fileUrl; try { @@ -97,9 +98,9 @@ public class MakefileReaderProviderTests extends TestCase { InputStream is = fileUrl.openStream(); return new InputStreamReader(is); } - + }); - + assertMakefileContents(makefile); } @@ -108,36 +109,38 @@ public class MakefileReaderProviderTests extends TestCase { URIUtil.toURI("/memory/Makefile.main"), true, inclDirs, new IMakefileReaderProvider() { + @Override public Reader getReader(URI fileURI) throws IOException { - String name = new File(fileURI).getName(); + String name = new File(fileURI).getName(); if (name.equals("Makefile.main")) return new StringReader( - "VAR = foo\r\n" + - "\r\n" + - "include Makefile.incl\r\n" + - "\r\n" + - "main: $(VAR)\r\n" + + "VAR = foo\r\n" + + "\r\n" + + "include Makefile.incl\r\n" + + "\r\n" + + "main: $(VAR)\r\n" + " nothing\r\n"); if (name.equals("Makefile.incl")) return new StringReader( - "INCLVAR = bar\r\n" + - "\r\n" + - "foo.o: .PHONY\r\n" + "INCLVAR = bar\r\n" + + "\r\n" + + "foo.o: .PHONY\r\n" ); - + throw new FileNotFoundException(fileURI.getPath()); } - + }); - + assertMakefileContents(makefile); } - + public void testReaderIsClosed_Bug338936() throws Exception { final boolean[] streamIsClosed = { false }; MakeCorePlugin.createMakefile( URIUtil.toURI("Makefile.main"), true, inclDirs, new IMakefileReaderProvider() { + @Override public Reader getReader(URI fileURI) throws IOException { return new StringReader("") { @Override @@ -147,7 +150,7 @@ public class MakefileReaderProviderTests extends TestCase { } }; } - + }); assertTrue("Stream is not closed", streamIsClosed[0]); } @@ -162,14 +165,14 @@ public class MakefileReaderProviderTests extends TestCase { assertEquals(2, macroDefinitions.length); assertEquals("VAR", macroDefinitions[0].getName()); assertEquals("INCLVAR", macroDefinitions[1].getName()); - + IRule[] rules = makefile.getRules(); assertEquals(2, rules.length); assertEquals("main", rules[0].getTarget().toString()); assertEquals("foo.o", rules[1].getTarget().toString()); } - /** + /** * Try to get a file in the development version of a plugin -- * will return null for a jar-packaged plugin. * @param path @@ -183,11 +186,11 @@ public class MakefileReaderProviderTests extends TestCase { return new File(url.getPath()); return null; } - + private URL getPluginRelativeURL(IPath path) throws Exception { if (MakeTestsPlugin.getDefault() != null) { URL url = FileLocator.find( - MakeTestsPlugin.getDefault().getBundle(), + MakeTestsPlugin.getDefault().getBundle(), path, null); return url != null ? FileLocator.toFileURL(url) : null; } diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/StandardBuildTestHelper.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/StandardBuildTestHelper.java index d3bc57b6b61..072d7e838f9 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/StandardBuildTestHelper.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/core/tests/StandardBuildTestHelper.java @@ -33,22 +33,22 @@ import org.eclipse.core.runtime.Path; public class StandardBuildTestHelper { /* (non-Javadoc) - * Create a new project named name or return the project in + * Create a new project named name or return the project in * the workspace of the same name if it exists. - * + * * @param name The name of the project to create or retrieve. - * @return + * @return * @throws CoreException */ static public IProject createProject( - final String name, - final IPath location, - final String projectId) + final String name, + final IPath location, + final String projectId) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IProject newProjectHandle = root.getProject(name); IProject project = null; - + if (!newProjectHandle.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription workspaceDesc = workspace.getDescription(); @@ -60,19 +60,19 @@ public class StandardBuildTestHelper { } else { project = newProjectHandle; } - + // Open the project if we have to if (!project.isOpen()) { project.open(new NullProgressMonitor()); } - - return project; + + return project; } - + /** - * Remove the IProject with the name specified in the argument from the + * Remove the IProject with the name specified in the argument from the * receiver's workspace. - * + * * @param name */ static public void removeProject(String name) { @@ -81,6 +81,7 @@ public class StandardBuildTestHelper { if (project.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { System.gc(); System.runFinalization(); @@ -99,6 +100,7 @@ public class StandardBuildTestHelper { static public boolean compareBenchmarks(final IProject project, IPath testDir, IPath[] files) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { project.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -116,7 +118,7 @@ public class StandardBuildTestHelper { StringBuffer benchmarkBuffer = readContentsStripLineEnds(project, benchmarkFile); if (!testBuffer.toString().equals(benchmarkBuffer.toString())) { Assert.fail("File " + testFile.lastSegment() + " does not match its benchmark."); - } + } } return true; } @@ -124,6 +126,7 @@ public class StandardBuildTestHelper { static public boolean verifyFilesDoNotExist(final IProject project, IPath testDir, IPath[] files) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { project.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -141,7 +144,7 @@ public class StandardBuildTestHelper { if (fullPath.toFile().exists()) { Assert.fail("File " + testFile.lastSegment() + " unexpectedly found."); return false; - } + } } catch (Exception e) { Assert.fail("File " + fullPath.toString() + " could not be referenced."); } @@ -174,7 +177,7 @@ public class StandardBuildTestHelper { } return buff; } - + static public IPath copyFilesToTempDir(IPath srcDir, IPath tmpSubDir, IPath[] files) { IPath tmpSrcDir = null; String userDirStr = System.getProperty("user.home"); @@ -182,7 +185,7 @@ public class StandardBuildTestHelper { IPath userDir = Path.fromOSString(userDirStr); tmpSrcDir = userDir.append(tmpSubDir); if (userDir.toString().equalsIgnoreCase(tmpSrcDir.toString())) { - Assert.fail("Temporary sub-directory cannot be the empty string."); + Assert.fail("Temporary sub-directory cannot be the empty string."); } else { File tmpSrcDirFile = tmpSrcDir.toFile(); if (tmpSrcDirFile.exists()) { @@ -238,7 +241,7 @@ public class StandardBuildTestHelper { } return tmpSrcDir; } - + static public void deleteTempDir(IPath tmpSubDir, IPath[] files) { IPath tmpSrcDir = null; String userDirStr = System.getProperty("user.home"); @@ -246,11 +249,11 @@ public class StandardBuildTestHelper { IPath userDir = Path.fromOSString(userDirStr); tmpSrcDir = userDir.append(tmpSubDir); if (userDir.toString().equalsIgnoreCase(tmpSrcDir.toString())) { - Assert.fail("Temporary sub-directory cannot be the empty string."); + Assert.fail("Temporary sub-directory cannot be the empty string."); } else { File tmpSrcDirFile = tmpSrcDir.toFile(); if (!tmpSrcDirFile.exists()) { - Assert.fail("Temporary directory " + tmpSrcDirFile.toString() + " does not exist."); + Assert.fail("Temporary directory " + tmpSrcDirFile.toString() + " does not exist."); } else { for (int i=0; i cmds = fCollector.getCollectedScannerInfo(file1, ScannerInfoTypes.COMPILER_COMMAND); CCommandDSC cdsc= (CCommandDSC) cmds.get(0); List symbols= cdsc.getSymbols(); assertEquals(1, symbols.size()); assertEquals("TEST1=1", symbols.get(0).toString()); - + cmds = fCollector.getCollectedScannerInfo(file2, ScannerInfoTypes.COMPILER_COMMAND); cdsc= (CCommandDSC) cmds.get(0); symbols= cdsc.getSymbols(); diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/TestScannerInfoCollector.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/TestScannerInfoCollector.java index 7b4e4199087..9c0ac11d37b 100644 --- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/TestScannerInfoCollector.java +++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/TestScannerInfoCollector.java @@ -8,7 +8,7 @@ * Contributors: * Markus Schorn - initial API and implementation * Anton Leherbauer (Wind River Systems) - *******************************************************************************/ + *******************************************************************************/ package org.eclipse.cdt.make.scannerdiscovery; import java.util.ArrayList; @@ -27,7 +27,8 @@ import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC; final class TestScannerInfoCollector implements IScannerInfoCollector { private HashMap fInfoMap = new HashMap(); private HashMap> fResourceToInfoMap = new HashMap>(); - + + @Override public void contributeToScannerConfig(Object resource, Map scannerInfo0) { Map scannerInfo = scannerInfo0; Set> entrySet = scannerInfo.entrySet(); @@ -59,6 +60,7 @@ final class TestScannerInfoCollector implements IScannerInfoCollector { target.addAll(col); } + @Override public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { if (resource == null) { List result= fInfoMap.get(type); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java index eafa18288f9..df6f7d2ee5c 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CommandLauncher; @@ -126,6 +126,7 @@ public class MakeBuilder extends ACBuilder { try { ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) { invokeMake(CLEAN_BUILD, info, monitor); } @@ -170,7 +171,7 @@ public class MakeBuilder extends ACBuilder { if(pathFromURI == null) { throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, MakeMessages.getString("MakeBuilder.ErrorWorkingDirectory"), null)); //$NON-NLS-1$ } - + IPath workingDirectory = new Path(pathFromURI); String[] targets = getTargets(kind, info); @@ -288,7 +289,7 @@ public class MakeBuilder extends ACBuilder { /** * Refresh project. Can be overridden to not call actual refresh or to do something else. * Method is called after build is complete. - * + * * @since 6.0 */ protected void refreshProject(IProject project) { @@ -297,7 +298,7 @@ public class MakeBuilder extends ACBuilder { // to Eclipse, files may have been created/modified and we will be out-of-sync. // The caveat is for huge projects, it may take sometimes at every build. // project.refreshLocal(IResource.DEPTH_INFINITE, null); - + // use the refresh scope manager to refresh RefreshScopeManager refreshManager = RefreshScopeManager.getInstance(); IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java index 11c6ea3d6c4..92f34491ac5 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeCorePlugin.java @@ -60,7 +60,7 @@ import org.osgi.framework.BundleContext; /** * The main plugin class to be used in the desktop. - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -74,13 +74,14 @@ public class MakeCorePlugin extends Plugin { fEncoding = encoding != null ? encoding : ResourcesPlugin.getEncoding(); } + @Override public Reader getReader(URI fileURI) throws IOException { try { final IFileStore store = EFS.getStore(fileURI); final IFileInfo info = store.fetchInfo(); if (!info.exists() || info.isDirectory()) throw new IOException(); - + return new InputStreamReader(store.openInputStream(EFS.NONE, null), fEncoding); } catch (CoreException e) { MakeCorePlugin.log(e); @@ -88,7 +89,7 @@ public class MakeCorePlugin extends Plugin { } } } - + public static final String PLUGIN_ID = "org.eclipse.cdt.make.core"; //$NON-NLS-1$ public static final String MAKE_PROJECT_ID = MakeCorePlugin.getUniqueIdentifier() + ".make"; //$NON-NLS-1$ public static final String OLD_BUILDER_ID = "org.eclipse.cdt.core.cbuilder"; //$NON-NLS-1$ @@ -229,8 +230,8 @@ public class MakeCorePlugin extends Plugin { /** * 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 null for EFS IFileStore reading */ @@ -263,7 +264,7 @@ public class MakeCorePlugin extends Plugin { /** * Create an IMakefile using EFS to fetch contents. - * + * * @param fileURI URI of main file */ public static IMakefile createMakefile(URI fileURI, boolean isGnuStyle, String[] makefileDirs) { @@ -273,7 +274,7 @@ public class MakeCorePlugin extends Plugin { public IMakefile createMakefile(IFile file) throws CoreException { return createMakefile(EFS.getStore(file.getLocationURI()), isMakefileGNUStyle(), getMakefileDirs(), file.getCharset()); } - + @Override public void stop(BundleContext context) throws Exception { try { @@ -309,7 +310,7 @@ public class MakeCorePlugin extends Plugin { Map args, String builderID) { return ScannerConfigInfoFactory.create(args, builderID); } - + public static IPath getWorkingDirectory() { return MakeCorePlugin.getDefault().getStateLocation(); } @@ -337,7 +338,7 @@ public class MakeCorePlugin extends Plugin { IConfigurationElement[] configElements = extensions[i].getConfigurationElements(); for (int j = 0; j < configElements.length; j++) { IConfigurationElement[] runElement = configElements[j].getChildren("run"); //$NON-NLS-1$ - if (runElement.length > 0) { + if (runElement.length > 0) { IExternalScannerInfoProvider builder = (IExternalScannerInfoProvider) runElement[0].createExecutableExtension("class"); //$NON-NLS-1$ return builder; } @@ -345,7 +346,7 @@ public class MakeCorePlugin extends Plugin { } } } - } + } catch (CoreException e) { log(e); } @@ -372,13 +373,13 @@ public class MakeCorePlugin extends Plugin { if (id != null && (id.equals(commandId) || id.equals("all"))) { //$NON-NLS-1$ parserIds.add(parserId); } - } + } } return parserIds.toArray(empty); } return empty; } - + /** * @return parser - parser object identified by the parserId */ @@ -402,14 +403,14 @@ public class MakeCorePlugin extends Plugin { } return null; } - + /* (non-Javadoc) * @see org.eclipse.core.runtime.Plugin#startup() */ @Override public void start(BundleContext context) throws Exception { super.start(context); - + //Set debug tracing options configurePluginDebugOptions(); // Scanner config discovery setup @@ -418,7 +419,7 @@ public class MakeCorePlugin extends Plugin { private static final String SCANNER_CONFIG = MakeCorePlugin.getUniqueIdentifier() + "/debug/scdiscovery"; //$NON-NLS-1$ /** - * + * */ private void configurePluginDebugOptions() { if (isDebugging()) { diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeProjectNature.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeProjectNature.java index 6ba156a67eb..ffd1230fba9 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeProjectNature.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeProjectNature.java @@ -22,7 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor; * @noinstantiate This class is not intended to be instantiated by clients. */ public class MakeProjectNature implements IProjectNature { - + public final static String NATURE_ID = MakeCorePlugin.getUniqueIdentifier() + ".makeNature"; //$NON-NLS-1$ private IProject fProject; @@ -49,7 +49,7 @@ public class MakeProjectNature implements IProjectNature { } return null; } - + /** * Update the Java command in the build spec (replace existing one if present, * add one first if none). @@ -78,7 +78,7 @@ public class MakeProjectNature implements IProjectNature { // Commit the spec change into the project description.setBuildSpec(newCommands); return description; - } + } /** * Adds a builder to the build spec for the given project. @@ -130,6 +130,7 @@ public class MakeProjectNature implements IProjectNature { /** * @see IProjectNature#configure */ + @Override public void configure() throws CoreException { addBuildSpec(); IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(MakeCorePlugin.getDefault().getPluginPreferences(), MakeBuilder.BUILDER_ID, false); @@ -142,7 +143,7 @@ public class MakeProjectNature implements IProjectNature { projectInfo.setAutoBuildEnable(info.isAutoBuildEnable()); projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, "")); //$NON-NLS-1$ - + projectInfo.setIncrementalBuildEnable(info.isIncrementalBuildEnabled()); projectInfo.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, info.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, "")); //$NON-NLS-1$ @@ -163,6 +164,7 @@ public class MakeProjectNature implements IProjectNature { /** * @see IProjectNature#deconfigure */ + @Override public void deconfigure() throws CoreException { removeBuildSpec(); } @@ -170,6 +172,7 @@ public class MakeProjectNature implements IProjectNature { /** * @see IProjectNature#getProject */ + @Override public IProject getProject() { return fProject; } @@ -177,6 +180,7 @@ public class MakeProjectNature implements IProjectNature { /** * @see IProjectNature#setProject */ + @Override public void setProject(IProject project) { fProject = project; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerInfo.java index 1e607a55cb7..f024c515b06 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerInfo.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerInfo.java @@ -69,18 +69,20 @@ public class MakeScannerInfo implements IScannerInfo { } /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths() */ + @Override public synchronized String[] getIncludePaths() { return getPathList().toArray(new String[getPathList().size()]); } /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.core.build.managed.IScannerInfo#getIncludePaths() */ + @Override public synchronized Map getDefinedSymbols() { // Return the defined symbols for the default configuration HashMap symbols = new HashMap(); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerProvider.java index 20ae16a0a76..994334c3e5f 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerProvider.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeScannerProvider.java @@ -40,7 +40,7 @@ import org.w3c.dom.Element; /** * @deprecated @author DInglis - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -100,7 +100,7 @@ public class MakeScannerProvider extends ScannerProvider { /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.core.parser.IScannerInfoProvider#getScannerInformation(org.eclipse.core.resources.IResource) */ @Override @@ -116,7 +116,7 @@ public class MakeScannerProvider extends ScannerProvider { * Loads the build file and parses the nodes for build information. The information is then associated with the resource for the * duration of the session. */ - private MakeScannerInfo loadScannerInfo(IProject project) throws CoreException { + private MakeScannerInfo loadScannerInfo(IProject project) throws CoreException { ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project); ICStorageElement storage = descriptor.getProjectStorageElement(CDESCRIPTOR_ID); @@ -143,7 +143,7 @@ public class MakeScannerProvider extends ScannerProvider { ICProject cProject = CoreModel.getDefault().create(info.getProject()); IPathEntry[] entries = cProject.getRawPathEntries(); List cPaths = new ArrayList(Arrays.asList(entries)); - + Iterator cpIter = cPaths.iterator(); while(cpIter.hasNext()) { int kind = cpIter.next().getEntryKind(); @@ -187,7 +187,8 @@ public class MakeScannerProvider extends ScannerProvider { */ public static void updateScannerInfo(final MakeScannerInfo scannerInfo) throws CoreException { ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { - + + @Override public void run(IProgressMonitor monitor) throws CoreException { IProject project = scannerInfo.getProject(); @@ -202,6 +203,6 @@ public class MakeScannerProvider extends ScannerProvider { descriptor.saveProjectData(); migrateToCPathEntries(scannerInfo); } - }, null); + }, null); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IDirective.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IDirective.java index 85bfed8b3ff..5daec5a7926 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IDirective.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IDirective.java @@ -13,7 +13,7 @@ package org.eclipse.cdt.make.core.makefile; /** * A Makefile can contain rules, macro definitons and comments. * They are call directives. - * + * * @noextend This class is not intended to be subclassed by clients. * @noimplement This interface is not intended to be implemented by clients. */ @@ -38,10 +38,11 @@ public interface IDirective { /** * Returns the makefile where the directive was found. - * + * * @return IMakefile */ IMakefile getMakefile(); + @Override String toString(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITarget.java index 6eaed888db5..03326b0eef2 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITarget.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITarget.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.make.core.makefile; */ public interface ITarget { + @Override String toString(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfo.java index bc64ca11db7..b87bcd15475 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfo.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/DiscoveredScannerInfo.java @@ -26,7 +26,7 @@ import org.eclipse.core.runtime.CoreException; * Discovered portion of scanner configuration * @deprecated as of CDT 4.0. * @author vhirsl - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -38,16 +38,16 @@ public class DiscoveredScannerInfo implements IScannerInfo { private ArrayList activePaths; private ArrayList removedPaths; - + private ArrayList activeSymbols; private ArrayList removedSymbols; private org.eclipse.cdt.make.core.MakeScannerInfo userInfo; - + public DiscoveredScannerInfo(IProject project) { this.project = project; } - + public IProject getProject() { return project; } @@ -55,6 +55,7 @@ public class DiscoveredScannerInfo implements IScannerInfo { /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.IScannerInfo#getDefinedSymbols() */ + @Override public synchronized Map getDefinedSymbols() { Map dSymbols = ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols); dSymbols.putAll(userInfo.getDefinedSymbols()); @@ -63,6 +64,7 @@ public class DiscoveredScannerInfo implements IScannerInfo { /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.IScannerInfo#getIncludePaths() */ + @Override public synchronized String[] getIncludePaths() { String[] iPaths = new String[getUserIncludePaths().length + getActiveIncludePaths().length]; System.arraycopy(getUserIncludePaths(), 0, iPaths, 0, getUserIncludePaths().length); @@ -77,7 +79,7 @@ public class DiscoveredScannerInfo implements IScannerInfo { public synchronized void setUserScannerInfo( org.eclipse.cdt.make.core.MakeScannerInfo info) { userInfo = info; } - + public LinkedHashMap getDiscoveredIncludePaths() { if (discoveredPaths == null) { return new LinkedHashMap(); @@ -88,7 +90,7 @@ public class DiscoveredScannerInfo implements IScannerInfo { discoveredPaths = new LinkedHashMap(paths); createPathLists(); } - + /** * Populates active and removed include path lists */ @@ -97,7 +99,7 @@ public class DiscoveredScannerInfo implements IScannerInfo { aPaths.clear(); List rPaths = getRemovedPathList(); rPaths.clear(); - + Set paths = discoveredPaths.keySet(); for (String path : paths) { Boolean removed = discoveredPaths.get(path); @@ -120,7 +122,7 @@ public class DiscoveredScannerInfo implements IScannerInfo { discoveredSymbols = new LinkedHashMap(symbols); createSymbolsLists(); } - + /** * Populates active and removed defined symbols sets */ @@ -129,7 +131,7 @@ public class DiscoveredScannerInfo implements IScannerInfo { aSymbols.clear(); List rSymbols = getRemovedSymbolsList(); rSymbols.clear(); - + aSymbols.addAll(ScannerConfigUtil.scSymbolsSymbolEntryMap2List(discoveredSymbols, true)); rSymbols.addAll(ScannerConfigUtil.scSymbolsSymbolEntryMap2List(discoveredSymbols, false)); } @@ -141,12 +143,12 @@ public class DiscoveredScannerInfo implements IScannerInfo { return userInfo.getIncludePaths(); } public String[] getActiveIncludePaths() { - return getActivePathList().toArray(new String[getActivePathList().size()]); + return getActivePathList().toArray(new String[getActivePathList().size()]); } public String[] getRemovedIncludePaths() { return getRemovedPathList().toArray(new String[getRemovedPathList().size()]); } - + public String[] getUserSymbolDefinitions() { if (userInfo == null) { return new String[0]; @@ -154,10 +156,10 @@ public class DiscoveredScannerInfo implements IScannerInfo { return userInfo.getPreprocessorSymbols(); } public String[] getActiveSymbolDefinitions() { - return getActiveSymbolsList().toArray(new String[getActiveSymbolsList().size()]); + return getActiveSymbolsList().toArray(new String[getActiveSymbolsList().size()]); } public String[] getRemovedSymbolDefinitions() { - return getRemovedSymbolsList().toArray(new String[getRemovedSymbolsList().size()]); + return getRemovedSymbolsList().toArray(new String[getRemovedSymbolsList().size()]); } public String[] getPreprocessorSymbols() { // user specified + active @@ -168,7 +170,7 @@ public class DiscoveredScannerInfo implements IScannerInfo { System.arraycopy(discActiveSymbols, 0, rv, userSymbols.length, discActiveSymbols.length); return rv; } - + private List getActivePathList() { if (activePaths == null) { activePaths = new ArrayList(); @@ -189,14 +191,14 @@ public class DiscoveredScannerInfo implements IScannerInfo { } return activeSymbols; } - + private List getRemovedSymbolsList() { if (removedSymbols == null) { removedSymbols = new ArrayList(); } return removedSymbols; } - + public void update() throws CoreException { DiscoveredScannerInfoProvider.updateScannerInfo(this); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigNature.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigNature.java index b278f7e3ed0..3b9e0512a83 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigNature.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerConfigNature.java @@ -30,21 +30,22 @@ import org.eclipse.core.runtime.CoreException; /** * @deprecated as of CDT 4.0. Used by legacy CDT 3.X projects. * Replaced by ScannerConfigNature in org.eclipse.cdt.managedbuilder.core. - * + * * @see IProjectNature - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @Deprecated public class ScannerConfigNature implements IProjectNature { - + public final static String NATURE_ID = MakeCorePlugin.getUniqueIdentifier() + ".ScannerConfigNature"; //$NON-NLS-1$ private IProject fProject; /** * @see IProjectNature#configure */ + @Override public void configure() throws CoreException { IProjectDescription description = getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); @@ -60,13 +61,14 @@ public class ScannerConfigNature implements IProjectNature { newCommands[commands.length] = command; description.setBuildSpec(newCommands); getProject().setDescription(description, null); - + // set default project scanner config settings } /** * @see IProjectNature#deconfigure */ + @Override public void deconfigure() throws CoreException { IProjectDescription description = getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); @@ -85,6 +87,7 @@ public class ScannerConfigNature implements IProjectNature { /** * @see IProjectNature#getProject */ + @Override public IProject getProject() { return fProject; } @@ -92,10 +95,11 @@ public class ScannerConfigNature implements IProjectNature { /** * @see IProjectNature#setProject */ + @Override public void setProject(IProject project) { fProject = project; } - + public static void addScannerConfigNature(IProject project) throws CoreException { IProjectDescription description = project.getDescription(); if (description.hasNature(NATURE_ID)) @@ -106,9 +110,9 @@ public class ScannerConfigNature implements IProjectNature { newIds[ids.length] = NATURE_ID; description.setNatureIds(newIds); project.setDescription(description, null); - + } - + public static void removeScannerConfigNature(IProject project) throws CoreException { IProjectDescription description = project.getDescription(); if (!description.hasNature(NATURE_ID)) @@ -152,7 +156,7 @@ public class ScannerConfigNature implements IProjectNature { newCommands = new ICommand[oldCommands.length + 1]; System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length); newCommands[oldCommands.length] = newCommand; - } + } else { for (int i = 0; i < oldCommands.length; i++) { if (oldCommands[i] == oldCommand) { @@ -175,19 +179,19 @@ public class ScannerConfigNature implements IProjectNature { String selectedProfile = scPrefInfo.getSelectedProfileId(); IScannerConfigBuilderInfo2 scProjInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2( project, selectedProfile); - + scProjInfo.setAutoDiscoveryEnabled(scPrefInfo.isAutoDiscoveryEnabled()); scProjInfo.setProblemReportingEnabled(scPrefInfo.isProblemReportingEnabled()); - + scProjInfo.setBuildOutputParserEnabled(scPrefInfo.isBuildOutputParserEnabled()); scProjInfo.setBuildOutputFileActionEnabled(scPrefInfo.isBuildOutputFileActionEnabled()); scProjInfo.setBuildOutputFilePath(scPrefInfo.getBuildOutputFilePath()); - + ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(selectedProfile); List providerIdList = scPrefInfo.getProviderIdList(); for (Iterator i = providerIdList.iterator(); i.hasNext();) { String providerId = i.next(); - + scProjInfo.setProviderOutputParserEnabled(providerId, scPrefInfo.isProviderOutputParserEnabled(providerId)); if (profile.getScannerInfoProviderElement(providerId).getProviderKind().equals( ScannerConfigProfile.ScannerInfoProvider.RUN)) { @@ -199,7 +203,7 @@ public class ScannerConfigNature implements IProjectNature { } } scProjInfo.save(); - + // the last step is to add discovered paths container ICProject cProject = CoreModel.getDefault().create(project); IPathEntry[] rawPathEntries = CoreModel.getRawPathEntries(cProject); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java index 1f619688c78..10bbd648e88 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java @@ -57,14 +57,16 @@ public class BuildInfoFactory { static final String BUILD_AUTO_ENABLED = PREFIX + ".enableAutoBuild"; //$NON-NLS-1$ static final String BUILD_ARGUMENTS = PREFIX + ".buildArguments"; //$NON-NLS-1$ static final String ENVIRONMENT = PREFIX + ".environment"; //$NON-NLS-1$ - static final String BUILD_APPEND_ENVIRONMENT = PREFIX + ".append_environment"; //$NON-NLS-1$ + static final String BUILD_APPEND_ENVIRONMENT = PREFIX + ".append_environment"; //$NON-NLS-1$ private abstract static class AbstractBuildInfo implements IMakeBuilderInfo { + @Override public void setUseDefaultBuildCmd(boolean on) throws CoreException { putString(USE_DEFAULT_BUILD_CMD, new Boolean(on).toString()); } + @Override public boolean isDefaultBuildCmd() { if (getString(USE_DEFAULT_BUILD_CMD) == null) { // if no property // then default to @@ -74,6 +76,7 @@ public class BuildInfoFactory { return getBoolean(USE_DEFAULT_BUILD_CMD); } + @Override public String getBuildAttribute(String name, String defaultValue) { String value = getString(name); if (value == null ) { @@ -89,15 +92,17 @@ public class BuildInfoFactory { value = getString(BuildInfoFactory.BUILD_TARGET_CLEAN); } else if (IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL.equals(name)) { value = getString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL); - } - } + } + } return value != null ? value : defaultValue != null ? defaultValue : ""; //$NON-NLS-1$ } + @Override public void setBuildAttribute(String name, String value) throws CoreException { putString(name, value); } + @Override public Map getExpandedEnvironment() { Map env = getEnvironment(); HashMap envMap = new HashMap(env.entrySet().size()); @@ -121,11 +126,13 @@ public class BuildInfoFactory { return envMap; } + @Override public void setBuildCommand(IPath location) throws CoreException { putString(IMakeCommonBuildInfo.BUILD_COMMAND, null); putString(BuildInfoFactory.BUILD_COMMAND, location.toString()); } + @Override public IPath getBuildCommand() { if (isDefaultBuildCmd()) { String command = getBuildParameter("defaultCommand"); //$NON-NLS-1$ @@ -163,11 +170,13 @@ public class BuildInfoFactory { protected abstract String getBuilderID(); + @Override public void setBuildLocation(IPath location) throws CoreException { putString(IMakeCommonBuildInfo.BUILD_LOCATION, null); putString(BuildInfoFactory.BUILD_LOCATION, location.toString()); } + @Override public IPath getBuildLocation() { String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION, getString(BuildInfoFactory.BUILD_LOCATION)); try { @@ -177,6 +186,7 @@ public class BuildInfoFactory { return new Path(result); } + @Override public String getBuildArguments() { String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, getString(BuildInfoFactory.BUILD_ARGUMENTS)); if (result == null) { @@ -189,24 +199,29 @@ public class BuildInfoFactory { return result; } + @Override public void setBuildArguments(String args) throws CoreException { putString(IMakeCommonBuildInfo.BUILD_ARGUMENTS, null); putString(BuildInfoFactory.BUILD_ARGUMENTS, args); } - + + @Override public void setStopOnError(boolean enabled) throws CoreException { putString(STOP_ON_ERROR, new Boolean(enabled).toString()); } + @Override public boolean isStopOnError() { return getBoolean(STOP_ON_ERROR); } + @Override public void setAutoBuildTarget(String target) throws CoreException { putString(IMakeBuilderInfo.BUILD_TARGET_AUTO, null); putString(BuildInfoFactory.BUILD_TARGET_AUTO, target); } + @Override public String getAutoBuildTarget() { String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, getString(BuildInfoFactory.BUILD_TARGET_AUTO)); try { @@ -216,11 +231,13 @@ public class BuildInfoFactory { return result; } + @Override public void setIncrementalBuildTarget(String target) throws CoreException { putString(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, null); putString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL, target); } + @Override public String getIncrementalBuildTarget() { String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, getString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL)); @@ -231,10 +248,12 @@ public class BuildInfoFactory { return result; } + @Override public void setFullBuildTarget(String target) throws CoreException { - + } + @Override public String getFullBuildTarget() { String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, getString(BuildInfoFactory.BUILD_TARGET_INCREMENTAL)); try { @@ -244,11 +263,13 @@ public class BuildInfoFactory { return result; } + @Override public void setCleanBuildTarget(String target) throws CoreException { putString(IMakeBuilderInfo.BUILD_TARGET_CLEAN, null); putString(BuildInfoFactory.BUILD_TARGET_CLEAN, target); } + @Override public String getCleanBuildTarget() { String result = getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, getString(BuildInfoFactory.BUILD_TARGET_CLEAN)); try { @@ -258,38 +279,47 @@ public class BuildInfoFactory { return result; } + @Override public void setAutoBuildEnable(boolean enabled) throws CoreException { putString(BUILD_AUTO_ENABLED, new Boolean(enabled).toString()); } + @Override public boolean isAutoBuildEnable() { return getBoolean(BUILD_AUTO_ENABLED); } + @Override public void setIncrementalBuildEnable(boolean enabled) throws CoreException { putString(BUILD_INCREMENTAL_ENABLED, new Boolean(enabled).toString()); } + @Override public boolean isIncrementalBuildEnabled() { return getBoolean(BUILD_INCREMENTAL_ENABLED); } + @Override public void setFullBuildEnable(boolean enabled) throws CoreException { putString(BUILD_FULL_ENABLED, new Boolean(enabled).toString()); } + @Override public boolean isFullBuildEnabled() { return getBoolean(BUILD_FULL_ENABLED); } + @Override public void setCleanBuildEnable(boolean enabled) throws CoreException { putString(BUILD_CLEAN_ENABLED, new Boolean(enabled).toString()); } + @Override public boolean isCleanBuildEnabled() { return getBoolean(BUILD_CLEAN_ENABLED); } + @Override public String[] getErrorParsers() { String parsers = getString(ErrorParserManager.PREF_ERROR_PARSER); if (parsers != null && parsers.length() > 0) { @@ -303,6 +333,7 @@ public class BuildInfoFactory { return new String[0]; } + @Override public void setErrorParsers(String[] parsers) throws CoreException { StringBuffer buf = new StringBuffer(); for (int i = 0; i < parsers.length; i++) { @@ -311,14 +342,17 @@ public class BuildInfoFactory { putString(ErrorParserManager.PREF_ERROR_PARSER, buf.toString()); } + @Override public Map getEnvironment() { return decodeMap(getString(ENVIRONMENT)); } + @Override public void setEnvironment(Map env) throws CoreException { putString(ENVIRONMENT, encodeMap(env)); } + @Override public boolean appendEnvironment() { if (getString(BUILD_APPEND_ENVIRONMENT) != null) { return getBoolean(BUILD_APPEND_ENVIRONMENT); @@ -326,6 +360,7 @@ public class BuildInfoFactory { return true; } + @Override public void setAppendEnvironment(boolean append) throws CoreException { putString(BUILD_APPEND_ENVIRONMENT, new Boolean(append).toString()); } @@ -345,7 +380,7 @@ public class BuildInfoFactory { int ndx = 0; while (ndx < envStr.length()) { if (escapeChars.indexOf(envStr.charAt(ndx)) != -1) { - if (envStr.charAt(ndx - 1) == escapeChar) { + if (envStr.charAt(ndx - 1) == escapeChar) { // escaped '|' - remove '\' and continue on. envStr.deleteCharAt(ndx - 1); if (ndx == envStr.length()) { diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeProject.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeProject.java index bd3bf982585..f2b18f1e76b 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeProject.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeProject.java @@ -26,6 +26,7 @@ import org.eclipse.core.runtime.Preferences; @Deprecated public class MakeProject implements ICOwner { + @Override public void configure(ICDescriptor cDescriptor) throws CoreException { cDescriptor.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID); cDescriptor.remove(CCorePlugin.BUILDER_MODEL_ID); @@ -33,6 +34,7 @@ public class MakeProject implements ICOwner { updateIndexers(cDescriptor); } + @Override public void update(ICDescriptor cDescriptor, String extensionID) throws CoreException { if (extensionID.equals(CCorePlugin.BINARY_PARSER_UNIQ_ID)) { updateBinaryParsers(cDescriptor); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java index d1c4db44c26..21bcd8f9e3f 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java @@ -63,14 +63,17 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { isStopOnError = info.isStopOnError(); } + @Override public IProject getProject() { return project; } + @Override public void setContainer(IContainer container) { this.container = container; } + @Override public void setName(String name) { this.name = name; } @@ -79,32 +82,39 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { return targetAttributes; } + @Override public String getName() { return name; } + @Override public String getTargetBuilderID() { return targetBuilderID; } + @Override public boolean isStopOnError() { return isStopOnError; } + @Override public void setStopOnError(boolean stopOnError) throws CoreException { isStopOnError = stopOnError; manager.updateTarget(this); } + @Override public boolean isDefaultBuildCmd() { return isDefaultBuildCmd; } + @Override public void setUseDefaultBuildCmd(boolean useDefault) throws CoreException { isDefaultBuildCmd = useDefault; manager.updateTarget(this); } + @Override public IPath getBuildCommand() { if (isDefaultBuildCmd()) { IMakeBuilderInfo info; @@ -122,10 +132,12 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { return new Path(result); } + @Override public void setBuildCommand(IPath command) throws CoreException { setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, command.toString()); } + @Override public String getBuildArguments() { if (isDefaultBuildCmd()) { IMakeBuilderInfo info; @@ -134,7 +146,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { return info.getBuildArguments(); } catch (CoreException e) { } - } + } String result = getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, ""); //$NON-NLS-1$ try { result = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(result, false); @@ -143,14 +155,17 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { return result; } + @Override public void setBuildArguments(String arguments) throws CoreException { setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, arguments); } + @Override public void setBuildTarget(String target) throws CoreException { setBuildAttribute(IMakeTarget.BUILD_TARGET, target); } + @Override public String getBuildTarget() { String result = getBuildAttribute(IMakeTarget.BUILD_TARGET, ""); //$NON-NLS-1$ try { @@ -160,33 +175,40 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { return result; } + @Override public void setRunAllBuilders(boolean runAllBuilders) throws CoreException { this.runAllBuidlers = runAllBuilders; manager.updateTarget(this); } + @Override public boolean runAllBuilders() { return runAllBuidlers; } + @Override public void setBuildAttribute(String name, String value) throws CoreException { targetAttributes.put(name, value); manager.updateTarget(this); } + @Override public String getBuildAttribute(String name, String defaultValue) { String value = targetAttributes.get(name); return value != null ? value : defaultValue; } + @Override public IPath getBuildLocation() { return container.getLocation(); } + @Override public void setBuildLocation(IPath location) throws CoreException { throw new UnsupportedOperationException(); } + @Override public String[] getErrorParsers() { IMakeBuilderInfo projectInfo; try { @@ -197,10 +219,12 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { return new String[0]; } + @Override public void setErrorParsers(String[] parsers) throws CoreException { throw new UnsupportedOperationException(); } + @Override public Map getExpandedEnvironment() throws CoreException { Map env = null; if (appendProjectEnvironment()) { @@ -232,28 +256,34 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { return envMap; } + @Override public boolean appendProjectEnvironment() { return appendProjectEnvironment; } + @Override public void setAppendProjectEnvironment(boolean append) { appendProjectEnvironment = append; } + @Override public Map getEnvironment() { return buildEnvironment; } + @Override public void setEnvironment(Map env) throws CoreException { buildEnvironment = new HashMap(env); manager.updateTarget(this); } + @Override public void setAppendEnvironment(boolean append) throws CoreException { appendEnvironment = append ? 1 : 0; manager.updateTarget(this); } + @Override public boolean appendEnvironment() { return appendEnvironment == USE_PROJECT_ENV_SETTING ? getProjectEnvSetting(): appendEnvironment == 1; } @@ -268,6 +298,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { return false; } + @Override public IContainer getContainer() { return container; } @@ -288,6 +319,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { return container.hashCode() * 17 + name != null ? name.hashCode(): 0; } + @Override public void build(IProgressMonitor monitor) throws CoreException { final String builderID = manager.getBuilderID(targetBuilderID); final HashMap infoMap = new HashMap(); @@ -314,6 +346,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget { * * @see org.eclipse.core.resources.IWorkspaceRunnable#run(org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void run(IProgressMonitor monitor) throws CoreException { if (runAllBuidlers) { ICommand[] commands = project.getDescription().getBuildSpec(); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java index 2684e9aa86d..9772046fb9e 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTargetManager.java @@ -14,8 +14,8 @@ package org.eclipse.cdt.make.internal.core; import java.io.File; import java.util.HashMap; import java.util.Map; -import java.util.Vector; import java.util.Map.Entry; +import java.util.Vector; import org.eclipse.cdt.make.core.IMakeTarget; import org.eclipse.cdt.make.core.IMakeTargetListener; @@ -55,14 +55,17 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis public MakeTargetManager() { } + @Override public IMakeTarget createTarget(IProject project, String name, String targetBuilderID) throws CoreException { return new MakeTarget(this, project, targetBuilderID, name); } + @Override public void addTarget(IMakeTarget target) throws CoreException { addTarget(null, target); } + @Override public void addTarget(IContainer container, IMakeTarget target) throws CoreException { if (container instanceof IWorkspaceRoot) { throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$ @@ -82,6 +85,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_ADD, target)); } + @Override public void setTargets(IContainer container, IMakeTarget[] targets) throws CoreException { if (container instanceof IWorkspaceRoot) { throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("MakeTargetManager.add_to_workspace_root"), null)); //$NON-NLS-1$ @@ -104,6 +108,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis notifyListeners(new MakeTargetEvent(this, MakeTargetEvent.TARGET_ADD, targets[0])); } + @Override public boolean targetExists(IMakeTarget target) { ProjectTargets projectTargets = projectMap.get(target.getProject()); if (projectTargets == null) { @@ -112,6 +117,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis return projectTargets.contains(target); } + @Override public void removeTarget(IMakeTarget target) throws CoreException { ProjectTargets projectTargets = projectMap.get(target.getProject()); if (projectTargets == null) { @@ -128,6 +134,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis } } + @Override public void renameTarget(IMakeTarget target, String name) throws CoreException { IMakeTarget makeTarget = target; @@ -142,6 +149,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis } } + @Override public IMakeTarget[] getTargets(IContainer container) throws CoreException { ProjectTargets projectTargets = projectMap.get(container.getProject()); if (projectTargets == null) { @@ -150,6 +158,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis return projectTargets.get(container); } + @Override public IMakeTarget findTarget(IContainer container, String name) throws CoreException { ProjectTargets projectTargets = projectMap.get(container.getProject()); if (projectTargets == null) { @@ -158,10 +167,12 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis return projectTargets.findTarget(container, name); } + @Override public IProject[] getTargetBuilderProjects() { return fProjects.toArray(new IProject[fProjects.size()]); } + @Override public String[] getTargetBuilders(IProject project) { if (fProjects.contains(project) || hasTargetBuilder(project)) { try { @@ -182,6 +193,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis return new String[0]; } + @Override public boolean hasTargetBuilder(IProject project) { try { if (project.isAccessible()) { @@ -213,6 +225,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); } + @Override public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); if (delta != null) { @@ -228,6 +241,7 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis /** * @see IResourceDeltaVisitor#visit(IResourceDelta) */ + @Override public boolean visit(IResourceDelta delta) { if (delta == null) { return false; @@ -330,14 +344,17 @@ public class MakeTargetManager implements IMakeTargetManager, IResourceChangeLis } } + @Override public void addListener(IMakeTargetListener listener) { listeners.add(listener); } + @Override public void removeListener(IMakeTargetListener listener) { listeners.remove(listeners); } + @Override public String getBuilderID(String targetBuilderID) { return builderMap.get(targetBuilderID); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/ConfigSupportNature.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/ConfigSupportNature.java index e9ba40b7edb..23d0afe16e4 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/ConfigSupportNature.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/dataprovider/ConfigSupportNature.java @@ -17,16 +17,20 @@ import org.eclipse.core.runtime.CoreException; public class ConfigSupportNature implements IProjectNature { private IProject fProject; + @Override public void configure() throws CoreException { } + @Override public void deconfigure() throws CoreException { } + @Override public IProject getProject() { return fProject; } + @Override public void setProject(IProject project) { fProject = project; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java index 3c578338e8d..1f9b83a62c1 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/AbstractMakefile.java @@ -26,15 +26,15 @@ import org.eclipse.cdt.make.core.makefile.ITargetRule; * statement : rule | macro_definition | comments | empty * rule : inference_rule | target_rule * inference_rule : target ':' ( command ) + - * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] + * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] [ ( command ) * ] - * macro_definition : string '=' (string)* + * macro_definition : string '=' (string)* * comments : ('#' (string) ) * * empty : * command : prefix_command string * target : string * prefix_command : '-' | '@' | '+' - * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" + * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" */ public abstract class AbstractMakefile extends Parent implements IMakefile { @@ -45,8 +45,10 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { super(parent); } + @Override public abstract IDirective[] getBuiltins(); + @Override public IRule[] getRules() { IDirective[] stmts = getDirectives(true); List array = new ArrayList(stmts.length); @@ -58,6 +60,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new IRule[0]); } + @Override public IRule[] getRules(String target) { IRule[] rules = getRules(); List array = new ArrayList(rules.length); @@ -69,6 +72,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new IRule[0]); } + @Override public IInferenceRule[] getInferenceRules() { IRule[] rules = getRules(); List array = new ArrayList(rules.length); @@ -80,6 +84,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new IInferenceRule[0]); } + @Override public IInferenceRule[] getInferenceRules(String target) { IInferenceRule[] irules = getInferenceRules(); List array = new ArrayList(irules.length); @@ -91,6 +96,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new IInferenceRule[0]); } + @Override public ITargetRule[] getTargetRules() { IRule[] trules = getRules(); List array = new ArrayList(trules.length); @@ -102,6 +108,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new ITargetRule[0]); } + @Override public ITargetRule[] getTargetRules(String target) { ITargetRule[] trules = getTargetRules(); List array = new ArrayList(trules.length); @@ -113,6 +120,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new ITargetRule[0]); } + @Override public IMacroDefinition[] getMacroDefinitions() { IDirective[] stmts = getDirectives(true); List array = new ArrayList(stmts.length); @@ -124,6 +132,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new IMacroDefinition[0]); } + @Override public IMacroDefinition[] getMacroDefinitions(String name) { IMacroDefinition[] variables = getMacroDefinitions(); List array = new ArrayList(variables.length); @@ -135,6 +144,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new IMacroDefinition[0]); } + @Override public IMacroDefinition[] getBuiltinMacroDefinitions() { IDirective[] stmts = getBuiltins(); List array = new ArrayList(stmts.length); @@ -146,6 +156,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new IMacroDefinition[0]); } + @Override public IMacroDefinition[] getBuiltinMacroDefinitions(String name) { IMacroDefinition[] variables = getBuiltinMacroDefinitions(); List array = new ArrayList(variables.length); @@ -179,10 +190,12 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return array.toArray(new IInferenceRule[0]); } + @Override public String expandString(String line) { return expandString(line, false); } + @Override public String expandString(String line, boolean recursive) { int len = line.length(); boolean foundDollar = false; @@ -264,14 +277,15 @@ public abstract class AbstractMakefile extends Parent implements IMakefile { return buffer.toString(); } + @Override public URI getFileURI() { return filename; } - + public void setFileURI(URI filename) { this.filename = filename; } - + @Override public IMakefile getMakefile() { return this; diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Command.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Command.java index 5d22944456c..f15e0250977 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Command.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Command.java @@ -17,7 +17,7 @@ import org.eclipse.cdt.make.core.makefile.ICommand; /** * Makefile : ( statement ) * - * statement : command | .. + * statement : command | .. * command : prefix_command string * prefix_command : '-' | '@' | '+' */ @@ -39,6 +39,7 @@ public class Command extends Directive implements ICommand { * target as a prerequisite or has no prerequisites, any error * found while executing the command will be ignored. */ + @Override public boolean shouldIgnoreError() { // Check for the prefix hyphen in the command. if (getPrefix() == HYPHEN) { @@ -54,6 +55,7 @@ public class Command extends Directive implements ICommand { * target as a prerequisite or has no prerequisites, the command * will not be written to standard output before it is executed. */ + @Override public boolean shouldBeSilent() { // Check for the prefix at sign if (getPrefix() == AT) { @@ -67,6 +69,7 @@ public class Command extends Directive implements ICommand { * command line that will be executed even if -n, -q or -t is * specified. */ + @Override public boolean shouldExecute() { // Check for the prefix at sign if (getPrefix() == PLUS) { @@ -108,6 +111,7 @@ public class Command extends Directive implements ICommand { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.ICommand#execute(java.lang.String[], java.io.File) */ + @Override public Process execute(String shell, String[] envp, File dir) throws IOException { String[] cmdArray = new String[] { shell, "-c", command}; //$NON-NLS-1$ return Runtime.getRuntime().exec(cmdArray, envp, dir); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Directive.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Directive.java index f5f7ea0b0b0..a8983abc964 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Directive.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Directive.java @@ -33,6 +33,7 @@ public abstract class Directive implements IDirective { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IDirective#getEndLine() */ + @Override public int getEndLine() { return endLine; } @@ -40,6 +41,7 @@ public abstract class Directive implements IDirective { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IDirective#getStartLine() */ + @Override public int getStartLine() { return startLine; } @@ -47,6 +49,7 @@ public abstract class Directive implements IDirective { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IDirective#getParent() */ + @Override public IDirective getParent() { return parent; } @@ -54,6 +57,7 @@ public abstract class Directive implements IDirective { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IDirective#getMakefile() */ + @Override public IMakefile getMakefile() { return parent.getMakefile(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MacroDefinition.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MacroDefinition.java index f211c34b475..5ac3b6f2eed 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MacroDefinition.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MacroDefinition.java @@ -29,6 +29,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition { value = v; } + @Override public String getName() { return name; } @@ -37,6 +38,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition { name = (n == null) ? "" : n.trim() ; //$NON-NLS-1$ } + @Override public StringBuffer getValue() { return value; } @@ -78,6 +80,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromCommand() */ + @Override public boolean isFromCommand() { return fromCommand; } @@ -85,6 +88,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromDefault() */ + @Override public boolean isFromDefault() { return fromDefault; } @@ -92,6 +96,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromEnviroment() */ + @Override public boolean isFromEnviroment() { return fromEnvironment; } @@ -99,6 +104,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromEnviroment() */ + @Override public boolean isFromEnvironmentOverride() { return fromEnvironmentOverride; } @@ -106,6 +112,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMacroDefinition#isFromMakefile() */ + @Override public boolean isFromMakefile() { return fromMakefile; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/NullMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/NullMakefile.java index dbe0a139aca..cdec17a21b2 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/NullMakefile.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/NullMakefile.java @@ -22,15 +22,15 @@ import org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider; * statement : rule | macro_definition | comments | empty * rule : inference_rule | target_rule * inference_rule : target ':' ( command ) + - * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] + * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] [ ( command ) * ] - * macro_definition : string '=' (string)* + * macro_definition : string '=' (string)* * comments : ('#' (string) ) * * empty : * command : prefix_command string * target : string * prefix_command : '-' | '@' | '+' - * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" + * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" */ public class NullMakefile extends AbstractMakefile { @@ -62,12 +62,14 @@ public class NullMakefile extends AbstractMakefile { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.io.Reader) */ + @Override public void parse(String name, Reader makefile) throws IOException { } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMakefile#getMakefileReaderProvider() */ + @Override public IMakefileReaderProvider getMakefileReaderProvider() { return null; } @@ -78,12 +80,14 @@ public class NullMakefile extends AbstractMakefile { public void parse(String name, IMakefileReaderProvider makefileReaderProvider) throws IOException { } + @Override public void parse(URI fileURI, Reader makefile) throws IOException { } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.net.URI, org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider) */ + @Override public void parse(URI fileURI, IMakefileReaderProvider makefileReaderProvider) throws IOException { } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Parent.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Parent.java index f4ba6cebcf4..ff6cd45d33d 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Parent.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Parent.java @@ -13,8 +13,8 @@ package org.eclipse.cdt.make.internal.core.makefile; import java.util.ArrayList; import java.util.Arrays; -import org.eclipse.cdt.make.core.makefile.IParent; import org.eclipse.cdt.make.core.makefile.IDirective; +import org.eclipse.cdt.make.core.makefile.IParent; /** * IParent @@ -32,6 +32,7 @@ public abstract class Parent extends Directive implements IParent { return getDirectives(); } + @Override public IDirective[] getDirectives() { children.trimToSize(); return children.toArray(new IDirective[0]); @@ -57,7 +58,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]); } /* (non-Javadoc) diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Rule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Rule.java index 949c7cd2032..73e0a6a2ad9 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Rule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/Rule.java @@ -13,8 +13,8 @@ package org.eclipse.cdt.make.internal.core.makefile; import java.util.ArrayList; import org.eclipse.cdt.make.core.makefile.ICommand; -import org.eclipse.cdt.make.core.makefile.IRule; import org.eclipse.cdt.make.core.makefile.IDirective; +import org.eclipse.cdt.make.core.makefile.IRule; import org.eclipse.cdt.make.core.makefile.ITarget; public abstract class Rule extends Parent implements IRule { @@ -31,6 +31,7 @@ public abstract class Rule extends Parent implements IRule { addDirectives(cmds); } + @Override public ICommand[] getCommands() { IDirective[] directives = getDirectives(); ArrayList cmds = new ArrayList(directives.length); @@ -42,6 +43,7 @@ public abstract class Rule extends Parent implements IRule { return cmds.toArray(new ICommand[0]); } + @Override public ITarget getTarget() { return target; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SpecialRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SpecialRule.java index 2b5c3a6cecc..b73578a1a76 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SpecialRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SpecialRule.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.cdt.make.internal.core.makefile; -import org.eclipse.cdt.make.core.makefile.ISpecialRule; import org.eclipse.cdt.make.core.makefile.ICommand; +import org.eclipse.cdt.make.core.makefile.ISpecialRule; /** * Targets that have special meaning for Make. @@ -25,6 +25,7 @@ public abstract class SpecialRule extends Rule implements ISpecialRule { prerequisites = reqs; } + @Override public String[] getPrerequisites() { return prerequisites; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/TargetRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/TargetRule.java index fbfd7cfc0ee..25d5366ed33 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/TargetRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/TargetRule.java @@ -18,15 +18,15 @@ import org.eclipse.cdt.make.core.makefile.ITargetRule; * statement : rule | macro_definition | comments | empty * rule : inference_rule | target_rule * inference_rule : target ':' ( command ) + - * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] + * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] [ ( prefix_command command ) * ] - * macro_definition : string '=' (string)* + * macro_definition : string '=' (string)* * comments : '#' (string) * * empty : * command : string * target : string * prefix_command : '-' | '@' | '+' - * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" + * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" */ public class TargetRule extends Rule implements ITargetRule { @@ -46,6 +46,7 @@ public class TargetRule extends Rule implements ITargetRule { prerequisites = reqs; } + @Override public String[] getPrerequisites() { return prerequisites; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java index f4c848632d8..102a75c851c 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java @@ -39,34 +39,42 @@ public abstract class Conditional extends Parent implements IConditional { } + @Override public String getConditional() { return cond; } + @Override public String getArg1() { return arg1; } + @Override public String getArg2() { return arg2; } + @Override public boolean isIfdef() { return false; } + @Override public boolean isIfndef() { return false; } + @Override public boolean isIfeq() { return false; } + @Override public boolean isIfneq() { return false; } + @Override public boolean isElse() { return false; } @@ -87,12 +95,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. @@ -121,20 +129,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.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java index 66d639bb491..295144cdbff 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java @@ -59,15 +59,15 @@ import org.eclipse.core.runtime.CoreException; * statement : rule | macro_definition | comments | empty * rule : inference_rule | target_rule * inference_rule : target ':' ( command ) + - * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] + * target_rule : target [ ( target ) * ] ':' [ ( prerequisite ) * ] [ ';' command ] [ ( command ) * ] - * macro_definition : string '=' (string)* + * macro_definition : string '=' (string)* * comments : ('#' (string) ) * * empty : * command : prefix_command string * target : string * prefix_command : '-' | '@' | '+' - * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" + * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" */ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { @@ -82,14 +82,16 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { public GNUMakefile() { super(null); } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMakefile#getMakefileReaderProvider() */ + @Override public IMakefileReaderProvider getMakefileReaderProvider() { return makefileReaderProvider; } - + + @Override public void parse(String filePath, Reader reader) throws IOException { parse(URIUtil.toURI(filePath), new MakefileReader(reader)); } @@ -97,6 +99,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.net.URI, org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider) */ + @Override public void parse(URI fileURI, IMakefileReaderProvider makefileReaderProvider) throws IOException { this.makefileReaderProvider = makefileReaderProvider; @@ -107,7 +110,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { final IFileInfo info = store.fetchInfo(); if (!info.exists() || info.isDirectory()) throw new IOException(); - + reader = new MakefileReader(new InputStreamReader( store.openInputStream(EFS.NONE, null))); } catch (CoreException e) { @@ -119,12 +122,13 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { } parse(fileURI, reader); } - + + @Override public void parse(URI filePath, Reader reader) throws IOException { - parse(filePath, new MakefileReader(reader)); + parse(filePath, new MakefileReader(reader)); } - - + + protected void parse(URI fileURI, MakefileReader reader) throws IOException { String line; Rule[] rules = null; @@ -306,7 +310,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { vd.setLines(startLine, endLine); addDirective(conditions, vd); if (!vd.isTargetSpecific()) { - continue; + continue; } } @@ -814,10 +818,12 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { return builtins; } + @Override public void setIncludeDirectories(String[] dirs) { includeDirectories = dirs; } + @Override public String[] getIncludeDirectories() { return includeDirectories; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java index 247bfdc8558..86820753611 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java @@ -38,6 +38,7 @@ public class GNUMakefileChecker extends ACBuilder { this.monitor = monitor; } + @Override public boolean visit(IResourceDelta delta) throws CoreException { IResource resource = delta.getResource(); if (resource != null && resource.getProject() == getProject()) { diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java index 1fca7eb5d98..04960c50443 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java @@ -41,6 +41,7 @@ public class GNUMakefileValidator implements IMakefileValidator { setMarkerGenerator(errorHandler); } + @Override public void setMarkerGenerator(IMarkerGenerator errorHandler) { reporter = errorHandler; } @@ -49,16 +50,18 @@ public class GNUMakefileValidator implements IMakefileValidator { if (reporter == null) { reporter = new IMarkerGenerator() { + @Override public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) { ProblemMarkerInfo problemMarkerInfo = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar, null); addMarker(problemMarkerInfo); } - - + + /* (non-Javadoc) * @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo) */ + @Override public void addMarker(ProblemMarkerInfo problemMarkerInfo) { String name = "Makefile"; //$NON-NLS-1$ if (problemMarkerInfo.file != null) { @@ -76,8 +79,8 @@ public class GNUMakefileValidator implements IMakefileValidator { sb.append(':').append(problemMarkerInfo.externalPath); } sb.append('\n'); - System.out.println(sb.toString()); - + System.out.println(sb.toString()); + } @@ -94,12 +97,13 @@ public class GNUMakefileValidator implements IMakefileValidator { } return MakefileMessages.getString("MakefileValidator.unknown"); //$NON-NLS-1$ } - + }; } return reporter; } - + + @Override public void checkFile(IFile file, IProgressMonitor monitor) { String message = MakefileMessages.getString("MakefileValidator.checkingFile") + file.getFullPath().toString(); //$NON-NLS-1$ monitor.subTask(message); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java index 253630990dd..9b4c212e594 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java @@ -44,6 +44,7 @@ public class Include extends Parent implements IInclude { return sb.toString(); } + @Override public String[] getFilenames() { return filenames; } @@ -60,8 +61,8 @@ public class Include extends Parent implements IInclude { } return null; } - - + + @Override public IDirective[] getDirectives() { clearDirectives(); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Terminal.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Terminal.java index 6e447121199..4eadf939cac 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Terminal.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Terminal.java @@ -19,10 +19,12 @@ public abstract class Terminal extends Directive implements ITerminal { super(parent); } + @Override public boolean isEndif() { return false; } + @Override public boolean isEndef() { return false; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/UnExport.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/UnExport.java index b7cfefcc623..34850e0ec5f 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/UnExport.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/UnExport.java @@ -29,6 +29,7 @@ public class UnExport extends Directive implements IUnExport { return sb.toString(); } + @Override public String getVariable() { return variable; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VPath.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VPath.java index a9d9755d915..e417eedc9d0 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VPath.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VPath.java @@ -36,10 +36,12 @@ public class VPath extends Directive implements IVPath { return sb.toString(); } + @Override public String[] getDirectories() { return directories; } + @Override public String getPattern() { return pattern; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java index 9134d434aaf..ab215362aee 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java @@ -84,31 +84,38 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi return sb.toString(); } + @Override public boolean isRecursivelyExpanded() { return type == TYPE_RECURSIVE_EXPAND; } + @Override public boolean isSimplyExpanded() { return type == TYPE_SIMPLE_EXPAND; } - + + @Override public boolean isConditional() { return type == TYPE_CONDITIONAL; } - + + @Override public boolean isAppend() { return type == TYPE_APPEND; } + @Override public boolean isTargetSpecific() { String t = getTarget(); return t != null && t.length() > 0; } + @Override public boolean isExport() { return false; } + @Override public boolean isMultiLine() { return false; } @@ -116,6 +123,7 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi /** * Variable from an `override' directive. */ + @Override public boolean isOverride() { return false; } @@ -123,10 +131,12 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi /** * Automatic variable -- cannot be set. */ + @Override public boolean isAutomatic() { return false; } + @Override public String getTarget() { return varTarget; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java index fd026d905b0..4166b2d4f83 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java @@ -51,15 +51,15 @@ import org.eclipse.core.runtime.CoreException; * rule : inference_rule | target_rule | special_rule * inference_rule : target ':' [ ';' command ] [ ( command ) * ] - * target_rule : [ ( target ) + ] ':' [ ( prerequisite ) * ] [ ';' command ] + * target_rule : [ ( target ) + ] ':' [ ( prerequisite ) * ] [ ';' command ] [ ( command ) * ] - * macro_definition : string '=' ( string )* + * macro_definition : string '=' ( string )* * comments : ('#' ( string ) ) * * empty : * command : prefix_command string * target : string * prefix_command : '-' | '@' | '+' - * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" + * internal_macro : "$<" | "$*" | "$@" | "$?" | "$%" */ public class PosixMakefile extends AbstractMakefile { @@ -70,14 +70,16 @@ public class PosixMakefile extends AbstractMakefile { public PosixMakefile() { super(null); } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMakefile#getMakefileReaderProvider() */ + @Override public IMakefileReaderProvider getMakefileReaderProvider() { return makefileReaderProvider; } - + + @Override public void parse(String name, Reader reader) throws IOException { parse(URIUtil.toURI(name), new MakefileReader(reader)); } @@ -85,6 +87,7 @@ public class PosixMakefile extends AbstractMakefile { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.net.URI, org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider) */ + @Override public void parse(URI fileURI, IMakefileReaderProvider makefileReaderProvider) throws IOException { this.makefileReaderProvider = makefileReaderProvider; @@ -102,7 +105,8 @@ public class PosixMakefile extends AbstractMakefile { } parse(fileURI, reader); } - + + @Override public void parse(URI fileURI, Reader reader) throws IOException { parse(fileURI, new MakefileReader(reader)); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoCalculator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoCalculator.java index 91474428389..8a53b6bb991 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoCalculator.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/CDataDiscoveredInfoCalculator.java @@ -42,23 +42,23 @@ import org.eclipse.core.runtime.IPath; public class CDataDiscoveredInfoCalculator { - private static final String[] EMPTY_STRING_ARRAY = new String[0]; + private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static CDataDiscoveredInfoCalculator fInstance; - + public static class DiscoveredSettingInfo{ private boolean fIsPerFileDiscovery; private IRcSettingInfo[] fInfos; - + public DiscoveredSettingInfo(boolean isPerFileDiscovery, IRcSettingInfo[] infos){ fIsPerFileDiscovery = isPerFileDiscovery; fInfos = infos; } - + public boolean isPerFileDiscovery(){ return fIsPerFileDiscovery; } - + public IRcSettingInfo[] getRcSettingInfos(){ return fInfos; } @@ -66,16 +66,16 @@ public class CDataDiscoveredInfoCalculator { public interface IRcSettingInfo { CResourceData getResourceData(); - + ILangSettingInfo[] getLangInfos(); } - + public interface ILangSettingInfo { CLanguageData getLanguageData(); - + PathInfo getFilePathInfo(); } - + private static class RcSettingInfo implements IRcSettingInfo{ private ArrayList fLangInfoList; private CResourceData fRcData; @@ -84,68 +84,72 @@ public class CDataDiscoveredInfoCalculator { fRcData = rcData; } + @Override public ILangSettingInfo[] getLangInfos() { if(fLangInfoList != null && fLangInfoList.size() != 0) return fLangInfoList.toArray(new ILangSettingInfo[fLangInfoList.size()]); return new ILangSettingInfo[0]; } + @Override public CResourceData getResourceData() { return fRcData; } - + void add(ILangSettingInfo info){ if(fLangInfoList == null) fLangInfoList = new ArrayList(); fLangInfoList.add(info); } } - + private static class LangSettingInfo implements ILangSettingInfo { private CLanguageData fLangData; private PathInfo fPathInfo; - + LangSettingInfo(CLanguageData langData, PathInfo info){ fLangData = langData; fPathInfo = info; } + @Override public PathInfo getFilePathInfo() { return fPathInfo; } + @Override public CLanguageData getLanguageData() { return fLangData; } - + } private static class ListIndexStore { private int fMaxIndex; private List[] fStore; - + public ListIndexStore(int size){ if(size < 0) size = 0; - + @SuppressWarnings("unchecked") List[] lists = new List[size]; fStore = lists; } - + public void add(int index, PathFilePathInfo value){ List list = checkResize(index) ? new ArrayList() : fStore[index]; if(list == null){ list = new ArrayList(); fStore[index] = list; } - + if(fMaxIndex < index) fMaxIndex = index; - + list.add(value); } - + private boolean checkResize(int index){ if(index >= fStore.length){ int newSize = ++index; @@ -159,7 +163,7 @@ public class CDataDiscoveredInfoCalculator { } return false; } - + public List[] getLists(){ int size = fMaxIndex + 1; List> list = new ArrayList>(size); @@ -169,23 +173,23 @@ public class CDataDiscoveredInfoCalculator { if(l != null) list.add(l); } - + @SuppressWarnings("unchecked") List[] lists = list.toArray(new List[list.size()]); return lists; } } - + private static class PathFilePathInfo { IPath fPath; PathInfo fInfo; - + PathFilePathInfo(IPath path, PathInfo info){ fPath = path; fInfo = info; } } - + private static class ExtsSetSettings { // String[] fExts; // HashSet fExtsSet; @@ -202,7 +206,7 @@ public class CDataDiscoveredInfoCalculator { fBaseLangData = baseLangData; fIsDerived = isDerived; } - + void add(ExtsSetSettings setting){ if(setting.fPathFilePathInfoMap != null){ Collection> infoLists = setting.fPathFilePathInfoMap.values(); @@ -213,11 +217,11 @@ public class CDataDiscoveredInfoCalculator { } } } - + public void add(PathFilePathInfo pInfo){ if(fPathFilePathInfoMap == null) fPathFilePathInfoMap = new HashMap>(3); - + PathInfo fileInfo = pInfo.fInfo; List list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList : fPathFilePathInfoMap.get(fileInfo); if(list == null){ @@ -226,13 +230,13 @@ public class CDataDiscoveredInfoCalculator { if(fMaxMatchInfo == null){ fMaxMatchInfo = fileInfo; fMaxMatchInfoList = list; - } + } // else { // fIsMultiple = true; // } } else if(fMaxMatchInfoList != list){ // fIsMultiple = true; - + if(fMaxMatchInfoList.size() == list.size()){ fMaxMatchInfoList = list; fMaxMatchInfo = fileInfo; @@ -240,32 +244,32 @@ public class CDataDiscoveredInfoCalculator { } list.add(pInfo); } - + public boolean isMultiple(){ return fPathFilePathInfoMap != null && fPathFilePathInfoMap.size() > 1; } - + @Override public boolean equals(Object obj) { if(obj == this) return true; - + if(isMultiple()) return false; - + if(!(obj instanceof ExtsSetSettings)) return false; - + ExtsSetSettings other = (ExtsSetSettings)obj; if(other.isMultiple()) return false; - + if(!fExtsSet.equals(other.fExtsSet)) return false; - + if(!CDataUtil.objectsEqual(fMaxMatchInfo, other.fMaxMatchInfo)) return false; - + return true; } @@ -277,18 +281,18 @@ public class CDataDiscoveredInfoCalculator { hash = super.hashCode(); else { hash = fExtsSet.hashCode(); - + if(fMaxMatchInfo != null) - hash += fMaxMatchInfo.hashCode(); + hash += fMaxMatchInfo.hashCode(); } - + fHash = hash; } return hash; } - + } - + private static class ExtsSet { private String[] fExts; private HashSet fExtsSet; @@ -297,19 +301,19 @@ public class CDataDiscoveredInfoCalculator { public ExtsSet(String[] exts){ fExts = exts == null || exts.length == 0 ? EMPTY_STRING_ARRAY : (String[])exts.clone(); } - + @Override public boolean equals(Object obj) { if(this == obj) return true; - + if(!(obj instanceof ExtsSet)) return false; - + ExtsSet other = (ExtsSet)obj; if(fExts.length != other.fExts.length) return false; - + if(fExts.length != 0){ @SuppressWarnings("unchecked") HashSet set = (HashSet)calcExtsSet().clone(); @@ -319,7 +323,7 @@ public class CDataDiscoveredInfoCalculator { } return true; } - + @Override public int hashCode() { int hash = fHash; @@ -332,7 +336,7 @@ public class CDataDiscoveredInfoCalculator { } return hash; } - + private HashSet calcExtsSet(){ if(fExtsSet == null) fExtsSet = new HashSet(Arrays.asList(fExts)); @@ -343,9 +347,9 @@ public class CDataDiscoveredInfoCalculator { public String toString() { if(fExts.length == 0) return ""; //$NON-NLS-1$ - + StringBuffer buf = new StringBuffer(); - + for(int i = 0; i < fExts.length; i++){ if(i != 0) buf.append(","); //$NON-NLS-1$ @@ -354,7 +358,7 @@ public class CDataDiscoveredInfoCalculator { return buf.toString(); } } - + private static class RcSetSettings { private CResourceData fRcData; private HashMap fExtToExtsSetMap; @@ -392,13 +396,13 @@ public class CDataDiscoveredInfoCalculator { } return child; } - + void updateRcData(CResourceData data, boolean isDerived){ fRcData = data; fIsDerived = data != null ? isDerived : false; updateLangDatas(); } - + private void updateLangDatas(){ if(fRcData.getType() == ICSettingBase.SETTING_FILE){ CLanguageData lData = ((CFileData)fRcData).getLanguageData(); @@ -407,9 +411,9 @@ public class CDataDiscoveredInfoCalculator { extSetting.fBaseLangData = lData; extSetting.fIsDerived = lData != null ? fIsDerived : false; } - - if(extSetting != null ? - fExtsSetToExtsSetSettingsMap.size() > 1 + + if(extSetting != null ? + fExtsSetToExtsSetSettingsMap.size() > 1 : fExtsSetToExtsSetSettingsMap.size() > 0){ for (ExtsSetSettings s : fExtsSetToExtsSetSettingsMap.values()) { if(s != extSetting){ @@ -422,7 +426,7 @@ public class CDataDiscoveredInfoCalculator { CLanguageData[] lDatas = ((CFolderData)fRcData).getLanguageDatas(); @SuppressWarnings("unchecked") Map map = (HashMap)fExtsSetToExtsSetSettingsMap.clone(); - + CLanguageData lData; for(int i = 0; i < lDatas.length; i++){ lData = lDatas[i]; @@ -432,7 +436,7 @@ public class CDataDiscoveredInfoCalculator { extSetting.fIsDerived = this.fIsDerived; } } - + if(map.size() != 0){ Collection extSettings = map.values(); for (ExtsSetSettings extSetting : extSettings) { @@ -442,28 +446,28 @@ public class CDataDiscoveredInfoCalculator { } } } - + public IPath getPath(){ return fContainer.getPath(); } - + public RcSetSettings getParent(){ PathSettingsContainer cr = fContainer.getParentContainer(); if(cr != null) return (RcSetSettings)cr.getValue(); return null; } - + void internalSetSettingsMap(HashMap map){ fExtsSetToExtsSetSettingsMap = map; fExtToExtsSetMap = calcExtToExtSetSettingsMap(map); } - + void internalAdd(ExtsSetSettings setting){ if(fExtsSetToExtsSetSettingsMap == null){ fExtsSetToExtsSetSettingsMap = new HashMap(); } - + ExtsSetSettings cur = fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet); if(cur != null){ cur.add(setting); @@ -472,7 +476,7 @@ public class CDataDiscoveredInfoCalculator { fExtToExtsSetMap = addExtsInfoToMap(setting, fExtToExtsSetMap); } } - + void internalAddSettingsMap(HashMap map){ Collection settings = map.values(); for (ExtsSetSettings setting : settings) { @@ -488,55 +492,56 @@ public class CDataDiscoveredInfoCalculator { // } } } - + public RcSetSettings[] getChildren(final boolean includeCurrent){ final List list = new ArrayList(); fContainer.accept(new IPathSettingsContainerVisitor(){ + @Override public boolean visit(PathSettingsContainer container) { if(includeCurrent || container != fContainer){ list.add(container.getValue()); } return true; } - + }); - + return list.toArray(new RcSetSettings[list.size()]); } - + public boolean containsEqualMaxMatches(RcSetSettings other, boolean ignoreGenerated){ if(!ignoreGenerated && fExtsSetToExtsSetSettingsMap.size() < other.fExtsSetToExtsSetSettingsMap.size()) return false; - + Set> entrySet = other.fExtsSetToExtsSetSettingsMap.entrySet(); for (Entry entry : entrySet) { ExtsSetSettings otherSetting = entry.getValue(); if(ignoreGenerated && otherSetting.fBaseLangData == null) continue; - + ExtsSetSettings thisSetting = fExtsSetToExtsSetSettingsMap.get(entry.getKey()); if(thisSetting == null) return false; - + if(otherSetting.fMaxMatchInfo != null && !otherSetting.fMaxMatchInfo.equals(thisSetting.fMaxMatchInfo)) return false; } - + return true; } - + void removeChild(RcSetSettings setting){ IPath path = setting.fContainer.getPath(); IPath thisPath = fContainer.getPath(); if(!thisPath.isPrefixOf(path)) throw new IllegalArgumentException(); - + path = path.removeFirstSegments(thisPath.segmentCount()); fContainer.removeChildContainer(path); } } - + private static HashMap calcExtToExtSetSettingsMap(Map extsSetMap){ HashMap result = null; Collection settings = extsSetMap.values(); @@ -545,7 +550,7 @@ public class CDataDiscoveredInfoCalculator { } return result; } - + private static HashMap addExtsInfoToMap(ExtsSetSettings setting, HashMap map){ boolean forceAdd = false; String[] exts = setting.fExtsSet.fExts; @@ -563,7 +568,7 @@ public class CDataDiscoveredInfoCalculator { } return map; } - + private RcSetSettings createRcSetInfo (CConfigurationData data){ CFolderData rootData = data.getRootFolderData(); PathSettingsContainer container = PathSettingsContainer.createRootContainer(); @@ -571,22 +576,22 @@ public class CDataDiscoveredInfoCalculator { rcSet.internalSetSettingsMap(createExtsSetSettingsMap(rootData)); // rcSet.fExtToExtsSetMap = new HashMap(); // rcSet.fExtsSetToExtsSetSettingsMap = new HashMap(); - + CResourceData[] rcDatas = data.getResourceDatas(); CResourceData rcData; RcSetSettings curRcSet; HashMap fileMap; ExtsSetSettings fileSetting; IPath path; - + for(int i = 0; i < rcDatas.length; i++){ rcData = rcDatas[i]; if(rcData == rootData) continue; - + if(!includeRcDataInCalculation(data, rcData)) continue; - + path = rcData.getPath(); curRcSet = rcSet.createChild(path, rcData, false); if(rcData.getType() == ICSettingBase.SETTING_FILE){ @@ -598,14 +603,14 @@ public class CDataDiscoveredInfoCalculator { curRcSet.internalSetSettingsMap(createExtsSetSettingsMap((CFolderData)rcData)); } } - + return rcSet; } - + protected boolean includeRcDataInCalculation(CConfigurationData cfgData, CResourceData rcData){ return true; } - + protected CFileData createFileData(CConfigurationData cfgData, IPath path, CFileData base) throws CoreException{ return cfgData.createFileData(path, base); } @@ -626,7 +631,7 @@ public class CDataDiscoveredInfoCalculator { checkRemoveDups(rcSet); return rcSet; } - + /* * utility method for creating empty IRcSettingInfo */ @@ -664,12 +669,12 @@ public class CDataDiscoveredInfoCalculator { } else { list.ensureCapacity(lDatas.length); } - + for(int i = 0; i < lDatas.length; i++){ list.add(new LangSettingInfo(lDatas[i], info)); } } - + private IRcSettingInfo[] mapFileDiscoveredInfo(IProject project, CConfigurationData data, RcSetSettings rcSet, PathFilePathInfo[] pfpis){ // IResource rc; PathInfo pInfo; @@ -682,7 +687,7 @@ public class CDataDiscoveredInfoCalculator { CLanguageData lData; ArrayList tmpList; PathFilePathInfo pfpi; - + for(int i = 0; i < pfpis.length; i++){ pfpi = pfpis[i]; projRelPath = pfpi.fPath; @@ -708,19 +713,19 @@ public class CDataDiscoveredInfoCalculator { kinds |= ICLanguageSettingEntry.MACRO_FILE; if(symbolMap.size() != 0) kinds |= ICLanguageSettingEntry.MACRO; - + rcInfo = null; for(int k = 0; k < lDatas.length; k++){ lData = lDatas[k]; if((lData.getSupportedEntryKinds() & kinds) == 0) continue; - + if(rcInfo == null){ rcInfo = new RcSettingInfo(rootData); tmpList = new ArrayList(lDatas.length - k); rcInfo.fLangInfoList = tmpList; } - + lInfo = new LangSettingInfo(lData, pInfo); rcInfo.add(lInfo); } @@ -733,7 +738,7 @@ public class CDataDiscoveredInfoCalculator { // switch(rc.getType()){ // case IResource.FILE: // projRelPath = rc.getProjectRelativePath(); -// dataSetting = rcSet.getChild(projRelPath, false); +// dataSetting = rcSet.getChild(projRelPath, false); // rcData = dataSetting.fRcData; rcData = rcSet.getChild(projRelPath, false).fRcData; if(!rcData.getPath().equals(projRelPath)){ @@ -752,20 +757,20 @@ public class CDataDiscoveredInfoCalculator { } catch (CoreException e) { rcData = null; MakeCorePlugin.log(e); - } + } } // if(rcData != null) // dataSetting = rcSet.createChild(projRelPath, rcData, false); // else // dataSetting = null; } - + if(rcData != null){ if(rcData.getType() == ICSettingBase.SETTING_FILE){ lData = ((CFileData)rcData).getLanguageData(); } else { lData = CDataUtil.findLanguagDataForFile(projRelPath.lastSegment(), project, (CFolderData)rcData); - + } if(lData != null){ @@ -784,7 +789,7 @@ public class CDataDiscoveredInfoCalculator { } return list.toArray(new RcSettingInfo[list.size()]); } - + public IRcSettingInfo[] getSettingInfos(IProject project, CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo, boolean fileDataMode){ if(fileDataMode){ RcSetSettings rcSettings = createRcSetInfo(data); @@ -794,7 +799,7 @@ public class CDataDiscoveredInfoCalculator { RcSetSettings settings = createRcSetSettings(data, discoveredInfo); return createInfos(data, settings); } - + private IRcSettingInfo[] createInfos(CConfigurationData data, RcSetSettings rootSetting){ RcSetSettings settings[] = rootSetting.getChildren(true); RcSetSettings setting; @@ -823,7 +828,7 @@ public class CDataDiscoveredInfoCalculator { continue; } } - + if(rcData.getType() == ICSettingBase.SETTING_FILE){ ExtsSetSettings extSetting = setting.fExtToExtsSetMap.get(getFileExt(rcData.getPath())); if(extSetting != null){ @@ -846,17 +851,17 @@ public class CDataDiscoveredInfoCalculator { for (ExtsSetSettings extSetting : extSettings) { if(extSetting.fMaxMatchInfo == null) continue; - + if(extSetting.fBaseLangData == null) continue; - + if(extSetting.fIsDerived){ throw new IllegalStateException(); } - - + + rcInfo.add(new LangSettingInfo(extSetting.fBaseLangData, extSetting.fMaxMatchInfo)); - + if(extSetting.isMultiple()){ Set>> entries = extSetting.fPathFilePathInfoMap.entrySet(); for (Entry> entry : entries) { @@ -883,18 +888,18 @@ public class CDataDiscoveredInfoCalculator { } } // } - + return resultList.toArray(new RcSettingInfo[resultList.size()]); } - + private CFolderData createFolderData(CConfigurationData cfg, CResourceData base, RcSetSettings setting) throws CoreException{ if(base.getType() == ICSettingBase.SETTING_FOLDER) return createFolderData(cfg, setting.getPath(), (CFolderData)base); - + //should not be here throw new IllegalStateException(); } - + private static void checkRemoveDups(RcSetSettings rcSet){ RcSetSettings settings[] = rcSet.getChildren(true); RcSetSettings setting, parent; @@ -902,21 +907,21 @@ public class CDataDiscoveredInfoCalculator { setting = settings[i]; if(!setting.fIsDerived) continue; - + parent = setting.getParent(); if(parent == null) continue; - + if(parent.containsEqualMaxMatches(setting, true)) removeChildAddingChildSettings(parent, setting); } } - + private static void removeChildAddingChildSettings(RcSetSettings parent, RcSetSettings child){ parent.internalAddSettingsMap(child.fExtsSetToExtsSetSettingsMap); parent.removeChild(child); } - + private static void mapDiscoveredInfo(RcSetSettings rcSet, PathFilePathInfo[] pInfos){ PathFilePathInfo pInfo; RcSetSettings child, parent; @@ -938,8 +943,8 @@ public class CDataDiscoveredInfoCalculator { child.internalSetSettingsMap(createEmptyExtSetMapCopy(parent.fExtsSetToExtsSetSettingsMap)); } } - } - + } + // isDerived = child.fIsDerived; if(pInfo.fPath.segmentCount() == 0){ @@ -956,21 +961,21 @@ public class CDataDiscoveredInfoCalculator { } } } - + private static void processProjectPaths(RcSetSettings rcSet, PathFilePathInfo pfpi){ Collection settings = rcSet.fExtsSetToExtsSetSettingsMap.values(); for (ExtsSetSettings setting : settings) { setting.add(pfpi); } } - + private static String getFileExt(IPath path){ String ext = path.getFileExtension(); if(ext != null) return ext; return ""; //$NON-NLS-1$ } - + private static HashMap createEmptyExtSetMapCopy(HashMap base){ @SuppressWarnings("unchecked") HashMap map = (HashMap)base.clone(); @@ -982,7 +987,7 @@ public class CDataDiscoveredInfoCalculator { } return map; } - + private static ExtsSetSettings createExtsSetSettings(IPath path, CFileData data){ CLanguageData lData = data.getLanguageData(); if(lData != null){ @@ -991,7 +996,7 @@ public class CDataDiscoveredInfoCalculator { } return new ExtsSetSettings(null, new ExtsSet(EMPTY_STRING_ARRAY), false); } - + private static ExtsSetSettings createExtsSetSettings(CLanguageData lData, String exts[]){ return new ExtsSetSettings(lData, new ExtsSet(exts), false); } @@ -1000,7 +1005,7 @@ public class CDataDiscoveredInfoCalculator { CLanguageData[] lDatas = data.getLanguageDatas(); HashMap map = new HashMap(lDatas.length); ExtsSetSettings settings; - + if(lDatas.length != 0) { CLanguageData lData; for( int i = 0; i < lDatas.length; i++){ @@ -1009,7 +1014,7 @@ public class CDataDiscoveredInfoCalculator { map.put(settings.fExtsSet, settings); } } - + return map; } @@ -1017,7 +1022,7 @@ public class CDataDiscoveredInfoCalculator { ListIndexStore store = new ListIndexStore(10); HashMap infoMap = new HashMap(); // LinkedHashMap result; - + Set> entries = map.entrySet(); for (Entry entry : entries) { IResource rc = entry.getKey(); @@ -1028,17 +1033,17 @@ public class CDataDiscoveredInfoCalculator { // path = path.removeFirstSegments(1); // segCount--; - + PathInfo info = entry.getValue(); PathInfo storedInfo = infoMap.get(info); if(storedInfo == null){ storedInfo = info; infoMap.put(storedInfo, storedInfo); } - + store.add(segCount, new PathFilePathInfo(path, storedInfo)); } - + List lists[] = store.getLists(); // result = new LinkedHashMap(map.size()); // List l; @@ -1059,7 +1064,7 @@ public class CDataDiscoveredInfoCalculator { for(int i = 0; i < lists.length; i++){ size += lists[i].size(); } - + infos = new PathFilePathInfo[size]; int num = 0; int listSize; @@ -1071,17 +1076,17 @@ public class CDataDiscoveredInfoCalculator { infos[num++] = list.get(k); } } - + return infos; } - + public static CDataDiscoveredInfoCalculator getDefault(){ if(fInstance == null) fInstance = new CDataDiscoveredInfoCalculator(); return fInstance; } - - public DiscoveredSettingInfo getSettingInfos(IProject project, + + public DiscoveredSettingInfo getSettingInfos(IProject project, CConfigurationData cfgData){ InfoContext context = createContext(project, cfgData); try { @@ -1093,7 +1098,7 @@ public class CDataDiscoveredInfoCalculator { } IPath[] includes = info.getIncludePaths(); Map symbols = info.getSymbols(); - + PathInfo pathInfo = new PathInfo(includes, null, symbols, null, null); CFolderData rootData = cfgData.getRootFolderData(); IRcSettingInfo rcInfo = createRcSettingInfo(rootData, pathInfo); @@ -1103,11 +1108,11 @@ public class CDataDiscoveredInfoCalculator { } return new DiscoveredSettingInfo(false, new IRcSettingInfo[0]); } - + protected InfoContext createContext(IProject project, CConfigurationData data){ return new InfoContext(project, idForData(data)); } - + protected String idForData(CDataObject data){ return data.getId(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java index de37531abed..66d286aba68 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java @@ -37,7 +37,7 @@ public class DiscoveredPathContainer implements IPathEntryContainer { fProject = project; fPathEntries = null; } - + // public IPathEntry[] getPathEntries() { // IPathEntry[] fPathEntries; // try { @@ -49,15 +49,18 @@ public class DiscoveredPathContainer implements IPathEntryContainer { // return fPathEntries; // } - public String getDescription() { + @Override + public String getDescription() { return MakeMessages.getString("DiscoveredContainer.description"); //$NON-NLS-1$ } - public IPath getPath() { + @Override + public IPath getPath() { return CONTAINER_ID; } - public IPathEntry[] getPathEntries() { + @Override + public IPathEntry[] getPathEntries() { if (fPathEntries == null) { try { fPathEntries = computeNewPathEntries(); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java index 4e503a35348..43287d3d5bf 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java @@ -51,10 +51,12 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco discoveredSymbols = new LinkedHashMap(); } + @Override public IProject getProject() { return project; } + @Override public synchronized Map getSymbols() { if (activeSymbols == null) { createSymbolsMap(); @@ -63,6 +65,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco return dSymbols; } + @Override public synchronized IPath[] getIncludePaths() { if ( activePaths == null) { createPathLists(); @@ -70,22 +73,24 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco return activePaths.toArray(new IPath[activePaths.size()]); } + @Override public LinkedHashMap getIncludeMap() { return new LinkedHashMap(discoveredPaths); } + @Override public synchronized void setIncludeMap(LinkedHashMap paths) { discoveredPaths = SafeStringInterner.safeIntern(new LinkedHashMap(paths)); activePaths = null; } - + /** * Populates active and removed include path lists */ private void createPathLists() { List aPaths = getActivePathList(); aPaths.clear(); - + Set paths = discoveredPaths.keySet(); for (String path : paths) { Boolean removed = discoveredPaths.get(path); @@ -95,22 +100,24 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco } } + @Override public LinkedHashMap getSymbolMap() { return new LinkedHashMap(discoveredSymbols); } - + + @Override public synchronized void setSymbolMap(LinkedHashMap symbols) { discoveredSymbols = SafeStringInterner.safeIntern(new LinkedHashMap(symbols)); activeSymbols = null; } - + /** * Populates active symbols sets */ private void createSymbolsMap() { Map aSymbols = getActiveSymbolsMap(); aSymbols.clear(); - + aSymbols.putAll(SafeStringInterner.safeIntern(ScannerConfigUtil.scSymbolEntryMap2Map(discoveredSymbols))); } @@ -131,9 +138,10 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#serialize(org.w3c.dom.Element) */ + @Override public void serialize(Element collectorElem) { - Document doc = collectorElem.getOwnerDocument(); - + Document doc = collectorElem.getOwnerDocument(); + Map includes = getIncludeMap(); Set includesSet = includes.keySet(); for (String include : includesSet) { @@ -172,6 +180,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element) */ + @Override public void deserialize(Element collectorElem) { LinkedHashMap includes = getIncludeMap(); LinkedHashMap symbols = getSymbolMap(); @@ -190,7 +199,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco } child = child.getNextSibling(); } - + setIncludeMap(includes); setSymbolMap(symbols); } @@ -198,6 +207,7 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId() */ + @Override public String getCollectorId() { return PerProjectSICollector.COLLECTOR_ID; } @@ -205,7 +215,8 @@ public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDisco /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSerializable() */ - public IDiscoveredScannerInfoSerializable getSerializable() { + @Override + public IDiscoveredScannerInfoSerializable getSerializable() { return this; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java index d9ca8d3b448..305b3b0b6be 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathManager.java @@ -62,7 +62,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC public IDiscoveredPathInfo getInfo(InfoContext context){ return fInfoMap.get(context); } - + // private Map getMap(IPath path, boolean create, boolean exactPath){ // PathSettingsContainer child = fContainer.getChildContainer(path, create, exactPath); // Map map = null; @@ -73,10 +73,10 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC // child.setValue(map); // } // } -// +// // return map; // } - + // public IDiscoveredPathInfo getInfo(IFile file, String instanceId){ // IPath path = file.getProjectRelativePath(); // Map map = getMap(path, false, false); @@ -98,20 +98,21 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC } public DiscoveredPathManager() { - + } - + public void startup() { ResourcesPlugin.getWorkspace().addResourceChangeListener(this); } - + public void shutdown() { ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); } - + /* (non-Javadoc) * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) */ + @Override public void resourceChanged(IResourceChangeEvent event) { if (event.getSource() instanceof IWorkspace) { IResource resource = event.getResource(); @@ -131,29 +132,32 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC } } } - - + + + @Override public IDiscoveredPathInfo getDiscoveredInfo(IProject project) throws CoreException { return getDiscoveredInfo(project, new InfoContext(project)); } + @Override public IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context) throws CoreException{ return getDiscoveredInfo(project, context, true); } + @Override public IDiscoveredPathInfo getDiscoveredInfo(IProject project, InfoContext context, boolean defaultToProjectSettings) throws CoreException{ DiscoveredInfoHolder holder = getHolder(project, true); IDiscoveredPathInfo info = holder.getInfo(context); - + if(info == null){ info = loadPathInfo(project, context, defaultToProjectSettings); holder.setInfo(context, info); } - + return info; } - + private DiscoveredInfoHolder getHolder(IProject project, boolean create){ DiscoveredInfoHolder holder = fDiscoveredInfoHolderMap.get(project); if(holder == null && create){ @@ -165,7 +169,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC private IDiscoveredPathInfo loadPathInfo(IProject project, InfoContext context, boolean defaultToProjectSettings) throws CoreException { IDiscoveredPathInfo pathInfo = null; - + IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(project); IScannerConfigBuilderInfo2 buildInfo = container.getInfo(context); if(buildInfo == null && defaultToProjectSettings) @@ -176,7 +180,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance(). getSCProfileInstance(project, context, profileId); IScannerInfoCollector collector = profileInstance.getScannerInfoCollector(); - + if (collector instanceof IScannerInfoCollector2) { IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector; pathInfo = collector2.createPathInfoObject(); @@ -188,20 +192,20 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC return pathInfo; } - - - + + + // private DiscoveredInfoHolder getHolder // private IDiscoveredPathInfo loadPathInfo(IProject project) throws CoreException { // IDiscoveredPathInfo pathInfo = null; -// +// // IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project); // String profileId = buildInfo.getSelectedProfileId(); // SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance(). // getSCProfileInstance(project, profileId); // IScannerInfoCollector collector = profileInstance.getScannerInfoCollector(); -// +// // if (collector instanceof IScannerInfoCollector2) { // IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector; // pathInfo = collector2.createPathInfoObject(); @@ -212,10 +216,12 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC // return pathInfo; // } + @Override public void removeDiscoveredInfo(IProject project) { removeDiscoveredInfo(project, new InfoContext(project)); } + @Override public void removeDiscoveredInfo(IProject project, InfoContext context) { DiscoveredInfoHolder holder = getHolder(project, false); if(holder != null){ @@ -229,16 +235,18 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#updateDiscoveredInfo(org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo, java.util.List) */ - public void updateDiscoveredInfo(IDiscoveredPathInfo info, List changedResources) throws CoreException { + @Override + public void updateDiscoveredInfo(IDiscoveredPathInfo info, List changedResources) throws CoreException { updateDiscoveredInfo(new InfoContext(info.getProject()), info, true, changedResources); } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#updateDiscoveredInfo(org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo, java.util.List) */ - public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List changedResources) throws CoreException { + @Override + public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List changedResources) throws CoreException { DiscoveredInfoHolder holder = getHolder(info.getProject(), true); - IDiscoveredPathInfo oldInfo = holder.getInfo(context); + IDiscoveredPathInfo oldInfo = holder.getInfo(context); if (oldInfo != null) { IDiscoveredScannerInfoSerializable serializable = info.getSerializable(); if (serializable != null) { @@ -246,7 +254,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC IProject project = info.getProject(); DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context, serializable); fireUpdate(INFO_CHANGED, info); - + if(updateContainer){ IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project); @@ -262,11 +270,11 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC } } } - + /** * Allows one to update the discovered information for a particular scanner discovery profile ID. * TODO: This should be made API in IDiscoveredPathManager, or in an interface derived there from. - * + * * @param context * @param info * @param updateContainer @@ -276,7 +284,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC */ public void updateDiscoveredInfo(InfoContext context, IDiscoveredPathInfo info, boolean updateContainer, List changedResources, String profileId) throws CoreException { DiscoveredInfoHolder holder = getHolder(info.getProject(), true); - IDiscoveredPathInfo oldInfo = holder.getInfo(context); + IDiscoveredPathInfo oldInfo = holder.getInfo(context); if (oldInfo != null) { IDiscoveredScannerInfoSerializable serializable = info.getSerializable(); if (serializable != null) { @@ -284,11 +292,11 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC IProject project = info.getProject(); DiscoveredScannerInfoStore.getInstance().saveDiscoveredScannerInfoToState(project, context, serializable); fireUpdate(INFO_CHANGED, info); - + if(updateContainer){ IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project); - + ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance(). getSCProfileConfiguration(profileId).getProfileScope(); changeDiscoveredContainer(project, profileScope, changedResources); @@ -304,17 +312,19 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#changeDiscoveredContainer(org.eclipse.core.resources.IProject, java.lang.String) */ - public void changeDiscoveredContainer(final IProject project, final ScannerConfigScope profileScope, final List changedResources) { + @Override + public void changeDiscoveredContainer(final IProject project, final ScannerConfigScope profileScope, final List changedResources) { // order here is of essence // 1. clear DiscoveredPathManager's path info cache DiscoveredInfoHolder holder = getHolder(project, false); InfoContext context = new InfoContext(project); IDiscoveredPathInfo oldInfo = holder.getInfo(context); - + // 2. switch the containers try { IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { + @Override + public void run(IProgressMonitor monitor) throws CoreException { ICProject cProject = CoreModel.getDefault().create(project); if (ScannerConfigScope.PROJECT_SCOPE.equals(profileScope)) { CoreModel.setPathEntryContainer(new ICProject[]{cProject}, @@ -328,12 +338,12 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC List changeDelta = new ArrayList(changedResources.size()); for (IResource resource : changedResources) { IPath path = resource.getFullPath(); - changeDelta.add(new PathEntryContainerChanged(path, - PathEntryContainerChanged.INCLUDE_CHANGED | + changeDelta.add(new PathEntryContainerChanged(path, + PathEntryContainerChanged.INCLUDE_CHANGED | PathEntryContainerChanged.MACRO_CHANGED)); // both include paths and symbols changed } - CoreModel.pathEntryContainerUpdates(container, - changeDelta.toArray(new PathEntryContainerChanged[changeDelta.size()]), + CoreModel.pathEntryContainerUpdates(container, + changeDelta.toArray(new PathEntryContainerChanged[changeDelta.size()]), null); } } @@ -341,7 +351,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC MakeCorePlugin.log(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), 1, MakeMessages.getString("DiscoveredContainer.ScopeErrorMessage"), null)); //$NON-NLS-1$ } - + } }; CoreModel.run(runnable, null); @@ -349,7 +359,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC catch (CoreException e) { MakeCorePlugin.log(e); } - + // 3. clear the container's path entry cache if (oldInfo != null) { fireUpdate(INFO_REMOVED, oldInfo); @@ -362,13 +372,15 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC final IDiscoveredInfoListener listener = (IDiscoveredInfoListener)list[i]; if (listener != null) { SafeRunner.run(new ISafeRunnable() { - + + @Override public void handleException(Throwable exception) { IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, CCorePlugin.getResourceString("CDescriptorManager.exception.listenerError"), exception); //$NON-NLS-1$ CCorePlugin.log(status); } - + + @Override public void run() throws Exception { switch (type) { case INFO_CHANGED : @@ -384,10 +396,12 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC } } + @Override public void addDiscoveredInfoListener(IDiscoveredInfoListener listener) { listeners.add(listener); } + @Override public void removeDiscoveredInfoListener(IDiscoveredInfoListener listener) { listeners.remove(listener); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredScannerInfoStore.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredScannerInfoStore.java index 6c85cbd142f..c95f1a49725 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredScannerInfoStore.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredScannerInfoStore.java @@ -32,8 +32,8 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.eclipse.cdt.make.core.MakeCorePlugin; -import org.eclipse.cdt.make.core.scannerconfig.InfoContext; import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable; +import org.eclipse.cdt.make.core.scannerconfig.InfoContext; import org.eclipse.cdt.make.internal.core.MakeMessages; import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector; import org.eclipse.core.resources.IProject; @@ -54,18 +54,18 @@ import org.xml.sax.SAXException; /** * Discovered scanner info persistance store - * + * * @author vhirsl */ public final class DiscoveredScannerInfoStore { - private static final QualifiedName dscFileNameProperty = new + private static final QualifiedName dscFileNameProperty = new QualifiedName(MakeCorePlugin.getUniqueIdentifier(), "discoveredScannerConfigFileName"); //$NON-NLS-1$ private static final String CDESCRIPTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".discoveredScannerInfo"; //$NON-NLS-1$ public static final String SCD_STORE_VERSION = "scdStore"; //$NON-NLS-1$ public static final String SI_ELEM = "scannerInfo"; //$NON-NLS-1$ public static final String COLLECTOR_ELEM = "collector"; //$NON-NLS-1$ public static final String ID_ATTR = "id"; //$NON-NLS-1$ - + private static final String INSTANCE_ELEM = "instance"; //$NON-NLS-1$ private static DiscoveredScannerInfoStore instance; @@ -82,7 +82,7 @@ public final class DiscoveredScannerInfoStore { return instance; } /** - * + * */ private DiscoveredScannerInfoStore() { } @@ -96,7 +96,7 @@ public final class DiscoveredScannerInfoStore { throws CoreException { // Get the document Element rootElem = getRootElement(project, context, serializable); - + if(rootElem != null){ // get the collector element NodeList collectorList = rootElem.getElementsByTagName(COLLECTOR_ELEM); @@ -113,7 +113,7 @@ public final class DiscoveredScannerInfoStore { } } } - + public boolean hasInfo(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable){ try { if(getRootElement(project, context, serializable) != null) @@ -123,7 +123,7 @@ public final class DiscoveredScannerInfoStore { } return false; } - + private Element getRootElement(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable) throws CoreException{ if(serializable == null) return null; @@ -134,17 +134,17 @@ public final class DiscoveredScannerInfoStore { NodeList rootList = document.getElementsByTagName(SI_ELEM); if (rootList.getLength() > 0) { rootElem = (Element) rootList.item(0); - + if(!context.isDefaultContext()){ String instanceId = context.getInstanceId(); - + Element instanceElem = findChild(rootElem, INSTANCE_ELEM, ID_ATTR, instanceId); - + rootElem = instanceElem; } } } - + return rootElem; } @@ -200,7 +200,7 @@ public final class DiscoveredScannerInfoStore { Element rootElem = (Element) document.getElementsByTagName(SI_ELEM).item(0); ProcessingInstruction pi = document.createProcessingInstruction(SCD_STORE_VERSION, "version=\"2.0\""); //$NON-NLS-1$ document.insertBefore(pi, rootElem); - + Element collectorElem = document.createElement(COLLECTOR_ELEM); collectorElem.setAttribute(ID_ATTR, PerProjectSICollector.COLLECTOR_ID); for (Node child = rootElem.getFirstChild(); child != null; child = rootElem.getFirstChild()) { @@ -223,15 +223,15 @@ public final class DiscoveredScannerInfoStore { } } } - + return cfgElem; } - + private void saveDiscoveredScannerInfo(InfoContext context, IDiscoveredScannerInfoSerializable serializable, Document doc) { NodeList rootList = doc.getElementsByTagName(SI_ELEM); if (rootList.getLength() > 0) { Element rootElem = (Element) rootList.item(0); - + // get the collector element if(!context.isDefaultContext()){ String instanceId = context.getInstanceId(); @@ -243,7 +243,7 @@ public final class DiscoveredScannerInfoStore { instanceElem.setAttribute(ID_ATTR, instanceId); rootElem.appendChild(instanceElem); } - + rootElem = instanceElem; } @@ -256,7 +256,7 @@ public final class DiscoveredScannerInfoStore { Element cElem = (Element) collectorList.item(i); String collectorId = cElem.getAttribute(ID_ATTR); if (serializable.getCollectorId().equals(collectorId)) { - for (Node child = cElem.getFirstChild(); child != null; + for (Node child = cElem.getFirstChild(); child != null; child = cElem.getFirstChild()) { cElem.removeChild(child); } @@ -271,7 +271,7 @@ public final class DiscoveredScannerInfoStore { collectorElem.setAttribute(ID_ATTR, serializable.getCollectorId()); rootElem.appendChild(collectorElem); } - + // Save the discovered scanner info serializable.serialize(collectorElem); } @@ -279,13 +279,13 @@ public final class DiscoveredScannerInfoStore { public void saveDiscoveredScannerInfoToState(IProject project, IDiscoveredScannerInfoSerializable serializable) throws CoreException { saveDiscoveredScannerInfoToState(project, new InfoContext(project), serializable); } - + public void saveDiscoveredScannerInfoToState(IProject project, InfoContext context, IDiscoveredScannerInfoSerializable serializable) throws CoreException { Document document = getDocument(project); // Create document try { saveDiscoveredScannerInfo(context, serializable, document); - + // Transform the document to something we can save in a file ByteArrayOutputStream stream = new ByteArrayOutputStream(); Transformer transformer = TransformerFactory.newInstance().newTransformer(); @@ -295,7 +295,7 @@ public final class DiscoveredScannerInfoStore { DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(stream); transformer.transform(source, result); - + // Save the document try { IPath path = getDiscoveredScannerConfigStore(project); @@ -306,7 +306,7 @@ public final class DiscoveredScannerInfoStore { throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("DiscoveredPathManager.File_Error_Message"), e)); //$NON-NLS-1$ } - + // Close the streams stream.close(); } catch (TransformerException e) { @@ -345,7 +345,8 @@ public final class DiscoveredScannerInfoStore { try { delta.accept(new IResourceDeltaVisitor() { - public boolean visit(IResourceDelta delta) throws CoreException { + @Override + public boolean visit(IResourceDelta delta) throws CoreException { IResource resource = delta.getResource(); if (resource instanceof IProject) { IProject project = (IProject) resource; diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java index 1e0f8a404de..fb5ccb744d1 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation *******************************************************************************/ @@ -26,7 +26,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer +public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer implements IPathEntryContainerExtension { public PerFileDiscoveredPathContainer(IProject project) { @@ -36,13 +36,14 @@ public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer /* (non-Javadoc) * @see org.eclipse.cdt.core.model.IPathEntryContainerExtension#getPathEntries(org.eclipse.core.runtime.IPath, int) */ - public IPathEntry[] getPathEntries(IPath path, int mask) { + @Override + public IPathEntry[] getPathEntries(IPath path, int mask) { ArrayList entries = new ArrayList(); try { IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject); if (info instanceof IPerFileDiscoveredPathInfo) { IPerFileDiscoveredPathInfo filePathInfo = (IPerFileDiscoveredPathInfo) info; - + if ((mask & IPathEntry.CDT_INCLUDE) != 0) { IPath[] includes = filePathInfo.getIncludePaths(path); for (int i = 0; i < includes.length; i++) { @@ -86,7 +87,7 @@ public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer } } catch (CoreException e) { - // + // } return entries.toArray(new IPathEntry[entries.size()]); } @@ -94,6 +95,7 @@ public class PerFileDiscoveredPathContainer extends DiscoveredPathContainer /* (non-Javadoc) * @see org.eclipse.cdt.core.model.IPathEntryContainerExtension#isEmpty(org.eclipse.core.runtime.IPath) */ + @Override public boolean isEmpty(IPath path) { IDiscoveredPathInfo info; try { diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigInfoFactory.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigInfoFactory.java index 901befd0556..a8b99bc1a4f 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigInfoFactory.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/ScannerConfigInfoFactory.java @@ -51,7 +51,7 @@ public class ScannerConfigInfoFactory { * @since 3.0 */ static final String SI_PROFILE_ID = PREFIX + ".siProfileId"; //$NON-NLS-1$ - + /** * * @author vhirsl @@ -60,6 +60,7 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isAutoDiscoveryEnabled() */ + @Override public boolean isAutoDiscoveryEnabled() { return getBoolean(BUILD_SCANNER_CONFIG_ENABLED); } @@ -67,6 +68,7 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setAutoDiscoveryEnabled(boolean) */ + @Override public void setAutoDiscoveryEnabled(boolean enabled) throws CoreException { putString(BUILD_SCANNER_CONFIG_ENABLED, Boolean.toString(enabled)); } @@ -74,6 +76,7 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isMakeBuilderConsoleParserEnabled() */ + @Override public boolean isMakeBuilderConsoleParserEnabled() { if (getString(MAKE_BUILDER_PARSER_ENABLED) == null || getString(MAKE_BUILDER_PARSER_ENABLED).length() == 0) { // if no property then default to true @@ -81,10 +84,11 @@ public class ScannerConfigInfoFactory { } return getBoolean(MAKE_BUILDER_PARSER_ENABLED); } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setMakeBuilderConsoleParserEnabled(boolean) */ + @Override public void setMakeBuilderConsoleParserEnabled(boolean enabled) throws CoreException { putString(MAKE_BUILDER_PARSER_ENABLED, Boolean.toString(enabled)); } @@ -92,19 +96,21 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#getMakeBuilderConsoleParserId() */ + @Override public String getMakeBuilderConsoleParserId() { String parserId = getString(MAKE_BUILDER_PARSER_ID); if (parserId == null || parserId.length() == 0) { String[] parserIds = MakeCorePlugin.getDefault(). getScannerInfoConsoleParserIds("makeBuilder"); //$NON-NLS-1$ // the default is the first one in the registry - parserId = parserIds[0]; + parserId = parserIds[0]; } return parserId; } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setMakeBuilderConsoleParserId(java.lang.String) */ + @Override public void setMakeBuilderConsoleParserId(String parserId) throws CoreException { putString(MAKE_BUILDER_PARSER_ID, parserId); } @@ -112,6 +118,7 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isESIProviderCommandEnabled() */ + @Override public boolean isESIProviderCommandEnabled() { if (getString(ESI_PROVIDER_COMMAND_ENABLED) == null || getString(ESI_PROVIDER_COMMAND_ENABLED).length() == 0) { // if no property then default to true @@ -123,13 +130,15 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setESIProviderCommandEnabled(boolean) */ + @Override public void setESIProviderCommandEnabled(boolean enabled) throws CoreException { putString(ESI_PROVIDER_COMMAND_ENABLED, Boolean.toString(enabled)); } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isDefaultESIProviderCmd() */ + @Override public boolean isDefaultESIProviderCmd() { if (getString(USE_DEFAULT_ESI_PROVIDER_CMD) == null || getString(USE_DEFAULT_ESI_PROVIDER_CMD).length() == 0) { // if no property then default to true @@ -141,6 +150,7 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setUseDefaultESIProviderCmd(boolean) */ + @Override public void setUseDefaultESIProviderCmd(boolean on) throws CoreException { putString(USE_DEFAULT_ESI_PROVIDER_CMD, Boolean.toString(on)); } @@ -148,6 +158,7 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#getESIProviderCommand() */ + @Override public IPath getESIProviderCommand() { if (isDefaultESIProviderCmd()) { String command = getESIProviderParameter("defaultCommand"); //$NON-NLS-1$ @@ -162,13 +173,15 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setESIProviderCommand(org.eclipse.core.runtime.IPath) */ + @Override public void setESIProviderCommand(IPath command) throws CoreException { putString(ESI_PROVIDER_COMMAND, command.toString()); } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#getESIProviderArguments() */ + @Override public String getESIProviderArguments() { if (isDefaultESIProviderCmd()) { String attributes = getESIProviderParameter("defaultAttributes"); //$NON-NLS-1$ @@ -183,6 +196,7 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setESIProviderArguments(java.lang.String) */ + @Override public void setESIProviderArguments(String args) throws CoreException { putString(ESI_PROVIDER_ARGUMENTS, args); } @@ -190,20 +204,22 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#getESIProviderConsoleParserId() */ + @Override public String getESIProviderConsoleParserId() { String parserId = getString(ESI_PROVIDER_PARSER_ID); if (parserId == null || parserId.length() == 0) { String[] parserIds = MakeCorePlugin.getDefault(). getScannerInfoConsoleParserIds("externalScannerInfoProvider"); //$NON-NLS-1$ // the default is the first one in the registry - parserId = parserIds[0]; + parserId = parserIds[0]; } return parserId; } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setESIProviderConsoleParserId(java.lang.String) */ + @Override public void setESIProviderConsoleParserId(String parserId) throws CoreException { putString(ESI_PROVIDER_PARSER_ID, parserId); } @@ -211,6 +227,7 @@ public class ScannerConfigInfoFactory { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#isSIProblemGenerationEnabled() */ + @Override public boolean isSIProblemGenerationEnabled() { if (getString(SI_PROBLEM_GENERATION_ENABLED) == null || getString(SI_PROBLEM_GENERATION_ENABLED).length() == 0) { // if no property then default to true @@ -218,10 +235,11 @@ public class ScannerConfigInfoFactory { } return getBoolean(SI_PROBLEM_GENERATION_ENABLED); } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo#setSIProblemGenerationEnabled(boolean) */ + @Override public void setSIProblemGenerationEnabled(boolean enabled) throws CoreException { putString(SI_PROBLEM_GENERATION_ENABLED, Boolean.toString(enabled)); } @@ -256,7 +274,7 @@ public class ScannerConfigInfoFactory { return null; } } - + private static class Preference extends Store { private Preferences prefs; private String builderID; @@ -290,7 +308,7 @@ public class ScannerConfigInfoFactory { return builderID; } } - + private static class BuildProperty extends Store { private IProject project; private String builderID; @@ -304,7 +322,7 @@ public class ScannerConfigInfoFactory { throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), -1, MakeMessages.getString("ScannerConfigInfoFactory.Missing_Builder")//$NON-NLS-1$ - + builderID, null)); + + builderID, null)); } Map bArgs = builder.getArguments(); args = bArgs; diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java index d2960985842..26fcd27f749 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/AbstractGCCBOPConsoleParser.java @@ -19,13 +19,13 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser; import org.eclipse.cdt.make.internal.core.MakeMessages; import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil; import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance; -import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager; import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.BuildOutputProvider; +import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager; import org.eclipse.core.resources.IProject; /** * Common stuff for all GNU build output parsers - * + * * @author vhirsl */ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsoleParser { @@ -35,10 +35,10 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole protected static final String DASHIDASH= "-I-"; //$NON-NLS-1$ protected static final String DASHI= "-I"; //$NON-NLS-1$ protected static final String DASHD= "-D"; //$NON-NLS-1$ - + private IProject project; protected IScannerInfoCollector collector; - + private boolean bMultiline = false; private String sMultiline = ""; //$NON-NLS-1$ @@ -65,7 +65,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole /** * Returns array of additional compiler commands to look for - * + * * @return String[] */ private String[] computeCompilerCommands() { @@ -86,13 +86,14 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole } } } - return COMPILER_INVOCATION; + return COMPILER_INVOCATION; } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String) */ - public boolean processLine(String line) { + @Override + public boolean processLine(String line) { boolean rc = false; int lineBreakPos = line.length()-1; char[] lineChars = line.toCharArray(); @@ -123,7 +124,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole String make = line.substring(0, firstColon + 1); if (firstColon != -1 && make.indexOf("make") != -1) { //$NON-NLS-1$ boolean enter = false; - String msg = line.substring(firstColon + 1).trim(); + String msg = line.substring(firstColon + 1).trim(); if ((enter = msg.startsWith(MakeMessages.getString("AbstractGCCBOPConsoleParser_EnteringDirectory"))) || //$NON-NLS-1$ (msg.startsWith(MakeMessages.getString("AbstractGCCBOPConsoleParser_LeavingDirectory")))) { //$NON-NLS-1$ int s = msg.indexOf('`'); @@ -146,7 +147,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole int num = 0; if (s != -1) { int e = line.indexOf(']'); - String number = line.substring(s + 1, e).trim(); + String number = line.substring(s + 1, e).trim(); try { num = Integer.parseInt(number); } catch (NumberFormatException exc) { @@ -156,21 +157,22 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole } protected abstract AbstractGCCBOPConsoleParserUtility getUtility(); - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#shutdown() */ - public void shutdown() { + @Override + public void shutdown() { if (getUtility() != null) { getUtility().reportProblems(); } } - + /** - * Tokenizes a line into an array of commands. Commands are separated by + * Tokenizes a line into an array of commands. Commands are separated by * ';', '&&' or '||'. Tokens are separated by whitespace unless found inside * of quotes, back-quotes, or double quotes. - * Outside of single-, double- or back-quotes a backslash escapes white-spaces, all quotes, + * Outside of single-, double- or back-quotes a backslash escapes white-spaces, all quotes, * the backslash, '&' and '|'. * A backslash used for escaping is removed. * Quotes other than the back-quote plus '&&', '||', ';' are removed, also. @@ -182,14 +184,14 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole ArrayList commands= new ArrayList(); ArrayList tokens= new ArrayList(); StringBuffer token= new StringBuffer(); - + final char[] input= line.toCharArray(); boolean nextEscaped= false; char currentQuote= 0; for (int i = 0; i < input.length; i++) { final char c = input[i]; final boolean escaped= nextEscaped; nextEscaped= false; - + if (currentQuote != 0) { if (c == currentQuote) { if (escaped) { @@ -255,7 +257,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole endCommand(token, tokens, commands); } break; - + default: if (Character.isWhitespace(c)) { if (escaped) { @@ -277,7 +279,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole endCommand(token, tokens, commands); return commands.toArray(new String[commands.size()][]); } - + private void endCommand(StringBuffer token, ArrayList tokens, ArrayList commands) { endToken(token, tokens); if (!tokens.isEmpty()) { @@ -291,7 +293,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole token.setLength(0); } } - + protected boolean processSingleLine(String line) { boolean rc= false; String[][] tokens= tokenize(line, true); @@ -316,7 +318,7 @@ public abstract class AbstractGCCBOPConsoleParser implements IScannerInfoConsole } return rc; } - + protected int findCompilerInvocation(String[] tokens) { for (int i = 0; i < tokens.length; i++) { final String token = tokens[i].toLowerCase(); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java index 46a8263cb64..8c6b1889de1 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java @@ -19,6 +19,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; + import org.eclipse.cdt.core.IMarkerGenerator; import org.eclipse.cdt.internal.core.resources.ResourceLookup; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector; @@ -32,7 +33,7 @@ import org.eclipse.core.runtime.IPath; /** * GCC per file build output parser - * + * * @author vhirsl */ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser { @@ -40,13 +41,14 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser { ".c", ".cc", ".cpp", ".cxx", ".C", ".CC", ".CPP", ".CXX" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ }; private final static List FILE_EXTENSIONS_LIST = Arrays.asList(FILE_EXTENSIONS); - + private GCCPerFileBOPConsoleParserUtility fUtil; - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator) */ - public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { + @Override + public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { fUtil = (project != null && workingDirectory != null && markerGenerator != null) ? new GCCPerFileBOPConsoleParserUtility(project, workingDirectory, markerGenerator) : null; super.startup(project, collector); @@ -65,7 +67,7 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser { */ @Override protected boolean processCommand(String[] tokens) { - // GCC C/C++ compiler invocation + // GCC C/C++ compiler invocation int compilerInvocationIndex= findCompilerInvocation(tokens); if (compilerInvocationIndex < 0) { return false; @@ -117,7 +119,7 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser { tokens[i]= "SHORT_NAME" + token.substring(shortFileName.length()); //$NON-NLS-1$ } } - + IFile file= null; IPath baseDirectory= fUtil.getBaseDirectory(); if (baseDirectory.isPrefixOf(pFilePath) || baseDirectory.setDevice(null).isPrefixOf(pFilePath)) { diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java index 6162cf9c629..9201476a89f 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java @@ -26,7 +26,7 @@ import org.eclipse.core.runtime.IPath; /** * Console parser for generated makefile output - * + * * @author vhirsl */ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser { @@ -39,9 +39,9 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser { private final static int NO_INCLUDES = 0; private final static int QUOTE_INCLUDES = 1; private final static int INCLUDES = 2; - + private IScannerInfoCollector fCollector = null; - + private int expectingIncludes = NO_INCLUDES; private List symbols; private List includes; @@ -51,14 +51,16 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator) */ - public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { + @Override + public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { this.fCollector = collector; } /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String) */ - public boolean processLine(String line) { + @Override + public boolean processLine(String line) { boolean rc = false; line= line.trim(); TraceUtil.outputTrace("GCCPerFileSIPConsoleParser parsing line: [", line, "]"); //$NON-NLS-1$//$NON-NLS-2$ @@ -114,14 +116,15 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser { if (!includes.contains(line)) includes.add(line); } - + return rc; } /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown() */ - public void shutdown() { + @Override + public void shutdown() { // Map scannerInfo = new HashMap(); // scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes); // scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java index 496b9127042..ef2d34dab81 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerInfoConsoleParser.java @@ -30,18 +30,19 @@ import org.eclipse.core.runtime.Path; /** * Parses gcc and g++ output for -I and -D parameters. - * + * * @author vhirsl */ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser { protected ScannerInfoConsoleParserUtility fUtil = null; private String fDefaultMacroDefinitionValue= "1"; //$NON-NLS-1$ - + /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator) */ - public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { + @Override + public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { fUtil = (project != null && workingDirectory != null && markerGenerator != null) ? new ScannerInfoConsoleParserUtility(project, workingDirectory, markerGenerator) : null; super.startup(project, collector); @@ -61,7 +62,7 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser { if (compilerInvocationIdx<0) { return false; } - + if (compilerInvocationIdx+1 >= tokens.length) { return false; } @@ -164,7 +165,7 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser { return false; // return when no file was given (analogous to GCCPerFileBOPConsoleParser) } - IProject project = getProject(); + IProject project = getProject(); IFile file = null; List translatedIncludes = includes; if (includes.size() > 0) { @@ -200,7 +201,7 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser { } return true; } - + public void setDefaultMacroDefinitionValue(String val) { if (val != null) { fDefaultMacroDefinitionValue= val; diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java index 16e1d2f6c74..bd42c16fd97 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCSpecsConsoleParser.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation * Markus Schorn (Wind River Systems) @@ -30,7 +30,7 @@ import org.eclipse.core.runtime.IPath; * Parses output of gcc -c -v specs.c or * g++ -c -v specs.cpp * command - * + * * @author vhirsl */ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser { @@ -39,7 +39,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser { private IProject fProject = null; protected IScannerInfoCollector fCollector = null; - + private boolean expectingIncludes = false; protected List symbols = new ArrayList(); protected List includes = new ArrayList(); @@ -47,7 +47,8 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator) */ - public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { + @Override + public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) { this.fProject = project; this.fCollector = collector; } @@ -55,6 +56,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser { /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#processLine(java.lang.String) */ + @Override public boolean processLine(String line) { boolean rc = false; line= line.trim(); @@ -89,7 +91,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser { if (defineParts.length > 2) { symbol += defineParts[2]; } - if (!symbols.contains(symbol)) { + if (!symbols.contains(symbol)) { symbols.add(symbol); } } @@ -106,13 +108,14 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser { if (!includes.contains(line)) includes.add(line); } - + return rc; } /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParser#shutdown() */ + @Override public void shutdown() { Map> scannerInfo = new HashMap>(); scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes); diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/SCJobsUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/SCJobsUtil.java index 0cf997ac8dd..188b2054a85 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/SCJobsUtil.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/jobs/SCJobsUtil.java @@ -34,7 +34,7 @@ import org.eclipse.core.runtime.SafeRunner; /** * Utility class for build and job related functionality - * + * * @author vhirsl */ public class SCJobsUtil { @@ -54,7 +54,7 @@ public class SCJobsUtil { public void set(boolean rc) { this.rc = rc; } - + @Override public String toString() { return rc ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$ @@ -69,7 +69,7 @@ public class SCJobsUtil { final IProgressMonitor monitor) { return getProviderScannerInfo(project, buildInfo.getContext(), buildInfo, monitor); } - + public static boolean getProviderScannerInfo(final IProject project, final InfoContext context, final IScannerConfigBuilderInfo2 buildInfo, @@ -90,7 +90,8 @@ public class SCJobsUtil { if (esiProvider != null) { ISafeRunnable runnable = new ISafeRunnable() { - public void run() { + @Override + public void run() { // TODO we need the environment for the project here... ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(project); ICConfigurationDescription configDesc = projDesc.getActiveConfiguration(); @@ -104,12 +105,13 @@ public class SCJobsUtil { esiProvider.invokeProvider(monitor, project, context, providerId, buildInfo, collector, env); rc.set(true); } - - public void handleException(Throwable exception) { + + @Override + public void handleException(Throwable exception) { rc.set(false); MakeCorePlugin.log(exception); } - + }; SafeRunner.run(runnable); } @@ -143,12 +145,14 @@ public class SCJobsUtil { final IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector; ISafeRunnable runnable = new ISafeRunnable() { - public void run() throws Exception { + @Override + public void run() throws Exception { collector2.updateScannerConfiguration(monitor); rc.set(true); } - - public void handleException(Throwable exception) { + + @Override + public void handleException(Throwable exception) { rc.set(false); MakeCorePlugin.log(exception); } @@ -156,7 +160,7 @@ public class SCJobsUtil { }; SafeRunner.run(runnable); } - + return rc.get(); } @@ -180,21 +184,23 @@ public class SCJobsUtil { if (buildInfo.isBuildOutputFileActionEnabled()) { ISafeRunnable runnable = new ISafeRunnable() { - - public void run() { + + @Override + public void run() { esiProvider.invokeProvider(monitor, project, context, null, buildInfo, collector, null); rc.set(true); } - - public void handleException(Throwable exception) { + + @Override + public void handleException(Throwable exception) { rc.set(false); MakeCorePlugin.log(exception); } - + }; SafeRunner.run(runnable); } - + return rc.get(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java index 8f9cbfb9c37..1b8d8b8d146 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation * Tianchao Li (tianchao.li@gmail.com) - arbitrary build directory (bug #136136) @@ -51,7 +51,7 @@ import org.osgi.service.prefs.BackingStoreException; /** * New default external scanner info provider of type 'run' - * + * * @author vhirsl */ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { @@ -70,19 +70,21 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { protected IPath fWorkingDirectory; protected IPath fCompileCommand; protected String[] fCompileArguments; - + private SCMarkerGenerator markerGenerator = new SCMarkerGenerator(); - public boolean invokeProvider(IProgressMonitor monitor, IResource resource, + @Override + public boolean invokeProvider(IProgressMonitor monitor, IResource resource, String providerId, IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector) { return invokeProvider(monitor, resource, new InfoContext(resource.getProject()), providerId, buildInfo, collector, null); } - - public boolean invokeProvider(IProgressMonitor monitor, - IResource resource, + + @Override + public boolean invokeProvider(IProgressMonitor monitor, + IResource resource, InfoContext context, - String providerId, + String providerId, IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector, Properties env) { @@ -91,7 +93,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { this.providerId = providerId; this.buildInfo = buildInfo; this.collector = collector; - + IProject currentProject = resource.getProject(); // call a subclass to initialize protected fields if (!initialize()) { @@ -101,7 +103,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { monitor = new NullProgressMonitor(); } monitor.beginTask(MakeMessages.getString("ExternalScannerInfoProvider.Reading_Specs"), 100); //$NON-NLS-1$ - + try { ILanguage language = context.getLanguage(); IConsole console; @@ -118,7 +120,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { // Before launching give visual cues via the monitor monitor.subTask(MakeMessages.getString("ExternalScannerInfoProvider.Reading_Specs")); //$NON-NLS-1$ - + String errMsg = null; ICommandLauncher launcher = new CommandLauncher(); launcher.setProject(currentProject); @@ -198,29 +200,29 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { } return true; } - + protected IPath getCommandToLaunch() { return fCompileCommand; } - + protected String[] getCommandLineOptions() { // add additional arguments // subclass can change default behavior - return prepareArguments( + return prepareArguments( buildInfo.isUseDefaultProviderCommand(providerId)); } - + private void printLine(OutputStream stream, String msg) throws IOException { stream.write((msg + NEWLINE).getBytes()); stream.flush(); } - + /** - * Initialization of protected fields. + * Initialization of protected fields. * Subclasses are most likely to override default implementation. */ protected boolean initialize() { - + IProject currProject = resource.getProject(); //fWorkingDirectory = resource.getProject().getLocation(); URI workingDirURI = MakeBuilderUtil.getBuildDirectoryURI(currProject, MakeBuilder.BUILDER_ID); @@ -228,12 +230,12 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { if(pathString != null) { fWorkingDirectory = new Path(pathString); } - + else { // blow up throw new IllegalStateException(); } - + fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId)); fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(buildInfo.getProviderRunArguments(providerId), "\"");//$NON-NLS-1$ return (fCompileCommand != null); @@ -261,7 +263,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { private Properties getEnvMap(ICommandLauncher launcher, Properties initialEnv) { // Set the environmennt, some scripts may need the CWD var to be set. Properties props = initialEnv != null ? initialEnv : launcher.getEnvironment(); - + if (fWorkingDirectory != null) { props.put("CWD", fWorkingDirectory.toOSString()); //$NON-NLS-1$ props.put("PWD", fWorkingDirectory.toOSString()); //$NON-NLS-1$ @@ -309,7 +311,7 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { /** * Check preference to stream output of scanner discovery to a console. - * + * * @return boolean preference value */ public static boolean isConsoleEnabled() { @@ -317,5 +319,5 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider { .getBoolean(PREF_CONSOLE_ENABLED, false); return value; } - + } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultSIFileReader.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultSIFileReader.java index 949c16879ec..3675378aac6 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultSIFileReader.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultSIFileReader.java @@ -40,26 +40,28 @@ import org.eclipse.core.runtime.IProgressMonitor; /** * New default external scanner info provider of type 'open' - * + * * @author vhirsl */ public class DefaultSIFileReader implements IExternalScannerInfoProvider { private static final String EXTERNAL_SI_PROVIDER_CONSOLE_ID = MakeCorePlugin.getUniqueIdentifier() + ".ExternalScannerInfoProviderConsole"; //$NON-NLS-1$ private long fileSize = 0; - + private SCMarkerGenerator markerGenerator = new SCMarkerGenerator(); - public boolean invokeProvider(IProgressMonitor monitor, IResource resource, + @Override + public boolean invokeProvider(IProgressMonitor monitor, IResource resource, String providerId, IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector) { return invokeProvider(monitor, resource, new InfoContext(resource.getProject()), providerId, buildInfo, collector, null); } - - public boolean invokeProvider(IProgressMonitor monitor, - IResource resource, + + @Override + public boolean invokeProvider(IProgressMonitor monitor, + IResource resource, InfoContext context, - String providerId, + String providerId, IScannerConfigBuilderInfo2 buildInfo, IScannerInfoCollector collector, Properties env) { @@ -69,7 +71,7 @@ public class DefaultSIFileReader implements IExternalScannerInfoProvider { BufferedReader reader = getStreamReader(buildInfo.getBuildOutputFilePath()); if (reader == null) return rc; - + try { // output IConsole console = CCorePlugin.getDefault().getConsole(EXTERNAL_SI_PROVIDER_CONSOLE_ID); @@ -81,16 +83,16 @@ public class DefaultSIFileReader implements IExternalScannerInfoProvider { catch (CoreException e) { ostream = null; } - + // get build location IPath buildDirectory = MakeBuilderUtil.getBuildDirectory(project, MakeBuilder.BUILDER_ID); - + ConsoleOutputSniffer sniffer = ScannerInfoConsoleParserFactory. getMakeBuilderOutputSniffer(ostream, null, project, context, buildDirectory, buildInfo, markerGenerator, collector); if (sniffer != null) { ostream = sniffer.getOutputStream(); } - + if (ostream != null) { rc = readFileToOutputStream(monitor, reader, ostream); } @@ -100,7 +102,7 @@ public class DefaultSIFileReader implements IExternalScannerInfoProvider { } catch (IOException e) { MakeCorePlugin.log(e); } - } + } return rc; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java index ab5f2e5ea8e..e7881ff98f0 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation * Markus Schorn (Wind River Systems) @@ -20,22 +20,22 @@ import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; -import java.util.Map.Entry; import org.eclipse.cdt.internal.core.SafeStringInterner; import org.eclipse.cdt.make.core.MakeCorePlugin; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo2; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner; import org.eclipse.cdt.make.core.scannerconfig.InfoContext; import org.eclipse.cdt.make.core.scannerconfig.PathInfo; import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes; -import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; -import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable; -import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo; -import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo2; import org.eclipse.cdt.make.internal.core.MakeMessages; import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore; import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil; @@ -57,7 +57,7 @@ import org.w3c.dom.NodeList; /** * Per file scanner info collector - * + * * @author vhirsl */ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoCollectorCleaner { @@ -65,7 +65,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC protected static final int QUOTE_INCLUDE_PATH = 2; protected static final int INCLUDE_FILE = 3; protected static final int MACROS_FILE = 4; - + protected class ScannerInfoData implements IDiscoveredScannerInfoSerializable { protected final Map> commandIdToFilesMap; // command id and set of files it applies to protected final Map fileToCommandIdMap; // maps each file to the corresponding command id @@ -80,30 +80,31 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#serialize(org.w3c.dom.Element) */ - public void serialize(Element collectorElem) { + @Override + public void serialize(Element collectorElem) { synchronized (PerFileSICollector.this.fLock) { Document doc = collectorElem.getOwnerDocument(); - + List commandIds = new ArrayList(commandIdCommandMap.keySet()); Collections.sort(commandIds); for (Integer commandId : commandIds) { CCommandDSC command = commandIdCommandMap.get(commandId); - - Element cmdElem = doc.createElement(CC_ELEM); + + Element cmdElem = doc.createElement(CC_ELEM); collectorElem.appendChild(cmdElem); - cmdElem.setAttribute(ID_ATTR, commandId.toString()); + cmdElem.setAttribute(ID_ATTR, commandId.toString()); cmdElem.setAttribute(FILE_TYPE_ATTR, command.appliesToCPPFileType() ? "c++" : "c"); //$NON-NLS-1$ //$NON-NLS-2$ // write command and scanner info command.serialize(cmdElem); // write files command applies to - Element filesElem = doc.createElement(APPLIES_TO_ATTR); + Element filesElem = doc.createElement(APPLIES_TO_ATTR); cmdElem.appendChild(filesElem); Set files = commandIdToFilesMap.get(commandId); if (files != null) { for (IFile file : files) { - Element fileElem = doc.createElement(FILE_ELEM); + Element fileElem = doc.createElement(FILE_ELEM); IPath path = file.getProjectRelativePath(); - fileElem.setAttribute(PATH_ATTR, path.toString()); + fileElem.setAttribute(PATH_ATTR, path.toString()); filesElem.appendChild(fileElem); } } @@ -114,10 +115,11 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#deserialize(org.w3c.dom.Element) */ - public void deserialize(Element collectorElem) { + @Override + public void deserialize(Element collectorElem) { synchronized (PerFileSICollector.this.fLock) { for (Node child = collectorElem.getFirstChild(); child != null; child = child.getNextSibling()) { - if (child.getNodeName().equals(CC_ELEM)) { + if (child.getNodeName().equals(CC_ELEM)) { Element cmdElem = (Element) child; boolean cppFileType = cmdElem.getAttribute(FILE_TYPE_ATTR).equals("c++"); //$NON-NLS-1$ CCommandDSC command = new CCommandDSC(cppFileType, project); @@ -145,12 +147,13 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore.IDiscoveredScannerInfoSerializable#getCollectorId() */ - public String getCollectorId() { + @Override + public String getCollectorId() { return COLLECTOR_ID; } } - + protected static class ProjectScannerInfo { IPath[] includePaths; IPath[] quoteIncludePaths; @@ -165,7 +168,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC definedSymbols.size() == 0); } } - + public static final String COLLECTOR_ID = MakeCorePlugin.getUniqueIdentifier() + ".PerFileSICollector"; //$NON-NLS-1$ protected static final String CC_ELEM = "compilerCommand"; //$NON-NLS-1$ protected static final String ID_ATTR = "id"; //$NON-NLS-1$ @@ -173,47 +176,49 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC protected static final String APPLIES_TO_ATTR = "appliesToFiles"; //$NON-NLS-1$ protected static final String FILE_ELEM = "file"; //$NON-NLS-1$ protected static final String PATH_ATTR = "path"; //$NON-NLS-1$ - + protected IProject project; protected InfoContext context; - + protected ScannerInfoData sid; // scanner info data protected ProjectScannerInfo psi = null; // sum of all scanner info - + // protected List siChangedForFileList; // list of files for which scanner info has changed protected final Map siChangedForFileMap; // (file, comandId) map for deltas protected final List siChangedForCommandIdList; // list of command ids for which scanner info has changed - + protected final SortedSet freeCommandIdPool; // sorted set of free command ids protected int commandIdCounter = 0; - + /** monitor for data access */ protected final Object fLock = new Object(); /** - * + * */ public PerFileSICollector() { sid = new ScannerInfoData(); - + // siChangedForFileList = new ArrayList(); siChangedForFileMap = new HashMap(); siChangedForCommandIdList = new ArrayList(); - + freeCommandIdPool = new TreeSet(); } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject) */ - public void setProject(IProject project) { + @Override + public void setProject(IProject project) { setInfoContext(new InfoContext(project)); } - public void setInfoContext(InfoContext context) { + @Override + public void setInfoContext(InfoContext context) { this.project = context.getProject(); this.context = context; - + try { // deserialize from SI store DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, context, sid); @@ -230,7 +235,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map) */ - public void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) { + @Override + public void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) { // check the resource String errorMessage = null; if (resource == null) { @@ -257,9 +263,9 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC TraceUtil.outputError("PerFileSICollector.contributeToScannerConfig : ", errorMessage); //$NON-NLS-1$ return; } - + IFile file = (IFile) resource; - + synchronized (fLock) { @SuppressWarnings("unchecked") Map> scanInfo = scannerInfo; @@ -292,7 +298,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC siItem = CygpathTranslator.translateIncludePaths(project, siItem); siItem = CCommandDSC.makeRelative(project, siItem); cmd.setQuoteIncludes(siItem); - + cmd.setDiscovered(true); } } @@ -317,7 +323,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC cmd.setCommandId(commandId); sid.commandIdCommandMap.put(cmd.getCommandIdAsInteger(), cmd); } - + generateFileDelta(file, cmd); } @@ -342,7 +348,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC for (IFile file : resources) { Integer commandId = siChangedForFileMap.get(file); if (commandId != null) { - + // update sid.commandIdToFilesMap Set fileSet = sid.commandIdToFilesMap.get(commandId); if (fileSet == null) { @@ -408,8 +414,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC sid.commandIdCommandMap.remove(cmdId); sid.commandIdToFilesMap.remove(cmdId); } - while (!freeCommandIdPool.isEmpty()) { - Integer last = freeCommandIdPool.last(); + while (!freeCommandIdPool.isEmpty()) { + Integer last = freeCommandIdPool.last(); if (last.intValue() == commandIdCounter) { freeCommandIdPool.remove(last); --commandIdCounter; @@ -417,16 +423,17 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC else break; } } - + protected void addScannerInfo(ScannerInfoTypes type, List delta) { // TODO Auto-generated method stub - + } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#updateScannerConfiguration(org.eclipse.core.runtime.IProgressMonitor) */ - public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException { + @Override + public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException { if (monitor == null) { monitor = new NullProgressMonitor(); } @@ -464,7 +471,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject() */ - public IDiscoveredPathInfo createPathInfoObject() { + @Override + public IDiscoveredPathInfo createPathInfoObject() { return new PerFileDiscoveredPathInfo(); } @@ -477,13 +485,14 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes) */ - public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { + @Override + public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { List rv = new ArrayList(); // check the resource String errorMessage = null; if (resource == null) { errorMessage = "resource is null";//$NON-NLS-1$ - } + } else if (!(resource instanceof IResource)) { errorMessage = "resource is not an IResource";//$NON-NLS-1$ } @@ -493,7 +502,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC else if (((IResource) resource).getProject() != project) { errorMessage = "wrong project";//$NON-NLS-1$ } - + if (errorMessage != null) { TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$ return rv; @@ -540,39 +549,44 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource) */ - public void deleteAllPaths(IResource resource) { + @Override + public void deleteAllPaths(IResource resource) { // TODO Auto-generated method stub - + } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource) */ - public void deleteAllSymbols(IResource resource) { + @Override + public void deleteAllSymbols(IResource resource) { // TODO Auto-generated method stub - + } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String) */ - public void deletePath(IResource resource, String path) { + @Override + public void deletePath(IResource resource, String path) { // TODO Auto-generated method stub - + } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String) */ - public void deleteSymbol(IResource resource, String symbol) { + @Override + public void deleteSymbol(IResource resource, String symbol) { // TODO Auto-generated method stub - + } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource) */ - public void deleteAll(IResource resource) { + @Override + public void deleteAll(IResource resource) { if (resource.equals(project)) { synchronized (fLock) { // siChangedForFileList = new ArrayList(); @@ -583,10 +597,10 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC // siChangedForFileList.add(path); siChangedForFileMap.put(file, null); } - + sid = new ScannerInfoData(); psi = null; - + commandIdCounter = 0; freeCommandIdPool.clear(); } @@ -595,21 +609,23 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /** * Per file DPI object - * + * * @author vhirsl */ protected class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject() */ - public IProject getProject() { + @Override + public IProject getProject() { return project; } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths() */ - public IPath[] getIncludePaths() { + @Override + public IPath[] getIncludePaths() { final IPath[] includepaths; final IPath[] quotepaths; synchronized (PerFileSICollector.this.fLock) { @@ -632,7 +648,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols() */ - public Map getSymbols() { + @Override + public Map getSymbols() { // return new HashMap(); synchronized (PerFileSICollector.this.fLock) { return getAllSymbols(); @@ -642,7 +659,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath) */ - public IPath[] getIncludePaths(IPath path) { + @Override + public IPath[] getIncludePaths(IPath path) { synchronized (PerFileSICollector.this.fLock) { // get the command CCommandDSC cmd = getCommand(path); @@ -660,7 +678,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getQuoteIncludePaths(org.eclipse.core.runtime.IPath) */ - public IPath[] getQuoteIncludePaths(IPath path) { + @Override + public IPath[] getQuoteIncludePaths(IPath path) { synchronized (PerFileSICollector.this.fLock) { // get the command CCommandDSC cmd = getCommand(path); @@ -678,7 +697,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath) */ - public Map getSymbols(IPath path) { + @Override + public Map getSymbols(IPath path) { synchronized (PerFileSICollector.this.fLock) { // get the command CCommandDSC cmd = getCommand(path); @@ -703,7 +723,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath) */ - public IPath[] getIncludeFiles(IPath path) { + @Override + public IPath[] getIncludeFiles(IPath path) { synchronized (PerFileSICollector.this.fLock) { // get the command CCommandDSC cmd = getCommand(path); @@ -721,7 +742,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath) */ - public IPath[] getMacroFiles(IPath path) { + @Override + public IPath[] getMacroFiles(IPath path) { synchronized (PerFileSICollector.this.fLock) { // get the command CCommandDSC cmd = getCommand(path); @@ -739,7 +761,8 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getSerializable() */ - public IDiscoveredScannerInfoSerializable getSerializable() { + @Override + public IDiscoveredScannerInfoSerializable getSerializable() { synchronized (PerFileSICollector.this.fLock) { return sid; } @@ -748,6 +771,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#isEmpty(org.eclipse.core.runtime.IPath) */ + @Override public boolean isEmpty(IPath path) { boolean rc = true; IResource resource = project.getWorkspace().getRoot().findMember(path); @@ -764,6 +788,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC return rc; } + @Override public Map getPathInfoMap() { synchronized (PerFileSICollector.this.fLock) { //TODO: do we need to cache this? @@ -772,10 +797,10 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC } } - + protected Map calculatePathInfoMap(){ assert Thread.holdsLock(fLock); - + Map map = new HashMap(sid.fileToCommandIdMap.size() + 1); Set> entrySet = sid.fileToCommandIdMap.entrySet(); for (Entry entry : entrySet) { @@ -788,19 +813,19 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC } } } - + if(project != null){ if(psi == null){ generateProjectScannerInfo(); } - + PathInfo fpi = new PathInfo(psi.includePaths, psi.quoteIncludePaths, psi.definedSymbols, psi.includeFiles, psi.macrosFiles); map.put(project, fpi); } - + return map; } - + protected static PathInfo createFilePathInfo(CCommandDSC cmd){ IPath[] includes = stringListToPathArray(cmd.getIncludes()); IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes()); @@ -813,7 +838,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC String value = ScannerConfigUtil.getSymbolValue(symbol); definedSymbols.put(key, value); } - + return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles); } @@ -845,7 +870,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC *
  • QUOTE_INCLUDE_PATH *
  • INCLUDE_FILE *
  • MACROS_FILE - * + * * @return list of IPath(s). */ protected IPath[] getAllIncludePaths(int type) { @@ -859,7 +884,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC case INCLUDE_PATH: discovered = cmd.getIncludes(); break; - case QUOTE_INCLUDE_PATH: + case QUOTE_INCLUDE_PATH: discovered = cmd.getQuoteIncludes(); break; case INCLUDE_FILE: diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java index 09b5dd66555..5b6bdd3b856 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation * Anton Leherbauer (Wind River Systems) @@ -27,6 +27,8 @@ import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.make.core.MakeCorePlugin; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; +import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo; import org.eclipse.cdt.make.core.scannerconfig.IExternalScannerInfoProvider; import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector; @@ -35,8 +37,6 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner; import org.eclipse.cdt.make.core.scannerconfig.InfoContext; import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes; -import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo; -import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo; import org.eclipse.cdt.make.internal.core.MakeMessages; import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer; import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathInfo; @@ -61,7 +61,7 @@ import org.w3c.dom.Element; /** * New per project scanner info collector - * + * * @since 3.0 * @author vhirsl */ @@ -71,22 +71,22 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn protected IProject project; protected InfoContext context; private boolean isBuiltinConfig= false; - + protected Map> discoveredSI; -// private List discoveredIncludes; +// private List discoveredIncludes; // private List discoveredSymbols; // private List discoveredTSO; // target specific options // cumulative values - protected List sumDiscoveredIncludes; + protected List sumDiscoveredIncludes; private Map sumDiscoveredSymbols; protected boolean scPersisted = false; - + public PerProjectSICollector() { discoveredSI = new HashMap>(); // discoveredIncludes = new ArrayList(); // discoveredSymbols = new ArrayList(); // discoveredTSO = new ArrayList(); -// +// sumDiscoveredIncludes = new ArrayList(); sumDiscoveredSymbols = new LinkedHashMap(); } @@ -94,6 +94,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#setProject(org.eclipse.core.resources.IProject) */ + @Override public void setProject(IProject project) { this.project = project; this.context = new InfoContext(project); @@ -112,12 +113,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(java.lang.Object, java.util.Map) */ + @Override public synchronized void contributeToScannerConfig(Object resource, @SuppressWarnings("rawtypes") Map scannerInfo) { // check the resource String errorMessage = null; if (resource == null) { errorMessage = "resource is null";//$NON-NLS-1$ - } + } else if (!(resource instanceof IResource)) { errorMessage = "resource is not an IResource";//$NON-NLS-1$ } @@ -131,7 +133,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn TraceUtil.outputError("PerProjectSICollector.contributeToScannerConfig : ", errorMessage); //$NON-NLS-1$ return; } - + if (scPersisted) { // delete discovered scanner config discoveredSI.clear(); @@ -141,13 +143,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn try { if (/*project.hasNature(MakeProjectNature.NATURE_ID) && */// limits to StandardMake projects (project.hasNature(CProjectNature.C_NATURE_ID) || - project.hasNature(CCProjectNature.CC_NATURE_ID))) { + project.hasNature(CCProjectNature.CC_NATURE_ID))) { for (Object name : scannerInfo.keySet()) { ScannerInfoTypes siType = (ScannerInfoTypes) name; @SuppressWarnings("unchecked") List delta = (List) scannerInfo.get(siType); - + List discovered = discoveredSI.get(siType); if (discovered == null) { discovered = new ArrayList(delta); @@ -159,7 +161,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn } } } - } + } catch (CoreException e) { MakeCorePlugin.log(e); } @@ -179,18 +181,18 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /** * Adds new items to the already accumulated ones preserving order - * + * * @param sumIncludes - previously accumulated items * @param includes - items to be added * @param ordered - to preserve order or append at the end * @return boolean - true if added */ protected boolean addItemsWithOrder(List sumIncludes, List includes, boolean ordered) { - if (includes.isEmpty()) + if (includes.isEmpty()) return false; - + boolean addedIncludes = false; - int insertionPoint= ordered ? 0 : sumIncludes.size(); + int insertionPoint= ordered ? 0 : sumIncludes.size(); for (String item : includes) { int pos= sumIncludes.indexOf(item); if (pos >= 0) { @@ -200,7 +202,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn } else { sumIncludes.add(insertionPoint++, item); addedIncludes = true; - } + } } return addedIncludes; } @@ -208,6 +210,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#updateScannerConfiguration(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public synchronized void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException { if (monitor == null) { monitor = new NullProgressMonitor(); @@ -215,7 +218,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn IDiscoveredPathInfo pathInfo = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project, context); if (pathInfo instanceof IPerProjectDiscoveredPathInfo) { IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) pathInfo; - + monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$ monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$ if (scannerConfigNeedsUpdate(projectPathInfo)) { @@ -242,7 +245,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn private boolean scannerConfigNeedsUpdate(IPerProjectDiscoveredPathInfo discPathInfo) { boolean addedIncludes = includePathsNeedUpdate(discPathInfo); boolean addedSymbols = definedSymbolsNeedUpdate(discPathInfo); - + return (addedIncludes | addedSymbols); } @@ -253,7 +256,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn boolean addedIncludes = false; List discoveredIncludes = discoveredSI.get(ScannerInfoTypes.INCLUDE_PATHS); if (discoveredIncludes != null) { - // Step 1. Add discovered scanner config to the existing discovered scanner config + // Step 1. Add discovered scanner config to the existing discovered scanner config // add the includes from the latest discovery // if (sumDiscoveredIncludes == null) { // sumDiscoveredIncludes = new ArrayList(discoveredIncludes); @@ -267,15 +270,15 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn // try to translate cygpaths to absolute paths List finalSumIncludes = CygpathTranslator.translateIncludePaths(project, sumDiscoveredIncludes); - + // Step 2. Get project's scanner config LinkedHashMap persistedIncludes = discPathInfo.getIncludeMap(); - + // Step 3. Merge scanner config from steps 1 and 2 // order is important, use list to preserve it ArrayList persistedKeyList = new ArrayList(persistedIncludes.keySet()); addedIncludes = addItemsWithOrder(persistedKeyList, finalSumIncludes, true); - + LinkedHashMap newPersistedIncludes; if (addedIncludes) { newPersistedIncludes = new LinkedHashMap(persistedKeyList.size()); @@ -287,10 +290,10 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn // the paths may be on EFS resources, not local Boolean includePathExists = true; URI projectLocationURI = discPathInfo.getProject().getLocationURI(); - + // use the project's location... create a URI that uses the same provider but that points to the include path URI includeURI = EFSExtensionManager.getDefault().createNewURIFromPath(projectLocationURI, include); - + // ask EFS if the path exists try { IFileStore fileStore = EFS.getStore(includeURI); @@ -301,7 +304,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn } catch (CoreException e) { MakeCorePlugin.log(e); } - + // if the include path doesn't exist, then we tell the scanner config system that the folder // has been "removed", and thus it won't show up in the UI newPersistedIncludes.put(include, !includePathExists); @@ -311,13 +314,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn else { newPersistedIncludes = persistedIncludes; } - + // Step 4. Set resulting scanner config discPathInfo.setIncludeMap(newPersistedIncludes); } return addedIncludes; } - + /** * Compare symbol definitions with already discovered. */ @@ -325,20 +328,20 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn boolean addedSymbols = false; List discoveredSymbols = discoveredSI.get(ScannerInfoTypes.SYMBOL_DEFINITIONS); if (discoveredSymbols != null) { - // Step 1. Add discovered scanner config to the existing discovered scanner config + // Step 1. Add discovered scanner config to the existing discovered scanner config // add the symbols from the latest discovery // if (sumDiscoveredSymbols == null) { // sumDiscoveredSymbols = new LinkedHashMap(); // } addedSymbols = ScannerConfigUtil.scAddSymbolsList2SymbolEntryMap(sumDiscoveredSymbols, discoveredSymbols, true); - + // Step 2. Get project's scanner config LinkedHashMap persistedSymbols = discPathInfo.getSymbolMap(); - + // Step 3. Merge scanner config from steps 1 and 2 LinkedHashMap candidateSymbols = new LinkedHashMap(persistedSymbols); addedSymbols |= ScannerConfigUtil.scAddSymbolEntryMap2SymbolEntryMap(candidateSymbols, sumDiscoveredSymbols); - + // Step 4. Set resulting scanner config discPathInfo.setSymbolMap(candidateSymbols); } @@ -348,13 +351,14 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#getCollectedScannerInfo(java.lang.Object, org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes) */ - public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { + @Override + public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { List rv = null; // check the resource String errorMessage = null; if (resource == null) { errorMessage = "resource is null";//$NON-NLS-1$ - } + } else if (!(resource instanceof IResource)) { errorMessage = "resource is not an IResource";//$NON-NLS-1$ } @@ -364,7 +368,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn else if (((IResource) resource).getProject() != project) { errorMessage = "wrong project";//$NON-NLS-1$ } - + if (errorMessage != null) { TraceUtil.outputError("PerProjectSICollector.getCollectedScannerInfo : ", errorMessage); //$NON-NLS-1$ } @@ -406,7 +410,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllPaths(org.eclipse.core.resources.IResource) */ - public void deleteAllPaths(IResource resource) { + @Override + public void deleteAllPaths(IResource resource) { IProject project = resource.getProject(); if (project != null && project.equals(this.project)) { sumDiscoveredIncludes.clear(); @@ -416,7 +421,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteAllSymbols(org.eclipse.core.resources.IResource) */ - public void deleteAllSymbols(IResource resource) { + @Override + public void deleteAllSymbols(IResource resource) { IProject project = resource.getProject(); if (project != null && project.equals(this.project)) { sumDiscoveredSymbols.clear(); @@ -426,7 +432,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deletePath(org.eclipse.core.resources.IResource, java.lang.String) */ - public void deletePath(IResource resource, String path) { + @Override + public void deletePath(IResource resource, String path) { IProject project = resource.getProject(); if (project != null && project.equals(this.project)) { sumDiscoveredIncludes.remove(path); @@ -436,10 +443,11 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorUtil#deleteSymbol(org.eclipse.core.resources.IResource, java.lang.String) */ - public void deleteSymbol(IResource resource, String symbol) { + @Override + public void deleteSymbol(IResource resource, String symbol) { IProject project = resource.getProject(); if (project != null && project.equals(this.project)) { - // remove it from the Map of SymbolEntries + // remove it from the Map of SymbolEntries ScannerConfigUtil.removeSymbolEntryValue(symbol, sumDiscoveredSymbols); } } @@ -447,7 +455,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource) */ - public void deleteAll(IResource resource) { + @Override + public void deleteAll(IResource resource) { deleteAllPaths(resource); deleteAllSymbols(resource); } @@ -455,7 +464,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject() */ - public IDiscoveredPathInfo createPathInfoObject() { + @Override + public IDiscoveredPathInfo createPathInfoObject() { DiscoveredPathInfo pathInfo = new DiscoveredPathInfo(project); try { DiscoveredScannerInfoStore.getInstance().loadDiscoveredScannerInfoFromState(project, context, pathInfo); @@ -463,13 +473,13 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn catch (CoreException e) { MakeCorePlugin.log(e); } - return pathInfo; + return pathInfo; } /** * Static method to return compiler built-in scanner info. * Preconditions: resource has to be contained by a project that has following natures: - * C nature, CC nature (for C++ projects), Make nature and ScannerConfig nature + * C nature, CC nature (for C++ projects), Make nature and ScannerConfig nature */ public static void calculateCompilerBuiltins(final IProject project) throws CModelException { createDiscoveredPathContainer(project, new NullProgressMonitor()); @@ -484,10 +494,11 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn ((IScannerInfoCollectorCleaner) collector).deleteAll(project); } final IExternalScannerInfoProvider esiProvider = profileInstance.createExternalScannerInfoProvider("specsFile");//$NON-NLS-1$ - + // Set the arguments for the provider - + ISafeRunnable runnable = new ISafeRunnable() { + @Override public void run() throws CoreException { IProgressMonitor monitor = new NullProgressMonitor(); esiProvider.invokeProvider(monitor, project, "specsFile", buildInfo, collector);//$NON-NLS-1$ @@ -496,7 +507,8 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn collector2.updateScannerConfiguration(monitor); } } - + + @Override public void handleException(Throwable exception) { if (exception instanceof OperationCanceledException) { throw (OperationCanceledException) exception; @@ -505,7 +517,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn }; SafeRunner.run(runnable); } - + private static void createDiscoveredPathContainer(IProject project, IProgressMonitor monitor) throws CModelException { IPathEntry container = CoreModel.newContainerEntry(DiscoveredPathContainer.CONTAINER_ID); ICProject cProject = CoreModel.getDefault().create(project); @@ -521,13 +533,14 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn MakeCorePlugin.getDefault().getDiscoveryManager().removeDiscoveredInfo(project); } + @Override public void setInfoContext(InfoContext context) { this.context = context; this.project = context.getProject(); } - + public InfoContext getContext(){ return this.context; } - + } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java index 85ebeab08bc..719beb22e19 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation *******************************************************************************/ @@ -29,13 +29,13 @@ import org.eclipse.core.runtime.jobs.Job; /** * Scanner config discovery related marker generator - * + * * @author vhirsl */ public class SCMarkerGenerator implements IMarkerGenerator { /** - * + * */ public SCMarkerGenerator() { super(); @@ -44,6 +44,7 @@ public class SCMarkerGenerator implements IMarkerGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.core.resources.IResource, int, java.lang.String, int, java.lang.String) */ + @Override public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) { ProblemMarkerInfo info = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar); addMarker(info); @@ -52,6 +53,7 @@ public class SCMarkerGenerator implements IMarkerGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo) */ + @Override public void addMarker(final ProblemMarkerInfo problemMarkerInfo) { // we have to add the marker in the job or we can deadlock other // threads that are responding to a resource delta by doing something @@ -79,7 +81,7 @@ public class SCMarkerGenerator implements IMarkerGenerator { } catch (CoreException e) { return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_Error_Adding_Markers, e); } - + try { marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER); marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description); @@ -87,7 +89,7 @@ public class SCMarkerGenerator implements IMarkerGenerator { marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber); marker.setAttribute(IMarker.CHAR_START, -1); marker.setAttribute(IMarker.CHAR_END, -1); - + if (problemMarkerInfo.variableName != null) { marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName); } @@ -95,7 +97,7 @@ public class SCMarkerGenerator implements IMarkerGenerator { } catch (CoreException e) { return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_Error_Adding_Markers, e); } - + return Status.OK_STATUS; } }; @@ -131,7 +133,7 @@ public class SCMarkerGenerator implements IMarkerGenerator { MakeCorePlugin.log(e.getStatus()); } } - + int mapMarkerSeverity(int severity) { switch (severity) { case SEVERITY_ERROR_BUILD : diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java index db1b2df83ee..bc177dc2ac1 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigInfoFactory2.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation * James Blackburn (Broadcom Corp.) @@ -42,11 +42,11 @@ import org.eclipse.core.runtime.Status; /** * New ScannerConfigInfoFactory - * + * * @author vhirsl */ public class ScannerConfigInfoFactory2 { - // build properties + // build properties private static final String SCANNER_CONFIG = "scannerConfiguration"; //$NON-NLS-1$ private static final String SC_AUTODISCOVERY = "autodiscovery"; //$NON-NLS-1$ private static final String ENABLED = "enabled"; //$NON-NLS-1$ @@ -81,19 +81,19 @@ public class ScannerConfigInfoFactory2 { private static final String SI_PROVIDER_PARSER_ENABLED = ".parser.enabled";//$NON-NLS-1$ private static final String INFO_INSTANCE_IDS = SCD + "instanceIds";//$NON-NLS-1$ private static final String DELIMITER = ";";//$NON-NLS-1$ - - + + private static final String ELEMENT_CS_INFO = "scannerConfigBuildInfo";//$NON-NLS-1$ private static final String ATTRIBUTE_CS_INFO_INSTANCE_ID = "instanceId";//$NON-NLS-1$ - + private static class ScannerConfigInfoSet extends StoreSet { private IProject fProject; - + ScannerConfigInfoSet(IProject project, String profileId){ this.fProject = project; load(profileId); } - + private void load(String profileId) { ICDescriptor descriptor; try { @@ -124,6 +124,7 @@ public class ScannerConfigInfoFactory2 { } } + @Override public void save() throws CoreException { save(false); } @@ -132,19 +133,19 @@ public class ScannerConfigInfoFactory2 { if (isDirty()) { ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(fProject, true); ICStorageElement sc = descriptor.getProjectStorageElement(SCANNER_CONFIG); - + // Clear all child settings sc.clear(); - + BuildProperty prop = (BuildProperty)fMap.get(new InfoContext(fProject)); prop.store(sc); - + for (Entry entry : fMap.entrySet()) { - + InfoContext context = entry.getKey(); if(context.isDefaultContext()) continue; - + String instanceId = context.getInstanceId(); if(instanceId.length() == 0) continue; @@ -152,19 +153,20 @@ public class ScannerConfigInfoFactory2 { BuildProperty p = (BuildProperty)entry.getValue(); if(p == prop) continue; - + ICStorageElement el = sc.createChild(ELEMENT_CS_INFO); el.setAttribute(ATTRIBUTE_CS_INFO_INSTANCE_ID, instanceId); p.store(el); } - + if(serializeDescriptor) descriptor.saveProjectData(); - + fIsDirty = false; } } - + + @Override public IProject getProject() { return fProject; } @@ -174,51 +176,52 @@ public class ScannerConfigInfoFactory2 { return new BuildProperty(this, fProject, context, base, profileId); } } - + private static class PreferenceSet extends StoreSet { - private Preferences prefs; + private Preferences prefs; private boolean useDefaults; PreferenceSet(Preferences prefs, String profileId, boolean loadDefaults){ this.prefs = prefs; this.useDefaults = loadDefaults; load(profileId); } - + private void load(String profileId) { InfoContext defaultContext = new InfoContext(null); String instancesStr = getString(INFO_INSTANCE_IDS); String[] instanceIds = CDataUtil.stringToArray(instancesStr, DELIMITER); Preference pref = new Preference(this, prefs, defaultContext, profileId, useDefaults); fMap.put(defaultContext, pref); - + if(instanceIds != null && instanceIds.length != 0){ for(int i = 0; i < instanceIds.length; i++) { String id = instanceIds[i]; if(id.length() == 0) continue; - + InfoContext c = new InfoContext(null, id); - + Preference p = new Preference(this, prefs, c, profileId, useDefaults); fMap.put(c, p); } } } - + + @Override public void save() throws CoreException { if (isDirty()) { - + Set idSet = new HashSet(fMap.size() - 1); - + Preference pref = (Preference)fMap.get(new InfoContext(null)); pref.store(); - + for (Entry entry : fMap.entrySet()) { InfoContext context = entry.getKey(); if(context.isDefaultContext()) continue; - + String instanceId = context.getInstanceId(); if(instanceId.length() == 0) continue; @@ -228,20 +231,21 @@ public class ScannerConfigInfoFactory2 { continue; p.store(); - + idSet.add(instanceId); } - + if(idSet.size() != 0){ String[] ids = idSet.toArray(new String[idSet.size()]); String idsString = CDataUtil.arrayToString(ids, DELIMITER); set(INFO_INSTANCE_IDS, idsString); } - + fIsDirty = false; } } - + + @Override public IProject getProject() { return null; } @@ -250,14 +254,14 @@ public class ScannerConfigInfoFactory2 { protected Store doCreateStore(InfoContext context, Store base, String profileId) { return new Preference(this, prefs, context, base, profileId, useDefaults); } - + private String getString(String name) { if (useDefaults) { return prefs.getDefaultString(name); } return prefs.getString(name); } - + private void set(String name, String value) { if (useDefaults) { prefs.setDefault(name, value); @@ -268,14 +272,15 @@ public class ScannerConfigInfoFactory2 { } } - + private static abstract class StoreSet implements IScannerConfigBuilderInfo2Set { protected HashMap fMap = new HashMap(); protected boolean fIsDirty; - + StoreSet(){ } - + + @Override public IScannerConfigBuilderInfo2 createInfo(InfoContext context, IScannerConfigBuilderInfo2 base, String profileId){ fIsDirty = true; @@ -283,38 +288,43 @@ public class ScannerConfigInfoFactory2 { fMap.put(context, store); return store; } - + protected abstract Store doCreateStore(InfoContext context, Store base, String profileId); + @Override public IScannerConfigBuilderInfo2 createInfo(InfoContext context, IScannerConfigBuilderInfo2 base){ fIsDirty = true; return createInfo(context, base, ScannerConfigProfileManager.NULL_PROFILE_ID); } + @Override public InfoContext[] getContexts() { return fMap.keySet().toArray(new InfoContext[fMap.size()]); } + @Override public IScannerConfigBuilderInfo2 getInfo(InfoContext context) { return fMap.get(context); } + @Override public Map getInfoMap() { return Collections.unmodifiableMap(fMap); } + @Override public IScannerConfigBuilderInfo2 removeInfo(InfoContext context) throws CoreException { checkRemoveInfo(context); fIsDirty = true; return fMap.remove(context); } - + private void checkRemoveInfo(InfoContext context) throws CoreException{ if(context.isDefaultContext()) throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, MakeConfigurationDataProviderMessages.getString("ScannerConfigInfoFactory2.0"))); //$NON-NLS-1$ } - + public boolean isDirty(){ if(fIsDirty) return true; @@ -322,15 +332,17 @@ public class ScannerConfigInfoFactory2 { if(((Store)prop).isDirty) return true; } - + return false; } + @Override public IScannerConfigBuilderInfo2 createInfo(InfoContext context) { fIsDirty = true; return createInfo(context, ScannerConfigProfileManager.NULL_PROFILE_ID); } + @Override public IScannerConfigBuilderInfo2 createInfo(InfoContext context, String profileId) { fIsDirty = true; @@ -346,17 +358,17 @@ public class ScannerConfigInfoFactory2 { protected boolean autoDiscoveryEnabled; protected boolean problemReportingEnabled; protected String selectedProfile = EMPTY_STRING; - /** Map from profile ID -> default ProfileOptions + /** Map from profile ID -> default ProfileOptions * allows us to avoid storing options to .cproject when they are default .*/ - protected static Map defaultProfiles = new ConcurrentHashMap(); + protected static Map defaultProfiles = new ConcurrentHashMap(); /** Map from profile ID -> ProfileOptions */ - protected Map profileOptionsMap = new LinkedHashMap(); + protected Map profileOptionsMap = new LinkedHashMap(); static class ProfileOptions implements Cloneable { protected boolean buildOutputFileActionEnabled; protected String buildOutputFilePath = EMPTY_STRING; protected boolean buildOutputParserEnabled; /** Map from provider ID -> providerOptions */ - protected Map providerOptionsMap; + protected Map providerOptionsMap; static class ProviderOptions implements Cloneable { protected String providerKind; // derived protected boolean providerOutputParserEnabled; @@ -364,7 +376,7 @@ public class ScannerConfigInfoFactory2 { protected String providerRunCommand = EMPTY_STRING; protected String providerRunArguments = EMPTY_STRING; protected String providerOpenFilePath = EMPTY_STRING; - + ProviderOptions(){ } @@ -428,7 +440,7 @@ public class ScannerConfigInfoFactory2 { return false; return true; } - + @Override protected ProviderOptions clone() throws CloneNotSupportedException { return (ProviderOptions)super.clone(); @@ -517,13 +529,14 @@ public class ScannerConfigInfoFactory2 { ProfileOptions basePo = entry.getValue(); entry.setValue(new ProfileOptions(basePo)); } - + isDirty = true; } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isAutoDiscoveryEnabled() */ + @Override public boolean isAutoDiscoveryEnabled() { return autoDiscoveryEnabled; } @@ -531,6 +544,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setAutoDiscoveryEnabled(boolean) */ + @Override public void setAutoDiscoveryEnabled(boolean enable) { autoDiscoveryEnabled = setDirty(autoDiscoveryEnabled, enable); } @@ -538,18 +552,21 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isSIProblemGenerationEnabled() */ + @Override public boolean isProblemReportingEnabled() { return problemReportingEnabled; } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setSIProblemGenerationEnabled(boolean) */ + @Override public void setProblemReportingEnabled(boolean enable) { problemReportingEnabled = setDirty(problemReportingEnabled, enable); } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getSelectedProfileId() */ + @Override public String getSelectedProfileId() { return selectedProfile; } @@ -557,6 +574,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setSelectedProfileId(java.lang.String) */ + @Override public void setSelectedProfileId(String profileId) { selectedProfile = SafeStringInterner.safeIntern(setDirty(selectedProfile, profileId)); // if (isDirty) { @@ -573,13 +591,15 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProfileIdList() */ - public List getProfileIdList() { + @Override + public List getProfileIdList() { return new ArrayList(profileOptionsMap.keySet()); } /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isBuildOutputFileActionEnabled() */ + @Override public boolean isBuildOutputFileActionEnabled() { ProfileOptions po = profileOptionsMap.get(selectedProfile); return (po != null) ? po.buildOutputFileActionEnabled : false; @@ -588,6 +608,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setBuildOutputFileActionEnabled(boolean) */ + @Override public void setBuildOutputFileActionEnabled(boolean enable) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -598,6 +619,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getBuildOutputFilePath() */ + @Override public String getBuildOutputFilePath() { ProfileOptions po = profileOptionsMap.get(selectedProfile); return (po != null) ? po.buildOutputFilePath : EMPTY_STRING; @@ -606,6 +628,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setBuildOutputFilePath(java.lang.String) */ + @Override public void setBuildOutputFilePath(String path) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -616,6 +639,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isBuildOutputParserEnabled() */ + @Override public boolean isBuildOutputParserEnabled() { ProfileOptions po = profileOptionsMap.get(selectedProfile); return (po != null) ? po.buildOutputParserEnabled : true; @@ -624,6 +648,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setBuildOutputParserEnabled(boolean) */ + @Override public void setBuildOutputParserEnabled(boolean enable) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -634,6 +659,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getSIProviderIdList() */ + @Override public List getProviderIdList() { ProfileOptions po = profileOptionsMap.get(selectedProfile); return (po != null) ? new ArrayList(po.providerOptionsMap.keySet()) : new ArrayList(0); @@ -656,6 +682,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isSIProviderOutputParserEnabled(java.lang.String) */ + @Override public boolean isProviderOutputParserEnabled(String providerId) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -668,6 +695,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setSIProviderOutputParserEnabled(java.lang.String, boolean) */ + @Override public void setProviderOutputParserEnabled(String providerId, boolean enable) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -681,6 +709,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#isUseDefaultProviderCommand(java.lang.String) */ + @Override public boolean isUseDefaultProviderCommand(String providerId) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -693,6 +722,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setUseDefaultProviderCommand(java.lang.String, boolean) */ + @Override public void setUseDefaultProviderCommand(String providerId, boolean enable) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -706,6 +736,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProviderRunCommand(java.lang.String) */ + @Override public String getProviderRunCommand(String providerId) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -718,6 +749,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setProviderRunCommand(java.lang.String, java.lang.String) */ + @Override public void setProviderRunCommand(String providerId, String command) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -731,6 +763,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProviderRunArguments(java.lang.String) */ + @Override public String getProviderRunArguments(String providerId) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -743,6 +776,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setProviderRunArguments(java.lang.String, java.lang.String) */ + @Override public void setProviderRunArguments(String providerId, String arguments) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -756,6 +790,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#getProviderOpenFilePath(java.lang.String) */ + @Override public String getProviderOpenFilePath(String providerId) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -768,6 +803,7 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#setProviderOpenFilePath(java.lang.String, java.lang.String) */ + @Override public void setProviderOpenFilePath(String providerId, String filePath) { ProfileOptions po = profileOptionsMap.get(selectedProfile); if (po != null) { @@ -777,7 +813,7 @@ public class ScannerConfigInfoFactory2 { } } } - + private boolean setDirty(boolean l, boolean r) { isDirty = isDirty || (l != r); return r; @@ -786,13 +822,13 @@ public class ScannerConfigInfoFactory2 { isDirty = isDirty || !l.equals(r); return r; } - + // protected abstract void load(); // public abstract void store(); /** * Load defaults for the specified profileId. - * Returns a clone() of the default profile matching the passed in profileId + * Returns a clone() of the default profile matching the passed in profileId */ protected static ProfileOptions getDefaultProfile(String profileId) { if (defaultProfiles.containsKey(profileId)) @@ -811,7 +847,7 @@ public class ScannerConfigInfoFactory2 { po.buildOutputFileActionEnabled = true; String buildOutputFilePath = configuredProfile.getBuildOutputProviderElement(). getAction().getAttribute("file");//$NON-NLS-1$ - po.buildOutputFilePath = (buildOutputFilePath != null) ? buildOutputFilePath : EMPTY_STRING; + po.buildOutputFilePath = (buildOutputFilePath != null) ? buildOutputFilePath : EMPTY_STRING; } } @@ -826,7 +862,7 @@ public class ScannerConfigInfoFactory2 { if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) { ppo.providerRunUseDefault = true; attrValue = configuredProvider.getAction().getAttribute(COMMAND); - ppo.providerRunCommand = (attrValue != null) ? attrValue : EMPTY_STRING; + ppo.providerRunCommand = (attrValue != null) ? attrValue : EMPTY_STRING; attrValue = configuredProvider.getAction().getAttribute(ARGUMENTS); ppo.providerRunArguments = (attrValue != null) ? attrValue : EMPTY_STRING; } else if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) { @@ -845,7 +881,7 @@ public class ScannerConfigInfoFactory2 { /** * Build properties stored in .cproject file - * + * * Responsible for both load and store. Doesn't store profile settings if they're identical to the default. */ private static class BuildProperty extends Store { @@ -862,7 +898,7 @@ public class ScannerConfigInfoFactory2 { this.container = container; load(element); } - + BuildProperty(ScannerConfigInfoSet container, IProject project, InfoContext context, Store base, String profileId) { super(base, profileId); this.project = project; @@ -896,7 +932,7 @@ public class ScannerConfigInfoFactory2 { if (sc.getName().equals(SC_AUTODISCOVERY)) { autoDiscoveryEnabled = Boolean.valueOf( sc.getAttribute(ENABLED)).booleanValue(); - selectedProfile = (profileId == ScannerConfigProfileManager.NULL_PROFILE_ID) + selectedProfile = (profileId == ScannerConfigProfileManager.NULL_PROFILE_ID) ? sc.getAttribute(SELECTED_PROFILE_ID) : profileId; selectedProfile = SafeStringInterner.safeIntern(selectedProfile); @@ -929,11 +965,11 @@ public class ScannerConfigInfoFactory2 { problemReportingEnabled = oldInfo.isSIProblemGenerationEnabled(); // effectively a PerProject profile selectedProfile = SafeStringInterner.safeIntern(profileId); - + ProfileOptions po = new ProfileOptions(); po.buildOutputFileActionEnabled = false; po.buildOutputParserEnabled = oldInfo.isMakeBuilderConsoleParserEnabled(); - + ProfileOptions.ProviderOptions ppo = new ProfileOptions.ProviderOptions(); ppo.providerKind = ScannerConfigProfile.ScannerInfoProvider.RUN; ppo.providerOutputParserEnabled = oldInfo.isESIProviderCommandEnabled(); @@ -947,14 +983,14 @@ public class ScannerConfigInfoFactory2 { String providerId = configuredProfile.getSIProviderIds().get(0); po.providerOptionsMap = new LinkedHashMap(1); po.providerOptionsMap.put(providerId, ppo); - + profileOptionsMap = new LinkedHashMap(1); profileOptionsMap.put(profileId, po); - + // store migrated data isDirty = true; save(); - } + } catch (CoreException e) { MakeCorePlugin.log(e); rc = false; @@ -996,12 +1032,12 @@ public class ScannerConfigInfoFactory2 { po.providerOptionsMap.put(providerId, ppo); ppo.providerKind = configuredProfile.getScannerInfoProviderElement( providerId).getProviderKind(); - + for (ICStorageElement grandchild : child.getChildren()) { // action if (RUN_ACTION.equals(grandchild.getName())) { ppo.providerRunUseDefault = Boolean.valueOf( - grandchild.getAttribute(USE_DEFAULT)).booleanValue(); + grandchild.getAttribute(USE_DEFAULT)).booleanValue(); ppo.providerRunCommand = grandchild.getAttribute(COMMAND); ppo.providerRunArguments = grandchild.getAttribute(ARGUMENTS); } @@ -1052,7 +1088,7 @@ public class ScannerConfigInfoFactory2 { /** * @param profile element - * @param po options + * @param po options */ private void store(ICStorageElement profile, ProfileOptions po) { ICStorageElement child, grandchild; @@ -1073,19 +1109,19 @@ public class ScannerConfigInfoFactory2 { for (int i = 0; i < providerIds.size(); ++i) { String providerId = providerIds.get(i); ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId); - + if (ppo != null) { child = profile.createChild(SCANNER_INFO_PROVIDER); child.setAttribute(ID, providerId); - + // action // String providerKind = configuredProfile.getScannerInfoProviderElement( // providerId).getProviderKind(); String providerKind = ppo.providerKind; - + if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) { grandchild = child.createChild(RUN_ACTION); - grandchild.setAttribute(USE_DEFAULT, Boolean.toString(ppo.providerRunUseDefault)); + grandchild.setAttribute(USE_DEFAULT, Boolean.toString(ppo.providerRunUseDefault)); if(ppo.providerRunCommand != null) grandchild.setAttribute(COMMAND, ppo.providerRunCommand); if(ppo.providerRunArguments != null) @@ -1110,14 +1146,16 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save() */ - public synchronized void save() throws CoreException { + @Override + public synchronized void save() throws CoreException { if(isDirty){ container.save(true); isDirty = false; } } - - public InfoContext getContext(){ + + @Override + public InfoContext getContext(){ return context; } @@ -1125,7 +1163,7 @@ public class ScannerConfigInfoFactory2 { /** * Preferences - * + * * @author vhirsl */ private static class Preference extends Store { @@ -1144,7 +1182,7 @@ public class ScannerConfigInfoFactory2 { this.context = context; load(); } - + Preference(PreferenceSet container, Preferences prefs, InfoContext context, Store base, String profileId, boolean useDefaults) { super(base, profileId); this.prefs = prefs; @@ -1169,12 +1207,12 @@ public class ScannerConfigInfoFactory2 { protected void load() { String instanceId = context.getInstanceId(); String prefix = instanceId.length() == 0 ? "" : ATTRIBUTE_CS_INFO_INSTANCE_ID + DOT + instanceId + DOT; //$NON-NLS-1$ - + autoDiscoveryEnabled = getBoolean(prefix + SCANNER_CONFIG_AUTODISCOVERY_ENABLED_SUFFIX); - selectedProfile = (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId)) ? - getString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX) : + selectedProfile = (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(profileId)) ? + getString(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX) : profileId; - selectedProfile = SafeStringInterner.safeIntern(selectedProfile); + selectedProfile = SafeStringInterner.safeIntern(selectedProfile); problemReportingEnabled = getBoolean(prefix + SCANNER_CONFIG_PROBLEM_REPORTING_ENABLED_SUFFIX); if (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(selectedProfile) && !useDefaults) { // get the default value @@ -1195,7 +1233,7 @@ public class ScannerConfigInfoFactory2 { po.buildOutputFileActionEnabled = getBoolean(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_ENABLED); po.buildOutputFilePath = getString(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_FILE_PATH); po.buildOutputParserEnabled = getBoolean(SCD + prefix + profileId + BUILD_OUTPUT_PARSER_ENABLED); - + ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance(). getSCProfileConfiguration(profileId); List providerIds = configuredProfile.getSIProviderIds(); @@ -1205,25 +1243,25 @@ public class ScannerConfigInfoFactory2 { po.providerOptionsMap.put(providerId, ppo); ppo.providerKind = configuredProfile.getScannerInfoProviderElement( providerId).getProviderKind(); - - ppo.providerOutputParserEnabled = getBoolean(SCD + prefix + profileId + DOT + + + ppo.providerOutputParserEnabled = getBoolean(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_PARSER_ENABLED); if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) { - ppo.providerRunUseDefault = getBoolean(SCD + prefix + profileId + DOT + providerId + - SI_PROVIDER_RUN_ACTION_USE_DEFAULT); - ppo.providerRunCommand = getString(SCD + prefix + profileId + DOT + providerId + + ppo.providerRunUseDefault = getBoolean(SCD + prefix + profileId + DOT + providerId + + SI_PROVIDER_RUN_ACTION_USE_DEFAULT); + ppo.providerRunCommand = getString(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_COMMAND); - ppo.providerRunArguments = getString(SCD + prefix + profileId + DOT + providerId + + ppo.providerRunArguments = getString(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_ARGUMENTS); } else if (ppo.providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.OPEN)) { - ppo.providerOpenFilePath = getString(SCD + prefix + profileId + DOT + providerId + + ppo.providerOpenFilePath = getString(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_OPEN_ACTION_FILE_PATH); } } } } - + private void store() { String instanceId = context.getInstanceId(); String prefix = instanceId.length() == 0 ? "" : ATTRIBUTE_CS_INFO_INSTANCE_ID + DOT + instanceId + DOT; //$NON-NLS-1$ @@ -1231,31 +1269,31 @@ public class ScannerConfigInfoFactory2 { set(prefix + SCANNER_CONFIG_AUTODISCOVERY_ENABLED_SUFFIX, autoDiscoveryEnabled); set(prefix + SCANNER_CONFIG_SELECTED_PROFILE_ID_SUFFIX, selectedProfile); set(prefix + SCANNER_CONFIG_PROBLEM_REPORTING_ENABLED_SUFFIX, problemReportingEnabled); - + for (String profileId : profileOptionsMap.keySet()) { ProfileOptions po = profileOptionsMap.get(profileId); - + set(SCD + prefix + profileId + DOT + ENABLED, !useDefaults); set(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_ENABLED, po.buildOutputFileActionEnabled); set(SCD + prefix + profileId + BUILD_OUTPUT_OPEN_ACTION_FILE_PATH, po.buildOutputFilePath); set(SCD + prefix + profileId + BUILD_OUTPUT_PARSER_ENABLED, po.buildOutputParserEnabled); - + ScannerConfigProfile configuredProfile = ScannerConfigProfileManager.getInstance(). getSCProfileConfiguration(profileId); List providerIds = configuredProfile.getSIProviderIds(); for (String providerId : providerIds) { ProfileOptions.ProviderOptions ppo = po.providerOptionsMap.get(providerId); - + set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_PARSER_ENABLED, ppo.providerOutputParserEnabled); // String providerKind = configuredProfile.getScannerInfoProviderElement( // providerId).getProviderKind(); String providerKind = ppo.providerKind; - + if (providerKind.equals(ScannerConfigProfile.ScannerInfoProvider.RUN)) { set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_USE_DEFAULT, ppo.providerRunUseDefault); - set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_COMMAND, + set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_COMMAND, ppo.providerRunCommand); set(SCD + prefix + profileId + DOT + providerId + SI_PROVIDER_RUN_ACTION_ARGUMENTS, ppo.providerRunArguments); @@ -1266,11 +1304,11 @@ public class ScannerConfigInfoFactory2 { } } } - + isDirty = false; } } - + private boolean getBoolean(String name) { if (useDefaults) { return prefs.getDefaultBoolean(name); @@ -1304,12 +1342,14 @@ public class ScannerConfigInfoFactory2 { /* (non-Javadoc) * @see org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2#save() */ - public void save() throws CoreException { + @Override + public void save() throws CoreException { if(isDirty) prefsContainer.save(); } - public InfoContext getContext(){ + @Override + public InfoContext getContext(){ return context; } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeEnvironmentBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeEnvironmentBlock.java index 58919739f69..6434eb329f6 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeEnvironmentBlock.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeEnvironmentBlock.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.make.internal.ui; -import com.ibm.icu.text.MessageFormat; import java.util.Comparator; import java.util.HashMap; import java.util.Hashtable; @@ -66,10 +65,12 @@ import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; import org.eclipse.ui.dialogs.ListSelectionDialog; +import com.ibm.icu.text.MessageFormat; + /** * @deprecated as of CDT 4.0. This tab was used to set preferences/properties * for 3.X style projects. - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -112,7 +113,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /** * Returns this variable's name, which serves as the key in the * key/value pair this variable represents - * + * * @return this variable's name */ public String getName() { @@ -121,7 +122,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /** * Returns this variables value. - * + * * @return this variable's value */ public String getValue() { @@ -137,7 +138,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override @@ -147,7 +148,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /* * (non-Javadoc) - * + * * @see java.lang.Object#equals(java.lang.Object) */ @Override @@ -161,7 +162,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { } /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ @Override @@ -175,6 +176,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { */ protected class EnvironmentVariableContentProvider implements IStructuredContentProvider { + @Override public Object[] getElements(Object inputElement) { EnvironmentVariable[] elements = new EnvironmentVariable[0]; IMakeCommonBuildInfo info = (IMakeCommonBuildInfo)inputElement; @@ -189,8 +191,10 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { } return elements; } + @Override public void dispose() { } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (newInput == null) { return; @@ -222,6 +226,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { */ public class EnvironmentVariableLabelProvider extends LabelProvider implements ITableLabelProvider { + @Override public String getColumnText(Object element, int columnIndex) { String result = null; if (element != null) { @@ -237,6 +242,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { } return result; } + @Override public Image getColumnImage(Object element, int columnIndex) { if (columnIndex == 0) { return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_ENV_VAR); @@ -278,6 +284,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { // To avoid multi-build IWorkspaceRunnable operation = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { monitor.beginTask(MakeUIPlugin.getResourceString("SettingsBlock.monitor.applyingSettings"), 1); //$NON-NLS-1$ IMakeCommonBuildInfo info = null; @@ -300,7 +307,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { { EnvironmentVariable var = (EnvironmentVariable) items[i].getData(); map.put(var.getName(), var.getValue()); - } + } info.setEnvironment(map); info.setAppendEnvironment(appendEnvironment.getSelection()); } @@ -367,7 +374,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { createBuildEnvironmentControls(composite); createTableButtons(composite); createAppendReplace(composite); - + boolean append = fBuildInfo.appendEnvironment(); if (append) { appendEnvironment.setSelection(true); @@ -413,12 +420,14 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { environmentTable.setColumnProperties(envTableColumnProperties); environmentTable.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { handleTableSelectionChanged(event); } }); environmentTable.addDoubleClickListener(new IDoubleClickListener() { + @Override public void doubleClick(DoubleClickEvent event) { if (!environmentTable.getSelection().isEmpty()) { handleEnvEditButtonSelected(); @@ -436,7 +445,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /** * Responds to a selection changed event in the environment table - * + * * @param event * the selection change event */ @@ -459,7 +468,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /** * Creates the add/edit/remove buttons for the environment table - * + * * @param parent * the composite in which the buttons should be created */ @@ -548,7 +557,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { * Attempts to add the given variable. Returns whether the variable was * added or not (as when the user answers not to overwrite an existing * variable). - * + * * @param variable * the variable to add * @return whether the variable was added @@ -575,7 +584,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /** * Gets native environment variable. Creates EnvironmentVariable objects. - * + * * @return Map of name - EnvironmentVariable pairs based on native * environment. */ @@ -625,27 +634,33 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /** * Creates a label provider for the native native environment variable * selection dialog. - * + * * @return A label provider for the native native environment variable * selection dialog. */ private ILabelProvider createSelectionDialogLabelProvider() { return new ILabelProvider() { + @Override public Image getImage(Object element) { return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_ENVIRONMNET); } + @Override public String getText(Object element) { EnvironmentVariable var = (EnvironmentVariable)element; return var.getName() + " [" + var.getValue() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } + @Override public void addListener(ILabelProviderListener listener) { } + @Override public void dispose() { } + @Override public boolean isLabelProperty(Object element, String property) { return false; } + @Override public void removeListener(ILabelProviderListener listener) { } }; @@ -654,19 +669,21 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /** * Creates a content provider for the native native environment variable * selection dialog. - * + * * @return A content provider for the native native environment variable * selection dialog. */ private IStructuredContentProvider createSelectionDialogContentProvider() { return new IStructuredContentProvider() { + @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public Object[] getElements(Object inputElement) { EnvironmentVariable[] elements = null; if (inputElement instanceof Map) { Comparator comparator = new Comparator() { + @Override public int compare(Object o1, Object o2) { String s1 = (String)o1; String s2 = (String)o2; @@ -685,8 +702,10 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { } return elements; } + @Override public void dispose() { } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } }; @@ -749,7 +768,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /** * Returns the name of the section that this dialog stores its settings * in - * + * * @return String */ protected String getDialogSettingsSectionName() { @@ -758,7 +777,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point) */ @Override @@ -772,7 +791,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.window.Window#getInitialSize() */ @Override @@ -783,7 +802,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.window.Window#close() */ @Override @@ -797,7 +816,7 @@ public class MakeEnvironmentBlock extends AbstractCOptionPage { * Creates and configures the widgets which allow the user to choose whether * the specified environment should be appended to the native environment or * if it should completely replace it. - * + * * @param parent * the composite in which the widgets should be created */ diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeStartup.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeStartup.java index fe2157e9bd1..4806cfa1b83 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeStartup.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeStartup.java @@ -34,7 +34,8 @@ public class MakeStartup extends Job { final IProject[] oldProject = UpdateMakeProjectAction.getOldProjects(); if (oldProject.length > 0) { Display.getDefault().asyncExec(new Runnable() { - public void run() { + @Override + public void run() { Shell shell = MakeUIPlugin.getDefault().getShell(); boolean shouldUpdate = MessageDialog.openQuestion(shell, MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$ diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java index 0a760d4bbbf..f9c87fcc19a 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIPlugin.java @@ -76,7 +76,7 @@ public class MakeUIPlugin extends AbstractUIPlugin { public static String getPluginId() { return getDefault().getBundle().getSymbolicName(); } - + /** * Returns the workspace instance. */ @@ -109,7 +109,7 @@ public class MakeUIPlugin extends AbstractUIPlugin { } return null; } - + /** * Returns the string from the plugin's resource bundle, * or 'key' if not found. @@ -179,6 +179,7 @@ public class MakeUIPlugin extends AbstractUIPlugin { display = Display.getDefault(); final IStatus fstatus = status; display.asyncExec(new Runnable() { + @Override public void run() { ErrorDialog.openError(null, title, null, fstatus); } @@ -227,7 +228,7 @@ public class MakeUIPlugin extends AbstractUIPlugin { message = null; } } else { - status = new Status(IStatus.ERROR, MakeUIPlugin.getUniqueIdentifier(), -1, "Internal Error: ", t); //$NON-NLS-1$ + status = new Status(IStatus.ERROR, MakeUIPlugin.getUniqueIdentifier(), -1, "Internal Error: ", t); //$NON-NLS-1$ } ErrorDialog.openError(shell, title, message, status); } @@ -257,7 +258,7 @@ public class MakeUIPlugin extends AbstractUIPlugin { /** * Returns a combined preference store, this store is read-only. - * + * * @return the combined preference store */ public IPreferenceStore getCombinedPreferenceStore() { @@ -268,7 +269,7 @@ public class MakeUIPlugin extends AbstractUIPlugin { return chainedStore; } - + @Override public void start(BundleContext context) throws Exception { super.start(context); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MultipleInputDialog.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MultipleInputDialog.java index 4786e3c68e8..079d79b05b9 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MultipleInputDialog.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MultipleInputDialog.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -45,24 +45,24 @@ public class MultipleInputDialog extends Dialog { protected static final int TEXT = 100; protected static final int BROWSE = 101; protected static final int VARIABLE = 102; - + protected Composite panel; - + protected List fieldList = new ArrayList(); protected List controlList = new ArrayList(); protected List validators = new ArrayList(); protected Map valueMap = new HashMap(); private String title; - - - + + + public MultipleInputDialog(Shell shell, String title) { super(shell); this.title = title; setShellStyle(getShellStyle() | SWT.RESIZE); } - + /* (non-Javadoc) * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ @@ -72,9 +72,9 @@ public class MultipleInputDialog extends Dialog { if (title != null) { shell.setText(title); } - + } - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite) */ @@ -84,7 +84,7 @@ public class MultipleInputDialog extends Dialog { validateFields(); return bar; } - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @@ -93,12 +93,12 @@ public class MultipleInputDialog extends Dialog { Composite container = (Composite)super.createDialogArea(parent); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); - + panel = new Composite(container, SWT.NONE); GridLayout layout = new GridLayout(2, false); panel.setLayout(layout); panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + for (FieldSummary field : fieldList) { switch(field.type) { case TEXT: @@ -112,12 +112,12 @@ public class MultipleInputDialog extends Dialog { break; } } - + fieldList = null; // allow it to be gc'd Dialog.applyDialogFont(container); return container; } - + public void addBrowseField(String labelText, String initialValue, boolean allowsEmpty) { fieldList.add(new FieldSummary(BROWSE, labelText, initialValue, allowsEmpty)); } @@ -128,22 +128,22 @@ public class MultipleInputDialog extends Dialog { fieldList.add(new FieldSummary(VARIABLE, labelText, initialValue, allowsEmpty)); } - protected void createTextField(String labelText, String initialValue, boolean allowEmpty) { + protected void createTextField(String labelText, String initialValue, boolean allowEmpty) { Label label = new Label(panel, SWT.NONE); label.setText(labelText); label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - + final Text text = new Text(panel, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); text.setData(FIELD_NAME, labelText); - + // make sure rows are the same height on both panels. - label.setSize(label.getSize().x, text.getSize().y); - + label.setSize(label.getSize().x, text.getSize().y); + if (initialValue != null) { text.setText(initialValue); } - + if (!allowEmpty) { validators.add(new Validator() { @Override @@ -152,27 +152,28 @@ public class MultipleInputDialog extends Dialog { } }); text.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { validateFields(); } }); } - + controlList.add(text); } - + protected void createBrowseField(String labelText, String initialValue, boolean allowEmpty) { Label label = new Label(panel, SWT.NONE); label.setText(labelText); label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - + Composite comp = new Composite(panel, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight=0; layout.marginWidth=0; comp.setLayout(layout); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 200; @@ -180,8 +181,8 @@ public class MultipleInputDialog extends Dialog { text.setData(FIELD_NAME, labelText); // make sure rows are the same height on both panels. - label.setSize(label.getSize().x, text.getSize().y); - + label.setSize(label.getSize().x, text.getSize().y); + if (initialValue != null) { text.setText(initialValue); } @@ -195,12 +196,13 @@ public class MultipleInputDialog extends Dialog { }); text.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { validateFields(); } }); } - + Button button = createButton(comp, IDialogConstants.IGNORE_ID, MakeUIPlugin.getResourceString("MultipleInputDialog.0"), false); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { @Override @@ -212,33 +214,33 @@ public class MultipleInputDialog extends Dialog { File path = new File(currentWorkingDir); if (path.exists()) { dialog.setFilterPath(currentWorkingDir); - } + } } - + String selectedDirectory = dialog.open(); if (selectedDirectory != null) { text.setText(selectedDirectory); - } + } } }); controlList.add(text); - + } - - + + public void createVariablesField(String labelText, String initialValue, boolean allowEmpty) { Label label = new Label(panel, SWT.NONE); label.setText(labelText); label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - + Composite comp = new Composite(panel, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight=0; layout.marginWidth=0; comp.setLayout(layout); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 200; @@ -246,8 +248,8 @@ public class MultipleInputDialog extends Dialog { text.setData(FIELD_NAME, labelText); // make sure rows are the same height on both panels. - label.setSize(label.getSize().x, text.getSize().y); - + label.setSize(label.getSize().x, text.getSize().y); + if (initialValue != null) { text.setText(initialValue); } @@ -261,12 +263,13 @@ public class MultipleInputDialog extends Dialog { }); text.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { validateFields(); } }); } - + Button button = createButton(comp, IDialogConstants.IGNORE_ID, MakeUIPlugin.getResourceString("MultipleInputDialog.2"), false); //$NON-NLS-1$ button.addSelectionListener(new SelectionAdapter() { @Override @@ -283,9 +286,9 @@ public class MultipleInputDialog extends Dialog { }); controlList.add(text); - + } - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ @@ -298,7 +301,7 @@ public class MultipleInputDialog extends Dialog { super.okPressed(); } - + /* (non-Javadoc) * @see org.eclipse.jface.window.Window#open() */ @@ -307,15 +310,15 @@ public class MultipleInputDialog extends Dialog { applyDialogFont(panel); return super.open(); } - + public Object getValue(String key) { return valueMap.get(key); } - + public String getStringValue(String key) { return (String) getValue(key); } - + public void validateFields() { for (Validator validator : validators) { if (!validator.validate()) { @@ -338,11 +341,11 @@ public class MultipleInputDialog extends Dialog { return super.getInitialLocation(initialSize); } - + protected String getDialogSettingsSectionName() { return MakeUIPlugin.getPluginId() + ".MULTIPLE_INPUT_DIALOG_2"; //$NON-NLS-1$ } - + /* (non-Javadoc) * @see org.eclipse.jface.window.Window#getInitialSize() */ @@ -351,7 +354,7 @@ public class MultipleInputDialog extends Dialog { Point size = super.getInitialSize(); return DialogSettingsHelper.getInitialSize(getDialogSettingsSectionName(), size); } - + /* (non-Javadoc) * @see org.eclipse.jface.window.Window#close() */ @@ -366,7 +369,7 @@ public class MultipleInputDialog extends Dialog { String name; String initialValue; boolean allowsEmpty; - + public FieldSummary(int type, String name, String initialValue, boolean allowsEmpty) { this.type = type; this.name = name; @@ -374,7 +377,7 @@ public class MultipleInputDialog extends Dialog { this.allowsEmpty = allowsEmpty; } } - + protected class Validator { boolean validate() { return true; diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/FoldingActionGroup.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/FoldingActionGroup.java index a5430daad19..3dd5ebd4cc6 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/FoldingActionGroup.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/FoldingActionGroup.java @@ -17,6 +17,7 @@ package org.eclipse.cdt.make.internal.ui.actions; import java.util.ResourceBundle; +import org.eclipse.cdt.make.internal.ui.editor.MakefileEditor; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.text.ITextViewer; @@ -29,8 +30,6 @@ import org.eclipse.ui.texteditor.IUpdate; import org.eclipse.ui.texteditor.ResourceAction; import org.eclipse.ui.texteditor.TextOperationAction; -import org.eclipse.cdt.make.internal.ui.editor.MakefileEditor; - /** * Groups the CDT folding actions. */ @@ -42,37 +41,38 @@ public class FoldingActionGroup extends ActionGroup { update(); } } - + private class FoldingAction extends PreferenceAction { FoldingAction(ResourceBundle bundle, String prefix) { super(bundle, prefix, IAction.AS_PUSH_BUTTON); } + @Override public void update() { setEnabled(FoldingActionGroup.this.isEnabled() && fViewer.isProjectionMode()); } - + } - + private ProjectionViewer fViewer; private IProjectionListener fProjectionListener; - + private TextOperationAction fToggle; private TextOperationAction fExpand; private TextOperationAction fCollapse; private TextOperationAction fExpandAll; - + private TextOperationAction fCollapseAll; private PreferenceAction fRestoreDefaults; - + /** * Creates a new projection action group for editor. If the * supplied viewer is not an instance of ProjectionViewer, the * action group is disabled. - * + * * @param editor the text editor to operate on * @param viewer the viewer of the editor */ @@ -87,28 +87,30 @@ public class FoldingActionGroup extends ActionGroup { fProjectionListener= null; return; } - + fViewer= (ProjectionViewer) viewer; - + fProjectionListener= new IProjectionListener() { + @Override public void projectionEnabled() { update(); } + @Override public void projectionDisabled() { update(); } }; - + fViewer.addProjectionListener(fProjectionListener); - + fToggle= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.Toggle.", editor, ProjectionViewer.TOGGLE, true); //$NON-NLS-1$ fToggle.setActionDefinitionId(IFoldingCommandIds.FOLDING_TOGGLE); editor.setAction("FoldingToggle", fToggle); //$NON-NLS-1$ - + fExpandAll= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.ExpandAll.", editor, ProjectionViewer.EXPAND_ALL, true); //$NON-NLS-1$ fExpandAll.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL); editor.setAction("FoldingExpandAll", fExpandAll); //$NON-NLS-1$ - + fCollapseAll= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.CollapseAll.", editor, ProjectionViewer.COLLAPSE_ALL, true); //$NON-NLS-1$ fCollapseAll.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE_ALL); editor.setAction("FoldingCollapseAll", fCollapseAll); //$NON-NLS-1$ @@ -116,7 +118,7 @@ public class FoldingActionGroup extends ActionGroup { fExpand= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.Expand.", editor, ProjectionViewer.EXPAND, true); //$NON-NLS-1$ fExpand.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND); editor.setAction("FoldingExpand", fExpand); //$NON-NLS-1$ - + fCollapse= new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.Collapse.", editor, ProjectionViewer.COLLAPSE, true); //$NON-NLS-1$ fCollapse.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE); editor.setAction("FoldingCollapse", fCollapse); //$NON-NLS-1$ @@ -133,19 +135,19 @@ public class FoldingActionGroup extends ActionGroup { fRestoreDefaults.setActionDefinitionId(IFoldingCommandIds.FOLDING_RESTORE); editor.setAction("FoldingRestore", fRestoreDefaults); //$NON-NLS-1$ } - + /** - * Returns true if the group is enabled. + * Returns true if the group is enabled. *
     	 * Invariant: isEnabled() <=> fViewer and all actions are != null.
     	 * 
    - * + * * @return true if the group is enabled */ protected boolean isEnabled() { return fViewer != null; } - + /* * @see org.eclipse.ui.actions.ActionGroup#dispose() */ @@ -157,7 +159,7 @@ public class FoldingActionGroup extends ActionGroup { } super.dispose(); } - + /** * Updates the actions. */ @@ -172,10 +174,10 @@ public class FoldingActionGroup extends ActionGroup { fRestoreDefaults.update(); } } - + /** * Fills the menu with all folding actions. - * + * * @param manager the menu manager for the folding submenu */ public void fillMenu(IMenuManager manager) { @@ -189,7 +191,7 @@ public class FoldingActionGroup extends ActionGroup { manager.add(fRestoreDefaults); } } - + /* * @see org.eclipse.ui.actions.ActionGroup#updateActionBars() */ diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/compare/MakefileContentViewerCreator.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/compare/MakefileContentViewerCreator.java index f1cbcfb48b8..f1e31cae55a 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/compare/MakefileContentViewerCreator.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/compare/MakefileContentViewerCreator.java @@ -11,22 +11,19 @@ *******************************************************************************/ package org.eclipse.cdt.make.internal.ui.compare; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; - - import org.eclipse.compare.CompareConfiguration; import org.eclipse.compare.IViewerCreator; - - import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; /** * Required when creating a MakefileMergeViewer from the plugin.xml file. */ public class MakefileContentViewerCreator implements IViewerCreator { - + + @Override public Viewer createViewer(Composite parent, CompareConfiguration mp) { return new MakefileMergeViewer(parent, SWT.NULL, mp); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/compare/MakefileMergeViewer.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/compare/MakefileMergeViewer.java index c72364c8db6..c08742511be 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/compare/MakefileMergeViewer.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/compare/MakefileMergeViewer.java @@ -77,6 +77,7 @@ public class MakefileMergeViewer extends TextMergeViewer { if (fPreferenceStore == null) { fPreferenceStore= MakeUIPlugin.getDefault().getCombinedPreferenceStore(); fPreferenceChangeListener= new IPropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent event) { handlePropertyChange(event); } @@ -96,15 +97,15 @@ public class MakefileMergeViewer extends TextMergeViewer { } protected void handlePropertyChange(PropertyChangeEvent event) { - + String key= event.getProperty(); - + if (key.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)) { if (!fUseSystemColors) { RGB bg= createColor(fPreferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND); setBackgroundColor(bg); } - + } else if (key.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) { fUseSystemColors= fPreferenceStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT); if (fUseSystemColors) { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/AbstractContainerAreaDropAdapter.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/AbstractContainerAreaDropAdapter.java index d041da6b896..0fdc7a770e7 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/AbstractContainerAreaDropAdapter.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/AbstractContainerAreaDropAdapter.java @@ -109,6 +109,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa * * @see DropTargetEvent */ + @Override public boolean isEnabled(DropTargetEvent event) { return true; } @@ -121,6 +122,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa * * @see DropTargetEvent */ + @Override public void dragEnter(DropTargetEvent event) { lastDragOverTarget = null; lastDragOverOperation = DND.DROP_NONE; @@ -142,6 +144,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa * * @see DropTargetEvent */ + @Override public void dragOperationChanged(DropTargetEvent event) { originallyRequestedOperation = event.detail; event.detail = dragOverOperationCached(originallyRequestedOperation, @@ -156,6 +159,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa * * @see DropTargetEvent */ + @Override public void dragOver(DropTargetEvent event) { event.detail = dragOverOperationCached(originallyRequestedOperation, determineDropContainer(event), determineDropTarget(event)); @@ -180,6 +184,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa * * @see DropTargetEvent */ + @Override public void dragLeave(DropTargetEvent event) { // no action } @@ -192,6 +197,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa * * @see DropTargetEvent */ + @Override public void dropAccept(DropTargetEvent event) { // no action } @@ -204,6 +210,7 @@ public abstract class AbstractContainerAreaDropAdapter implements TransferDropTa * * @see DropTargetEvent */ + @Override public void drop(DropTargetEvent event) { IContainer dropContainer = determineDropContainer(event); if (dropContainer != null) { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/AbstractSelectionDragAdapter.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/AbstractSelectionDragAdapter.java index 6bcff910554..74748ae8c46 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/AbstractSelectionDragAdapter.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/AbstractSelectionDragAdapter.java @@ -88,6 +88,7 @@ public abstract class AbstractSelectionDragAdapter implements TransferDragSource * * @param event the information associated with the drag event */ + @Override public void dragStart(DragSourceEvent event) { ISelection selection= fProvider.getSelection(); if (isDragable(selection)) { @@ -107,6 +108,7 @@ public abstract class AbstractSelectionDragAdapter implements TransferDragSource * * @param event the information associated with the drag event */ + @Override public void dragSetData(DragSourceEvent event) { // Define data type so a listener could examine it with isSupportedType(). // The selection is not passed using event by the LocalSelectionTransfer internally. @@ -122,6 +124,7 @@ public abstract class AbstractSelectionDragAdapter implements TransferDragSource * * @param event the information associated with the drag event */ + @Override public void dragFinished(DragSourceEvent event) { dragDone(); event.doit = false; diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/FileTransferDropTargetListener.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/FileTransferDropTargetListener.java index a69553653c4..28f7c45046b 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/FileTransferDropTargetListener.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/FileTransferDropTargetListener.java @@ -52,6 +52,7 @@ public class FileTransferDropTargetListener extends AbstractContainerAreaDropAda * @return the {@link Transfer} type that this listener can accept a * drop operation for. */ + @Override public Transfer getTransfer() { return FileTransfer.getInstance(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/LocalTransferDragSourceListener.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/LocalTransferDragSourceListener.java index 3803e1d60b1..35d23f02ca7 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/LocalTransferDragSourceListener.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/LocalTransferDragSourceListener.java @@ -38,6 +38,7 @@ public class LocalTransferDragSourceListener extends AbstractSelectionDragAdapte * @return the {@link Transfer} type that this listener can accept a * drop operation for. */ + @Override public Transfer getTransfer() { return LocalSelectionTransfer.getTransfer(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/LocalTransferDropTargetListener.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/LocalTransferDropTargetListener.java index c47b39cabbc..59a72c117e1 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/LocalTransferDropTargetListener.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/LocalTransferDropTargetListener.java @@ -52,6 +52,7 @@ public class LocalTransferDropTargetListener extends AbstractContainerAreaDropAd * @return the {@link Transfer} type that this listener can accept a * drop operation for. */ + @Override public Transfer getTransfer() { return LocalSelectionTransfer.getTransfer(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetDndUtil.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetDndUtil.java index e1d0af96a34..29105bae497 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetDndUtil.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetDndUtil.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.make.internal.ui.dnd; import java.lang.reflect.InvocationTargetException; -import com.ibm.icu.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -41,6 +40,8 @@ import org.eclipse.swt.SWTException; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.widgets.Shell; +import com.ibm.icu.text.MessageFormat; + /** * A collection of various functions for Make Target View drag and drop support. */ @@ -267,6 +268,7 @@ public class MakeTargetDndUtil { private static void copyTargetsWithProgressIndicator(final IMakeTarget[] makeTargets, final IContainer container, final int operation, final Shell shell) { IRunnableWithProgress runnable = new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { boolean isMove = operation == DND.DROP_MOVE; diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetTransferDragSourceListener.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetTransferDragSourceListener.java index c28ab7bf1dd..f9c89e25c62 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetTransferDragSourceListener.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetTransferDragSourceListener.java @@ -41,6 +41,7 @@ public class MakeTargetTransferDragSourceListener extends AbstractSelectionDragA * @return the {@link Transfer} type that this listener can accept a * drop operation for. */ + @Override public Transfer getTransfer() { return MakeTargetTransfer.getInstance(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetTransferDropTargetListener.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetTransferDropTargetListener.java index e99572199a0..a85aa34357f 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetTransferDropTargetListener.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/MakeTargetTransferDropTargetListener.java @@ -42,6 +42,7 @@ public class MakeTargetTransferDropTargetListener extends AbstractContainerAreaD * @return the {@link Transfer} type that this listener can accept a * drop operation for. */ + @Override public Transfer getTransfer() { return MakeTargetTransfer.getInstance(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/TextTransferDragSourceListener.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/TextTransferDragSourceListener.java index b38e1b1bd54..003add63659 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/TextTransferDragSourceListener.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/TextTransferDragSourceListener.java @@ -42,6 +42,7 @@ public class TextTransferDragSourceListener extends AbstractSelectionDragAdapter * @return the {@link Transfer} type that this listener can accept a * drop operation for. */ + @Override public Transfer getTransfer() { return TextTransfer.getInstance(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/TextTransferDropTargetListener.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/TextTransferDropTargetListener.java index 0010bd45a3b..9fedcb56f94 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/TextTransferDropTargetListener.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/dnd/TextTransferDropTargetListener.java @@ -11,7 +11,6 @@ package org.eclipse.cdt.make.internal.ui.dnd; -import com.ibm.icu.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -26,6 +25,8 @@ import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.widgets.Shell; +import com.ibm.icu.text.MessageFormat; + /** * {@code TextTransferDropTargetListener} handles dropping of selected text to * Make Target View. Each line of miltiline text passed is treated as separate @@ -50,6 +51,7 @@ public class TextTransferDropTargetListener extends AbstractContainerAreaDropAda * @return the {@link Transfer} type that this listener can accept a * drop operation for. */ + @Override public Transfer getTransfer() { return TextTransfer.getInstance(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java index 020677b4b4e..90873db5d2a 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileContentOutlinePage.java @@ -69,6 +69,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage { /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) */ + @Override public Object[] getChildren(Object element) { if (element == fInput) { return getElements(makefile); @@ -81,6 +82,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage { /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) */ + @Override public Object getParent(Object element) { if (element instanceof IMakefile) { return fInput; @@ -93,6 +95,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage { /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) */ + @Override public boolean hasChildren(Object element) { if (element == fInput) { return true; @@ -109,6 +112,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage { /* (non-Javadoc) * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ + @Override public Object[] getElements(Object inputElement) { IDirective[] directives; if (inputElement == fInput) { @@ -135,7 +139,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage { } else { boolean irrelevant = (directives[i] instanceof IComment || directives[i] instanceof IEmptyLine || - directives[i] instanceof ITerminal); + directives[i] instanceof ITerminal); if (!irrelevant) { list.add(directives[i]); } @@ -147,12 +151,14 @@ public class MakefileContentOutlinePage extends ContentOutlinePage { /* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#dispose() */ + @Override public void dispose() { } /* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (oldInput != null) { makefile = nullMakefile; @@ -246,6 +252,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage { MenuManager manager= new MenuManager("#MakefileOutlinerContext"); //$NON-NLS-1$ manager.setRemoveAllWhenShown(true); manager.addMenuListener(new IMenuListener() { + @Override public void menuAboutToShow(IMenuManager m) { contextMenuAboutToShow(m); } @@ -258,6 +265,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage { /* (non-Javadoc) * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) */ + @Override public void doubleClick(DoubleClickEvent event) { if (fOpenIncludeAction != null) { fOpenIncludeAction.run(); @@ -307,6 +315,7 @@ public class MakefileContentOutlinePage extends ContentOutlinePage { final Control control = viewer.getControl(); if (control != null && !control.isDisposed()) { control.getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (!control.isDisposed()) { control.setRedraw(false); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java index 9cefb2325c3..7560a1f81fe 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentProvider.java @@ -27,7 +27,7 @@ import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel; public class MakefileDocumentProvider extends TextFileDocumentProvider implements IMakefileDocumentProvider { - + IMakefile fMakefile; protected class MakefileAnnotationModel extends ResourceMarkerAnnotationModel /*implements IProblemRequestor */{ @@ -43,7 +43,7 @@ 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; } @@ -77,7 +77,7 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement protected FileInfo createFileInfo(Object element) throws CoreException { if (!(element instanceof IFileEditorInput)) return null; - + IFileEditorInput input= (IFileEditorInput) element; IMakefile original= createMakefile(input.getFile()); if (original == null) @@ -87,7 +87,7 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement if (!(info instanceof MakefileFileInfo)) { return null; } - + MakefileFileInfo makefileInfo= (MakefileFileInfo) info; setUpSynchronization(makefileInfo); @@ -96,10 +96,10 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement if (makefileInfo.fModel instanceof MakefileAnnotationModel) { MakefileAnnotationModel model= (MakefileAnnotationModel) makefileInfo.fModel; model.setMakefile(makefileInfo.fCopy); - } + } return makefileInfo; } - + /* (non-Javadoc) * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#disposeFileInfo(java.lang.Object, org.eclipse.ui.editors.text.TextFileDocumentProvider.FileInfo) */ @@ -111,9 +111,9 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement makefileInfo.fCopy = null; } } - super.disposeFileInfo(element, info); + super.disposeFileInfo(element, info); } - + /* * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createEmptyFileInfo() */ @@ -121,12 +121,13 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement protected FileInfo createEmptyFileInfo() { return new MakefileFileInfo(); } - + /* * @see org.eclipse.cdt.make.internal.ui.IMakefileDocumentProvider#getWorkingCopy(java.lang.Object) */ + @Override public IMakefile getWorkingCopy(Object element) { - FileInfo fileInfo= getFileInfo(element); + FileInfo fileInfo= getFileInfo(element); if (fileInfo instanceof MakefileFileInfo) { MakefileFileInfo info= (MakefileFileInfo) fileInfo; return info.fCopy; @@ -137,12 +138,13 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement /* * @see org.eclipse.cdt.make.internal.ui.IMakefileDocumentProvider#shutdown() */ + @Override public void shutdown() { Iterator e= getConnectedElementsIterator(); while (e.hasNext()) disconnect(e.next()); } - + /* * @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createSaveOperation(java.lang.Object, org.eclipse.jface.text.IDocument, boolean) */ diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentSetupParticipant.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentSetupParticipant.java index a29f16166a4..447ea6916ff 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentSetupParticipant.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileDocumentSetupParticipant.java @@ -23,27 +23,28 @@ import org.eclipse.jface.text.rules.FastPartitioner; * The document setup participant for Makefile. */ public class MakefileDocumentSetupParticipant implements IDocumentSetupParticipant { - + /** * The name of the Makefiile partitioning. */ public final static String MAKEFILE_PARTITIONING= "___makefile_partitioning"; //$NON-NLS-1$ - + public MakefileDocumentSetupParticipant() { } - + /* * @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument) */ + @Override public void setup(IDocument document) { if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3= (IDocumentExtension3) document; IDocumentPartitioner partitioner = createDocumentPartitioner(); extension3.setDocumentPartitioner(MAKEFILE_PARTITIONING, partitioner); partitioner.connect(document); - } + } } - + private IDocumentPartitioner createDocumentPartitioner() { return new FastPartitioner( new MakefilePartitionScanner(), MakefilePartitionScanner.MAKE_PARTITIONS); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java index 2afdbccdff8..4aaa8192dd0 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/MakefileEditor.java @@ -17,9 +17,9 @@ import java.util.ResourceBundle; import org.eclipse.cdt.make.core.makefile.IDirective; import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; +import org.eclipse.cdt.make.internal.ui.actions.FoldingActionGroup; import org.eclipse.cdt.make.internal.ui.preferences.MakefileEditorPreferenceConstants; import org.eclipse.cdt.make.internal.ui.text.makefile.MakefileWordDetector; -import org.eclipse.cdt.make.internal.ui.actions.FoldingActionGroup; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.ListenerList; import org.eclipse.jface.action.IAction; @@ -128,7 +128,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe boolean isFoldingEnabled() { return MakeUIPlugin.getDefault().getPreferenceStore().getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED); } - + /* * @see org.eclipse.ui.texteditor.AbstractTextEditor#rulerContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager) */ @@ -180,7 +180,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe // ensure decoration support has been created and configured. getSourceViewerDecorationSupport(viewer); - + return viewer; } @@ -235,7 +235,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$ @@ -252,14 +252,15 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe /* (non-Javadoc) * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ + @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection.isEmpty()) { resetHighlightRange(); - } else if (selection instanceof IStructuredSelection){ + } else if (selection instanceof IStructuredSelection){ if (!isActivePart() && MakeUIPlugin.getActivePage() != null) { MakeUIPlugin.getActivePage().bringToTop(this); - } + } Object element = ((IStructuredSelection) selection).getFirstElement(); if (element instanceof IDirective) { IDirective statement = (IDirective)element; @@ -280,7 +281,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe /** * Returns the find/replace document adapter. - * + * * @return the find/replace document adapter. */ private FindReplaceDocumentAdapter getFindReplaceDocumentAdapter() { @@ -347,7 +348,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 */ @@ -356,11 +357,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 */ @@ -369,17 +370,18 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe fReconcilingListeners.remove(listener); } } - + /* */ - public void reconciled() { + @Override + public void reconciled() { // Notify listeners Object[] listeners = fReconcilingListeners.getListeners(); for (int i = 0, length= listeners.length; i < length; ++i) { ((IReconcilingParticipant)listeners[i]).reconciled(); } } - + /** * Returns the folding action group, or null if there is none. * @@ -397,22 +399,22 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer(); projectionViewer.setRedraw(false); try { - + 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); } @@ -480,7 +482,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe System.arraycopy(parentPrefPageIds, 0, prefPageIds, nIds, parentPrefPageIds.length); return prefPageIds; } - + /* * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#isTabsToSpacesConversionEnabled() */ @@ -490,7 +492,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe // see http://bugs.eclipse.org/186106 return false; } - + /* * @see org.eclipse.ui.editors.text.TextEditor#initializeKeyBindingScopes() * @see http://bugs.eclipse.org/172331 diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/ProjectionMakefileUpdater.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/ProjectionMakefileUpdater.java index 2b976a761f0..afb04184926 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/ProjectionMakefileUpdater.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/ProjectionMakefileUpdater.java @@ -44,40 +44,40 @@ import org.eclipse.ui.texteditor.IDocumentProvider; 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 setIsComment(boolean isComment) { // fIsComment= isComment; // } } - + public void install(MakefileEditor editor, ProjectionViewer viewer) { fEditor= editor; fViewer= viewer; fViewer.addProjectionListener(this); } - + public void uninstall() { if (isInstalled()) { projectionDisabled(); @@ -86,7 +86,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { fEditor= null; } } - + protected boolean isInstalled() { return fEditor != null; } @@ -96,6 +96,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { /* (non-Javadoc) * @see org.eclipse.cdt.make.internal.ui.editor.IReconcilingParticipant#reconciled() */ + @Override public void reconciled() { processReconcile(); } @@ -115,6 +116,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { /* * @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionEnabled() */ + @Override public void projectionEnabled() { // http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html // projectionEnabled messages are not always paired with projectionDisabled @@ -122,15 +124,16 @@ public class ProjectionMakefileUpdater implements IProjectionListener { // we have to make sure that we disable first when getting an enable // message. projectionDisabled(); - - initialize(); + + initialize(); fParticipant= new ReconcilerParticipant(); fEditor.addReconcilingParticipant(fParticipant); } - + /* * @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionDisabled() */ + @Override public void projectionDisabled() { fCachedDocument= null; if (fParticipant != null) { @@ -138,23 +141,23 @@ public class ProjectionMakefileUpdater implements IProjectionListener { fParticipant= null; } } - + public void initialize() { - + if (!isInstalled()) return; - + initializePreferences(); - + try { - + IDocumentProvider provider= fEditor.getDocumentProvider(); fCachedDocument= provider.getDocument(fEditor.getEditorInput()); fAllowCollapsing= true; - + IWorkingCopyManager manager= MakeUIPlugin.getDefault().getWorkingCopyManager(); fInput= manager.getWorkingCopy(fEditor.getEditorInput()); - + if (fInput != null) { ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class); if (model != null) { @@ -163,7 +166,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { model.replaceAnnotations(null, additions); } } - + } finally { fCachedDocument= null; fAllowCollapsing= false; @@ -186,9 +189,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener { private void computeAdditions(IDirective[] elements, Map map) { for (int i= 0; i < elements.length; i++) { IDirective element= elements[i]; - + computeAdditions(element, map); - + if (element instanceof IParent) { IParent parent= (IParent) element; computeAdditions(parent.getDirectives(), map); @@ -197,11 +200,11 @@ public class ProjectionMakefileUpdater implements IProjectionListener { } private void computeAdditions(IDirective element, Map map) { - + boolean createProjection= false; - + boolean collapse= false; - + if (element instanceof IConditional) { collapse= fAllowCollapsing && fCollapseConditional; createProjection= true; @@ -212,7 +215,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { collapse= fAllowCollapsing && fCollapseRule; createProjection= true; } - + if (createProjection) { Position position= createProjectionPosition(element); if (position != null) { @@ -222,11 +225,11 @@ public class ProjectionMakefileUpdater implements IProjectionListener { } private Position createProjectionPosition(IDirective element) { - + if (fCachedDocument == null) return null; - - try { + + try { int startLine= element.getStartLine() - 1; int endLine= element.getEndLine() - 1; if (startLine != endLine) { @@ -234,38 +237,38 @@ public class ProjectionMakefileUpdater implements IProjectionListener { 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= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class); if (model == null) return; - + try { IDocumentProvider provider= fEditor.getDocumentProvider(); fCachedDocument= provider.getDocument(fEditor.getEditorInput()); fAllowCollapsing= false; - + Map additions= new HashMap(); List deletions= new ArrayList(); List updates= new ArrayList(); - + Map updated= computeAdditions((IParent) fInput); Map> previous= createAnnotationMap(model); - - + + for (MakefileProjectionAnnotation annotation : updated.keySet()) { IDirective element= annotation.getElement(); Position position= updated.get(annotation); - + List annotations= previous.get(element); if (annotations == null) { additions.put(annotation, position); @@ -284,12 +287,12 @@ public class ProjectionMakefileUpdater implements IProjectionListener { break; } } - + if (annotations.isEmpty()) previous.remove(element); } } - + for (List list : previous.values()) { int size= list.size(); for (int i= 0; i < size; i++) @@ -303,7 +306,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener { Annotation[] changes= new Annotation[updates.size()]; updates.toArray(changes); model.modifyAnnotations(removals, additions, changes); - + } finally { fCachedDocument= null; fAllowCollapsing= true; @@ -312,20 +315,20 @@ public class ProjectionMakefileUpdater implements IProjectionListener { private void match(ProjectionAnnotationModel model, List deletions, Map additions, List changes) { - + if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty())) return; - + List newDeletions= new ArrayList(); List newChanges= new ArrayList(); - + Iterator deletionIterator= deletions.iterator(); outer: while (deletionIterator.hasNext()) { MakefileProjectionAnnotation deleted= deletionIterator.next(); Position deletedPosition= model.getPosition(deleted); if (deletedPosition == null) continue; - + Iterator changesIterator= changes.iterator(); while (changesIterator.hasNext()) { MakefileProjectionAnnotation changed= changesIterator.next(); @@ -333,45 +336,45 @@ public class ProjectionMakefileUpdater implements IProjectionListener { 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 additionsIterator= additions.keySet().iterator(); while (additionsIterator.hasNext()) { MakefileProjectionAnnotation added= additionsIterator.next(); if (deleted.isComment() == added.isComment()) { 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); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java index a0d49dc57f4..5960e789329 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/WorkingCopyManager.java @@ -28,7 +28,7 @@ import org.eclipse.ui.IEditorInput; * additionally offers to "overwrite" the working copy provided by this document provider. */ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyManagerExtension { - + private IMakefileDocumentProvider fDocumentProvider; private Map fMap; private boolean fIsShuttingDown; @@ -36,7 +36,7 @@ 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) { @@ -47,20 +47,23 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana /* * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#connect(org.eclipse.ui.IEditorInput) */ + @Override public void connect(IEditorInput input) throws CoreException { fDocumentProvider.connect(input); } - + /* * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#disconnect(org.eclipse.ui.IEditorInput) */ + @Override public void disconnect(IEditorInput input) { fDocumentProvider.disconnect(input); } - + /* * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#shutdown() */ + @Override public void shutdown() { if (!fIsShuttingDown) { fIsShuttingDown= true; @@ -79,14 +82,16 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana /* * @see org.eclipse.cdt.make.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput) */ + @Override public IMakefile getWorkingCopy(IEditorInput input) { IMakefile unit= fMap == null ? null : (IMakefile) fMap.get(input); return unit != null ? unit : fDocumentProvider.getWorkingCopy(input); } - + /* * @see org.eclipse.cdt.make.ui.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.cdt.make.core.makefile.IMakefile) */ + @Override public void setWorkingCopy(IEditorInput input, IMakefile workingCopy) { if (fDocumentProvider.getDocument(input) != null) { if (fMap == null) @@ -94,10 +99,11 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana fMap.put(input, workingCopy); } } - + /* * @see org.eclipse.cdt.make.internal.ui.javaeditor.IWorkingCopyManagerExtension#removeWorkingCopy(org.eclipse.ui.IEditorInput) */ + @Override public void removeWorkingCopy(IEditorInput input) { fMap.remove(input); if (fMap.isEmpty()) diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/CheckboxTablePart.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/CheckboxTablePart.java index 190b27b523b..f918ed155ac 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/CheckboxTablePart.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/CheckboxTablePart.java @@ -37,11 +37,13 @@ public class CheckboxTablePart extends StructuredViewerPart { style |= SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; CheckboxTableViewer tableViewer = CheckboxTableViewer.newCheckList(parent, style); tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent e) { CheckboxTablePart.this.selectionChanged((IStructuredSelection) e.getSelection()); } }); tableViewer.addCheckStateListener(new ICheckStateListener() { + @Override public void checkStateChanged(CheckStateChangedEvent event) { elementChecked(event.getElement(), event.getChecked()); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPartWithButtons.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPartWithButtons.java index e0b1a396114..f8b1d4b575a 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPartWithButtons.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/part/SharedPartWithButtons.java @@ -29,9 +29,11 @@ public abstract class SharedPartWithButtons extends SharedPart { private Composite buttonContainer; private class SelectionHandler implements SelectionListener { + @Override public void widgetSelected(SelectionEvent e) { buttonSelected(e); } + @Override public void widgetDefaultSelected(SelectionEvent e) { buttonSelected(e); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/AbstractMakefileEditorPreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/AbstractMakefileEditorPreferencePage.java index 9c4329280d2..ecd6797489f 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/AbstractMakefileEditorPreferencePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/AbstractMakefileEditorPreferencePage.java @@ -14,7 +14,6 @@ package org.eclipse.cdt.make.internal.ui.preferences; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import com.ibm.icu.text.MessageFormat; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -40,24 +39,29 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; +import com.ibm.icu.text.MessageFormat; + /** * AbstraceMakeEditorPreferencePage */ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { OverlayPreferenceStore fOverlayStore; - + Map fCheckBoxes= new HashMap(); private SelectionListener fCheckBoxListener= new SelectionListener() { + @Override public void widgetDefaultSelected(SelectionEvent e) { } + @Override public void widgetSelected(SelectionEvent e) { Button button= (Button) e.widget; fOverlayStore.setValue(fCheckBoxes.get(button), button.getSelection()); } }; - + Map fTextFields= new HashMap(); private ModifyListener fTextFieldListener= new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { Text text= (Text) e.widget; fOverlayStore.setValue(fTextFields.get(text), text.getText()); @@ -66,25 +70,27 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag private Map fNumberFields= new HashMap(); private ModifyListener fNumberFieldListener= new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { numberFieldChanged((Text) e.widget); } }; - + public AbstractMakefileEditorPreferencePage() { super(); setPreferenceStore(MakeUIPlugin.getDefault().getPreferenceStore()); fOverlayStore= createOverlayStore(); } - + protected abstract OverlayPreferenceStore createOverlayStore(); - + /* (non-Javadoc) * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) */ + @Override public void init(IWorkbench workbench) { } - + protected void initializeFields() { Map checkBoxes= getCheckBoxes(); Map textFields= getTextFields(); @@ -94,15 +100,15 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag String key= checkBoxes.get(b); b.setSelection(getOverlayStore().getBoolean(key)); } - + e= textFields.keySet().iterator(); while (e.hasNext()) { Text t= (Text) e.next(); String key= textFields.get(t); t.setText(getOverlayStore().getString(key)); - } + } } - + /* (non-Javadoc) * @see org.eclipse.jface.preference.IPreferencePage#performOk() */ @@ -112,27 +118,27 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag MakeUIPlugin.getDefault().savePluginPreferences(); return true; } - + protected OverlayPreferenceStore getOverlayStore() { return fOverlayStore; } - + protected OverlayPreferenceStore setOverlayStore() { return fOverlayStore; } - + protected Map getCheckBoxes() { return fCheckBoxes; } - + protected Map getTextFields() { return fTextFields; } - + protected Map getNumberFields() { return fNumberFields; } - + /* (non-Javadoc) * @see org.eclipse.jface.preference.PreferencePage#performDefaults() */ @@ -143,9 +149,9 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag handleDefaults(); super.performDefaults(); } - + protected abstract void handleDefaults(); - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#dispose() */ @@ -157,35 +163,35 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag } super.dispose(); } - - protected Button addCheckBox(Composite parent, String labelText, String key, int indentation) { + + 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; 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); label.setText(labelText); label.setFont(font); 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); + textControl.setFont(font); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.widthHint= convertWidthInCharsToPixels(textLimit + 1); textControl.setLayoutData(gd); @@ -197,10 +203,10 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag } else { textControl.addModifyListener(fTextFieldListener); } - + return textControl; } - + void numberFieldChanged(Text textControl) { String number= textControl.getText(); IStatus status= validatePositiveNumber(number, getNumberFields().get(textControl)); @@ -209,7 +215,7 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag } updateStatus(status); } - + private IStatus validatePositiveNumber(String number, String[] errorMessages) { StatusInfo status= new StatusInfo(); if (number.length() == 0) { @@ -225,7 +231,7 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag } return status; } - + private void updateStatus(IStatus status) { if (!status.matches(IStatus.ERROR)) { Set keys= getNumberFields().keySet(); @@ -234,7 +240,7 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag IStatus s= validatePositiveNumber(text.getText(), getNumberFields().get(text)); status= s.getSeverity() > status.getSeverity() ? s : status; } - } + } setValid(!status.matches(IStatus.ERROR)); applyToStatusLine(this, status); } @@ -252,21 +258,21 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag case IStatus.WARNING: page.setMessage(message, IMessageProvider.WARNING); page.setErrorMessage(null); - break; + break; case IStatus.INFO: page.setMessage(message, IMessageProvider.INFORMATION); page.setErrorMessage(null); - break; + break; default: if (message.length() == 0) { message= null; } page.setMessage(null); page.setErrorMessage(message); - break; + break; } } - + /** * Returns an array of size 2: * - first element is of type Label @@ -280,8 +286,8 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= indentation; labelControl.setLayoutData(gd); - - Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE); + + Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.widthHint= convertWidthInCharsToPixels(textLimit + 1); textControl.setLayoutData(gd); @@ -294,10 +300,10 @@ public abstract class AbstractMakefileEditorPreferencePage extends PreferencePag } else { textControl.addModifyListener(fTextFieldListener); } - + 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$ diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/ColorEditor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/ColorEditor.java index a0ac1181260..7e80cc46193 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/ColorEditor.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/ColorEditor.java @@ -33,24 +33,24 @@ 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); gc.setBackground(fButton.getBackground()); gc.fillRectangle(0, 0, fExtent.x, fExtent.y); gc.dispose(); - + fButton.setImage(fImage); fButton.addSelectionListener(new SelectionAdapter() { @Override @@ -64,8 +64,9 @@ public class ColorEditor { } } }); - + fButton.addDisposeListener(new DisposeListener() { + @Override public void widgetDisposed(DisposeEvent event) { if (fImage != null) { fImage.dispose(); @@ -78,39 +79,39 @@ public class ColorEditor { } }); } - + public RGB getColorValue() { return fColorValue; } - + public void setColorValue(RGB rgb) { fColorValue= rgb; updateColorImage(); } - + public Button getButton() { return fButton; } - + protected void updateColorImage() { - + 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); 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); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java index 7b8819d1fd1..c9c1ae6a47a 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java @@ -26,7 +26,7 @@ public class MakePreferencePage extends FieldEditorPreferencePage implements IWo private static final String PREF_BUILD_TARGET_IN_BACKGROUND = "MakeTargetPrefs.buildTargetInBackground"; //$NON-NLS-1$ private static final String TARGET_BUILDS_IN_BACKGROUND = "MakeTargetPreferencePage.buildTargetInBackground.label"; //$NON-NLS-1$ - + private static final String PREF_BUILD_LAST_TARGET = "MakeTargetPrefs.buildLastTarget"; //$NON-NLS-1$ private static final String BUILD_LAST_TARGET = "MakeTargetPreferencePage.buildLastTarget.title"; //$NON-NLS-1$ private static final String PREF_BUILD_LAST_PROJECT = "MakeTargetPrefs.buildLastTarget.project"; //$NON-NLS-1$ @@ -57,15 +57,15 @@ public class MakePreferencePage extends FieldEditorPreferencePage implements IWo BooleanFieldEditor tagetBackgroundEditor = new BooleanFieldEditor(PREF_BUILD_TARGET_IN_BACKGROUND, MakeUIPlugin.getResourceString(TARGET_BUILDS_IN_BACKGROUND), parent); addField(tagetBackgroundEditor); - + // make last target for selected resource or project RadioGroupFieldEditor edit = new RadioGroupFieldEditor( PREF_BUILD_LAST_TARGET, - MakeUIPlugin.getResourceString(BUILD_LAST_TARGET), 1, + MakeUIPlugin.getResourceString(BUILD_LAST_TARGET), 1, new String[][] { {MakeUIPlugin.getResourceString(BUILD_LAST_PROJECT), PREF_BUILD_LAST_PROJECT}, - {MakeUIPlugin.getResourceString(BUILD_LAST_RESOURCE), PREF_BUILD_LAST_RESOURCE}, - {MakeUIPlugin.getResourceString(BUILD_LAST_PROJECTROOT), PREF_BUILD_LAST_PROJECTROOT} }, + {MakeUIPlugin.getResourceString(BUILD_LAST_RESOURCE), PREF_BUILD_LAST_RESOURCE}, + {MakeUIPlugin.getResourceString(BUILD_LAST_PROJECTROOT), PREF_BUILD_LAST_PROJECTROOT} }, parent, true); addField(edit); @@ -81,17 +81,17 @@ public class MakePreferencePage extends FieldEditorPreferencePage implements IWo /** * preference to rebuild last target - * - * @return {@code true} if from root folder of selected project + * + * @return {@code true} if from root folder of selected project */ public static boolean useProjectRootForLastMakeTarget() { return MakeUIPlugin.getDefault().getPreferenceStore().getString(PREF_BUILD_LAST_TARGET).equals(PREF_BUILD_LAST_PROJECTROOT); } - + /** * preference to rebuild last target - * - * @return {@code true} if from selected project irrespective in which container + * + * @return {@code true} if from selected project irrespective in which container */ public static boolean useProjectLastMakeTarget() { return MakeUIPlugin.getDefault().getPreferenceStore().getString(PREF_BUILD_LAST_TARGET).equals(PREF_BUILD_LAST_PROJECT); @@ -104,6 +104,7 @@ public class MakePreferencePage extends FieldEditorPreferencePage implements IWo prefs.setDefault(PREF_BUILD_LAST_TARGET, PREF_BUILD_LAST_PROJECT); } + @Override public void init(IWorkbench workbench) { } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferencePage.java index bc91186dbe7..4340980f901 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferencePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileEditorPreferencePage.java @@ -65,13 +65,13 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen ColorSelector fSyntaxForegroundColorEditor; Button fBoldCheckBox; Button fItalicCheckBox; - + // folding protected Button fFoldingCheckbox; /** * Item in the highlighting color list. - * + * * @since 3.0 */ private class HighlightingColorListItem { @@ -85,10 +85,10 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen 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 @@ -102,35 +102,35 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen 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 */ @@ -141,7 +141,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen /** * Color list label provider. - * + * * @since 3.0 */ private class ColorListLabelProvider extends LabelProvider implements IColorProvider { @@ -153,10 +153,11 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen public String getText(Object element) { return ((HighlightingColorListItem)element).getDisplayName(); } - + /* * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object) */ + @Override public Color getForeground(Object element) { return ((HighlightingColorListItem)element).getItemColor(); } @@ -164,14 +165,15 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen /* * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object) */ + @Override public Color getBackground(Object element) { return null; } } - + /** * Color list content provider. - * + * * @since 3.0 */ private class ColorListContentProvider implements IStructuredContentProvider { @@ -179,6 +181,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen /* * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ + @Override public Object[] getElements(Object inputElement) { return ((List)inputElement).toArray(); } @@ -186,20 +189,22 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen /* * @see org.eclipse.jface.viewers.IContentProvider#dispose() */ + @Override public void dispose() { } /* * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } } - + /** - * + * */ public MakefileEditorPreferencePage() { super(); @@ -221,12 +226,12 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, MakefileEditorPreferenceConstants.EDITOR_FOLDING_CONDITIONAL)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, MakefileEditorPreferenceConstants.EDITOR_FOLDING_MACRODEF)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, MakefileEditorPreferenceConstants.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()]; overlayKeys.toArray(keys); return new OverlayPreferenceStore(getPreferenceStore(), keys); @@ -246,33 +251,33 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen MakeUIPlugin.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()); + folder.setLayout(new TabFolderLayout()); folder.setLayoutData(new GridData(GridData.FILL_BOTH)); - + TabItem item= new TabItem(folder, SWT.NONE); item.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.syntax")); //$NON-NLS-1$ item.setControl(createSyntaxPage(folder)); - + item= new TabItem(folder, SWT.NONE); item.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.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] + MakefileEditorPreferenceConstants.EDITOR_BOLD_SUFFIX, + fSyntaxColorListModel[i][1] + MakefileEditorPreferenceConstants.EDITOR_BOLD_SUFFIX, fSyntaxColorListModel[i][1] + MakefileEditorPreferenceConstants.EDITOR_ITALIC_SUFFIX, null)); } fHighlightingColorListViewer.setInput(fHighlightingColorList); @@ -283,12 +288,12 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen void initializeFolding() { boolean enabled= getOverlayStore().getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED); - fFoldingCheckbox.setSelection(enabled); + fFoldingCheckbox.setSelection(enabled); } void initializeDefaultFolding() { boolean enabled= getOverlayStore().getDefaultBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED); - fFoldingCheckbox.setSelection(enabled); + fFoldingCheckbox.setSelection(enabled); } /* (non-Javadoc) @@ -299,9 +304,9 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen handleSyntaxColorListSelection(); initializeDefaultFolding(); } - + private Control createSyntaxPage(Composite parent) { - + Composite colorComposite= new Composite(parent, SWT.NONE); colorComposite.setLayout(new GridLayout()); @@ -316,7 +321,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen layout.marginWidth= 0; editorComposite.setLayout(layout); GridData gd= new GridData(GridData.FILL_BOTH); - editorComposite.setLayoutData(gd); + editorComposite.setLayoutData(gd); fHighlightingColorListViewer= new TableViewer(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); fHighlightingColorListViewer.setLabelProvider(new ColorListLabelProvider()); @@ -325,7 +330,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen 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; @@ -333,7 +338,7 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen layout.numColumns= 2; stylesComposite.setLayout(layout); stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); - + label= new Label(stylesComposite, SWT.LEFT); label.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.color")); //$NON-NLS-1$ gd= new GridData(); @@ -345,14 +350,14 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen gd= new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment= GridData.BEGINNING; foregroundColorButton.setLayoutData(gd); - + fBoldCheckBox= new Button(stylesComposite, SWT.CHECK); fBoldCheckBox.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.bold")); //$NON-NLS-1$ gd= new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment= GridData.BEGINNING; gd.horizontalSpan= 2; fBoldCheckBox.setLayoutData(gd); - + fItalicCheckBox= new Button(stylesComposite, SWT.CHECK); fItalicCheckBox.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.italic")); //$NON-NLS-1$ gd= new GridData(GridData.FILL_HORIZONTAL); @@ -361,15 +366,18 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen fItalicCheckBox.setLayoutData(gd); fHighlightingColorListViewer.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { handleSyntaxColorListSelection(); } }); foregroundColorButton.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(SelectionEvent e) { // do nothing } + @Override public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); PreferenceConverter.setValue(getOverlayStore(), item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue()); @@ -377,28 +385,32 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen }); fBoldCheckBox.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(SelectionEvent e) { // do nothing } + @Override public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); getOverlayStore().setValue(item.getBoldKey(), fBoldCheckBox.getSelection()); } }); - + fItalicCheckBox.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(SelectionEvent e) { // do nothing } + @Override public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); getOverlayStore().setValue(item.getItalicKey(), fItalicCheckBox.getSelection()); } }); - + return colorComposite; } - + private Composite createFoldingTabContent(TabFolder folder) { Composite composite= new Composite(folder, SWT.NULL); @@ -410,37 +422,39 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen //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.setText(MakefilePreferencesMessages.getString("MakefileEditorPreferencePage.foldingenable")); //$NON-NLS-1$ gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING); fFoldingCheckbox.setLayoutData(gd); fFoldingCheckbox.addSelectionListener(new SelectionListener() { + @Override public void widgetSelected(SelectionEvent e) { - boolean enabled= fFoldingCheckbox.getSelection(); + boolean enabled= fFoldingCheckbox.getSelection(); getOverlayStore().setValue(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED, enabled); } + @Override public void widgetDefaultSelected(SelectionEvent e) { } }); - + return composite; } void handleSyntaxColorListSelection() { HighlightingColorListItem item= getHighlightingColorListItem(); RGB rgb= PreferenceConverter.getColor(getOverlayStore(), item.getColorKey()); - fSyntaxForegroundColorEditor.setColorValue(rgb); + 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 */ @@ -457,14 +471,14 @@ public class MakefileEditorPreferencePage extends AbstractMakefileEditorPreferen return super.performOk(); } - 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.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileSettingsPreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileSettingsPreferencePage.java index e6d43c8ae0d..a4a5372cb8c 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileSettingsPreferencePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakefileSettingsPreferencePage.java @@ -74,6 +74,7 @@ public class MakefileSettingsPreferencePage extends FieldEditorPreferencePage im public static void initDefaults(IPreferenceStore prefs) { } + @Override public void init(IWorkbench workbench) { } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/NewMakeProjectPreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/NewMakeProjectPreferencePage.java index f83e46e81bb..4d8b66eb45d 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/NewMakeProjectPreferencePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/NewMakeProjectPreferencePage.java @@ -29,12 +29,12 @@ import org.eclipse.ui.IWorkbenchPreferencePage; * It is left here for compatibility reasons only. * The page is superseded by "New CDT Project Wizard/Makefile Project" page, * class {@code org.eclipse.cdt.managedbuilder.ui.preferences.PrefPage_NewCDTProject}. - * + * * @deprecated as of CDT 4.0. */ @Deprecated public class NewMakeProjectPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, ICOptionContainer { - + private MakeProjectOptionBlock fOptionBlock; public NewMakeProjectPreferencePage() { @@ -43,7 +43,7 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor fOptionBlock = new MakeProjectOptionBlock(); } - + @Override public void setContainer(IPreferencePageContainer preferencePageContainer) { super.setContainer(preferencePageContainer); @@ -63,7 +63,8 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor return fOptionBlock.createContents(parent); } - + + @Override public void init(IWorkbench workbench) { } @@ -83,6 +84,7 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor fOptionBlock.setVisible(visible); } + @Override public void updateContainer() { fOptionBlock.update(); boolean ok = fOptionBlock.isValid(); @@ -95,6 +97,7 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor setValid(ok); } + @Override public IProject getProject() { return null; } @@ -114,6 +117,7 @@ public class NewMakeProjectPreferencePage extends PreferencePage implements IWor /* (non-Javadoc) * @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getPreferences() */ + @Override public Preferences getPreferences() { return MakeCorePlugin.getDefault().getPluginPreferences(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/OverlayPreferenceStore.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/OverlayPreferenceStore.java index 080f5317047..efa23697ea2 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/OverlayPreferenceStore.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/OverlayPreferenceStore.java @@ -23,57 +23,58 @@ import org.eclipse.jface.util.PropertyChangeEvent; * An overlaying preference store. */ 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 class OverlayKey { - + TypeDescriptor fDescriptor; String fKey; - + public OverlayKey(TypeDescriptor descriptor, String key) { fDescriptor= descriptor; fKey= key; } } - + private class PropertyListener implements IPropertyChangeListener { - + /* * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent) */ + @Override public void propertyChange(PropertyChangeEvent event) { 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(); } - + OverlayKey findOverlayKey(String key) { for (int i= 0; i < fOverlayKeys.length; i++) { if (fOverlayKeys[i].fKey.equals(key)) @@ -81,41 +82,41 @@ class OverlayPreferenceStore implements IPreferenceStore { } 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; if (BOOLEAN == d) { - + 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); if (targetValue != originValue) target.setValue(key.fKey, originValue); - + } else if (FLOAT == d) { - + 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); @@ -139,100 +140,103 @@ class OverlayPreferenceStore implements IPreferenceStore { } } - + public void propagate() { 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; 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++) loadProperty(fParent, fOverlayKeys[i], fStore, true); } - + public void loadDefaults() { for (int i= 0; i < fOverlayKeys.length; i++) setToDefault(fOverlayKeys[i].fKey); } - + public void start() { if (fPropertyListener == null) { fPropertyListener= new PropertyListener(); fParent.addPropertyChangeListener(fPropertyListener); } } - + public void stop() { if (fPropertyListener != null) { fParent.removePropertyChangeListener(fPropertyListener); fPropertyListener= null; } } - + /* * @see IPreferenceStore#addPropertyChangeListener(IPropertyChangeListener) */ + @Override public void addPropertyChangeListener(IPropertyChangeListener listener) { fStore.addPropertyChangeListener(listener); } - + /* * @see IPreferenceStore#removePropertyChangeListener(IPropertyChangeListener) */ + @Override public void removePropertyChangeListener(IPropertyChangeListener listener) { fStore.removePropertyChangeListener(listener); } - + /* * @see IPreferenceStore#firePropertyChangeEvent(String, Object, Object) */ + @Override public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { fStore.firePropertyChangeEvent(name, oldValue, newValue); } @@ -240,13 +244,15 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#contains(String) */ + @Override public boolean contains(String name) { return fStore.contains(name); } - + /* * @see IPreferenceStore#getBoolean(String) */ + @Override public boolean getBoolean(String name) { return fStore.getBoolean(name); } @@ -254,6 +260,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getDefaultBoolean(String) */ + @Override public boolean getDefaultBoolean(String name) { return fStore.getDefaultBoolean(name); } @@ -261,6 +268,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getDefaultDouble(String) */ + @Override public double getDefaultDouble(String name) { return fStore.getDefaultDouble(name); } @@ -268,6 +276,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getDefaultFloat(String) */ + @Override public float getDefaultFloat(String name) { return fStore.getDefaultFloat(name); } @@ -275,6 +284,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getDefaultInt(String) */ + @Override public int getDefaultInt(String name) { return fStore.getDefaultInt(name); } @@ -282,6 +292,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getDefaultLong(String) */ + @Override public long getDefaultLong(String name) { return fStore.getDefaultLong(name); } @@ -289,6 +300,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getDefaultString(String) */ + @Override public String getDefaultString(String name) { return fStore.getDefaultString(name); } @@ -296,6 +308,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getDouble(String) */ + @Override public double getDouble(String name) { return fStore.getDouble(name); } @@ -303,6 +316,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getFloat(String) */ + @Override public float getFloat(String name) { return fStore.getFloat(name); } @@ -310,6 +324,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getInt(String) */ + @Override public int getInt(String name) { return fStore.getInt(name); } @@ -317,6 +332,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getLong(String) */ + @Override public long getLong(String name) { return fStore.getLong(name); } @@ -324,6 +340,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#getString(String) */ + @Override public String getString(String name) { return fStore.getString(name); } @@ -331,6 +348,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#isDefault(String) */ + @Override public boolean isDefault(String name) { return fStore.isDefault(name); } @@ -338,6 +356,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#needsSaving() */ + @Override public boolean needsSaving() { return fStore.needsSaving(); } @@ -345,6 +364,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#putValue(String, String) */ + @Override public void putValue(String name, String value) { if (covers(name)) fStore.putValue(name, value); @@ -353,6 +373,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setDefault(String, double) */ + @Override public void setDefault(String name, double value) { if (covers(name)) fStore.setDefault(name, value); @@ -361,6 +382,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setDefault(String, float) */ + @Override public void setDefault(String name, float value) { if (covers(name)) fStore.setDefault(name, value); @@ -369,6 +391,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setDefault(String, int) */ + @Override public void setDefault(String name, int value) { if (covers(name)) fStore.setDefault(name, value); @@ -377,6 +400,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setDefault(String, long) */ + @Override public void setDefault(String name, long value) { if (covers(name)) fStore.setDefault(name, value); @@ -385,6 +409,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setDefault(String, String) */ + @Override public void setDefault(String name, String value) { if (covers(name)) fStore.setDefault(name, value); @@ -393,6 +418,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setDefault(String, boolean) */ + @Override public void setDefault(String name, boolean value) { if (covers(name)) fStore.setDefault(name, value); @@ -401,6 +427,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setToDefault(String) */ + @Override public void setToDefault(String name) { fStore.setToDefault(name); } @@ -408,6 +435,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setValue(String, double) */ + @Override public void setValue(String name, double value) { if (covers(name)) fStore.setValue(name, value); @@ -416,6 +444,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setValue(String, float) */ + @Override public void setValue(String name, float value) { if (covers(name)) fStore.setValue(name, value); @@ -424,6 +453,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setValue(String, int) */ + @Override public void setValue(String name, int value) { if (covers(name)) fStore.setValue(name, value); @@ -432,6 +462,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setValue(String, long) */ + @Override public void setValue(String name, long value) { if (covers(name)) fStore.setValue(name, value); @@ -440,6 +471,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setValue(String, String) */ + @Override public void setValue(String name, String value) { if (covers(name)) fStore.setValue(name, value); @@ -448,6 +480,7 @@ class OverlayPreferenceStore implements IPreferenceStore { /* * @see IPreferenceStore#setValue(String, boolean) */ + @Override public void setValue(String name, boolean value) { if (covers(name)) fStore.setValue(name, value); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/StatusInfo.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/StatusInfo.java index 317cd029dda..61dca193c63 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/StatusInfo.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/StatusInfo.java @@ -47,6 +47,7 @@ public class StatusInfo implements IStatus { /** * Returns if the status' severity is OK. */ + @Override public boolean isOK() { return fSeverity == IStatus.OK; } @@ -75,6 +76,7 @@ public class StatusInfo implements IStatus { /* (non-Javadoc) * @see org.eclipse.core.runtime.IStatus#getMessage() */ + @Override public String getMessage() { return fStatusMessage; } @@ -120,6 +122,7 @@ public class StatusInfo implements IStatus { /* * @see IStatus#matches(int) */ + @Override public boolean matches(int severityMask) { return (fSeverity & severityMask) != 0; } @@ -128,6 +131,7 @@ public class StatusInfo implements IStatus { * Returns always false. * @see IStatus#isMultiStatus() */ + @Override public boolean isMultiStatus() { return false; } @@ -135,6 +139,7 @@ public class StatusInfo implements IStatus { /* * @see IStatus#getSeverity() */ + @Override public int getSeverity() { return fSeverity; } @@ -142,6 +147,7 @@ public class StatusInfo implements IStatus { /* * @see IStatus#getPlugin() */ + @Override public String getPlugin() { return MakeUIPlugin.getPluginId(); } @@ -150,6 +156,7 @@ public class StatusInfo implements IStatus { * Returns always null. * @see IStatus#getException() */ + @Override public Throwable getException() { return null; } @@ -158,6 +165,7 @@ public class StatusInfo implements IStatus { * Returns always the error severity. * @see IStatus#getCode() */ + @Override public int getCode() { return fSeverity; } @@ -166,6 +174,7 @@ public class StatusInfo implements IStatus { * Returns always null. * @see IStatus#getChildren() */ + @Override public IStatus[] getChildren() { return new IStatus[0]; } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java index f2b2c569091..c53d4096be0 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java @@ -51,8 +51,8 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer public void setContainer(IPreferencePageContainer preferencePageContainer) { super.setContainer(preferencePageContainer); fOptionBlock.setOptionContainer(this); - } - + } + @Override protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); @@ -70,7 +70,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer private void contentForCProject(Composite parent) { fOptionBlock.createContents(parent); - // WorkbenchHelp.setHelp(parent, ICMakeHelpContextIds.PROJECT_PROPERTY_PAGE); + // WorkbenchHelp.setHelp(parent, ICMakeHelpContextIds.PROJECT_PROPERTY_PAGE); } private void contentForClosedProject(Composite parent) { @@ -84,6 +84,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer @Override public boolean performOk() { IRunnableWithProgress runnable = new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { fOptionBlock.performApply(monitor); } @@ -101,6 +102,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer return true; } + @Override public IProject getProject() { Object element = getElement(); if (element instanceof IProject) { @@ -115,6 +117,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer fOptionBlock.setVisible(visible); } + @Override public void updateContainer() { fOptionBlock.update(); setValid(fOptionBlock.isValid()); @@ -133,6 +136,7 @@ public class MakePropertyPage extends PropertyPage implements ICOptionContainer return super.isValid(); } + @Override public Preferences getPreferences() { return MakeCorePlugin.getDefault().getPluginPreferences(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/scannerconfig/DiscoveredElementLabelProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/scannerconfig/DiscoveredElementLabelProvider.java index 57c77d9a020..7f5659b71aa 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/scannerconfig/DiscoveredElementLabelProvider.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/scannerconfig/DiscoveredElementLabelProvider.java @@ -28,10 +28,10 @@ import org.eclipse.swt.widgets.Display; /** * Label provider for DiscoveredElement-s. DiscoveredElement can be active or removed. - * + * * @deprecated as of CDT 4.0. This class was used to set preferences/properties * for 3.X style projects. - * + * * @author vhirsl */ @Deprecated @@ -45,7 +45,7 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo private ImageDescriptorRegistry fRegistry; private final String DISABLED_LABEL = MakeUIPlugin. - getResourceString("ManageScannerConfigDialogCommon.discoveredGroup.annotation.disabled");//$NON-NLS-1$ + getResourceString("ManageScannerConfigDialogCommon.discoveredGroup.annotation.disabled");//$NON-NLS-1$ public DiscoveredElementLabelProvider() { fRegistry = CUIPlugin.getImageDescriptorRegistry(); @@ -58,7 +58,7 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo fIncludeAndMacrosFileIcon = CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_TUNIT_HEADER); fMacroIcon = fMacroGroupIcon; } - + /* (non-Javadoc) * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) */ @@ -138,6 +138,7 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo /* (non-Javadoc) * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object) */ + @Override public Color getForeground(Object element) { if (element instanceof DiscoveredElement) { DiscoveredElement elem = (DiscoveredElement) element; @@ -157,13 +158,14 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo /* (non-Javadoc) * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object) */ + @Override public Color getBackground(Object element) { return null; } /** * ComositeImageDescriptor adds 'removed' image overlay to the DiscoveredElement - * + * * @author vhirsl */ private class DiscoveredElementImageDescriptor extends CompositeImageDescriptor { @@ -199,7 +201,7 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo drawImage(data, 0, 0); } } - + /* (non-Javadoc) * @see org.eclipse.jface.resource.CompositeImageDescriptor#getSize() */ diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/ColorManager.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/ColorManager.java index 85b1013bd54..20fe2083bd3 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/ColorManager.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/ColorManager.java @@ -36,10 +36,10 @@ public class ColorManager implements ISharedTextColors { public static final RGB MAKE_DEFAULT_RGB = new RGB(0, 0, 0); private static ColorManager fgColorManager; - + private ColorManager() { } - + public static ColorManager getDefault() { if (fgColorManager == null) { fgColorManager= new ColorManager(); @@ -52,6 +52,7 @@ public class ColorManager implements ISharedTextColors { /* (non-Javadoc) * @see org.eclipse.jface.text.source.ISharedTextColors#dispose() */ + @Override public void dispose() { Iterator e = fColorTable.values().iterator(); while (e.hasNext()) @@ -61,6 +62,7 @@ public class ColorManager implements ISharedTextColors { /* (non-Javadoc) * @see org.eclipse.jface.text.source.ISharedTextColors#getColor(org.eclipse.swt.graphics.RGB) */ + @Override public Color getColor(RGB rgb) { Color color = fColorTable.get(rgb); if (color == null) { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/CompletionProposalComparator.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/CompletionProposalComparator.java index 36eba46952d..41f01c2fffa 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/CompletionProposalComparator.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/CompletionProposalComparator.java @@ -22,12 +22,13 @@ public class CompletionProposalComparator implements Comparator createRules() { IToken keyword = getToken(ColorManager.MAKE_KEYWORD_COLOR); @@ -67,6 +67,7 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner { // Add generic whitespace rule. rules.add(new WhitespaceRule(new IWhitespaceDetector() { + @Override public boolean isWhitespace(char character) { return Character.isWhitespace(character); } @@ -82,9 +83,11 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner { // Add word rule for keywords, types, and constants. // We restrict the detection of the keywords to be the first column to be valid. WordRule keyWordRule = new WordRule(new IWordDetector() { + @Override public boolean isWordPart(char c) { return Character.isLetterOrDigit(c) || c == '_'; } + @Override public boolean isWordStart(char c) { return Character.isLetterOrDigit(c) || c == '_' || c == '-'; }}, other); @@ -95,9 +98,11 @@ public class MakefileCodeScanner extends AbstractMakefileCodeScanner { rules.add(keyWordRule); WordRule functionRule = new WordRule(new IWordDetector() { + @Override public boolean isWordPart(char c) { return Character.isLetterOrDigit(c) || c == '_'; } + @Override public boolean isWordStart(char c) { return Character.isLetterOrDigit(c) || c == '_'; }}, other); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java index 5b0caedff70..17348d65c9a 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileCompletionProcessor.java @@ -51,6 +51,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* * @see IContextInformationValidator#isContextInformationValid(int) */ + @Override public boolean isContextInformationValid(int offset) { return Math.abs(fInstallOffset - offset) < 5; } @@ -58,6 +59,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int) */ + @Override public void install(IContextInformation info, ITextViewer viewer, int offset) { fInstallOffset = offset; } @@ -65,6 +67,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* * @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation) */ + @Override public boolean updatePresentation(int documentPosition, TextPresentation presentation) { return false; } @@ -75,6 +78,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* (non-Javadoc) * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ + @Override public int compare(Object o1, Object o2) { String name1; String name2; @@ -98,7 +102,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { //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); @@ -116,6 +120,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* (non-Javadoc) * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int) */ + @Override public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) { WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset); boolean macro = WordPartDetector.inMacro(viewer, documentOffset); @@ -171,6 +176,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* (non-Javadoc) * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int) */ + @Override public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) { WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset); boolean macro = WordPartDetector.inMacro(viewer, documentOffset); @@ -215,6 +221,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* (non-Javadoc) * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() */ + @Override public char[] getCompletionProposalAutoActivationCharacters() { return null; } @@ -222,6 +229,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* (non-Javadoc) * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters() */ + @Override public char[] getContextInformationAutoActivationCharacters() { return null; } @@ -229,6 +237,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* (non-Javadoc) * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage() */ + @Override public String getErrorMessage() { return null; } @@ -236,6 +245,7 @@ public class MakefileCompletionProcessor implements IContentAssistProcessor { /* (non-Javadoc) * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator() */ + @Override public IContextInformationValidator getContextInformationValidator() { return fValidator; } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileReconcilingStrategy.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileReconcilingStrategy.java index c6e2af62b7b..375fcf9ae25 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileReconcilingStrategy.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileReconcilingStrategy.java @@ -34,7 +34,7 @@ import org.eclipse.ui.texteditor.ITextEditor; public class MakefileReconcilingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension { - private ITextEditor fEditor; + private ITextEditor fEditor; private IWorkingCopyManager fManager; private IDocumentProvider fDocumentProvider; private MakefileContentOutlinePage fOutliner; @@ -50,17 +50,19 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon } } - + /** * @see IReconcilingStrategy#setDocument(IDocument) */ + @Override public void setDocument(IDocument document) { - } + } /** * @see IReconcilingStrategy#reconcile(IRegion) */ + @Override public void reconcile(IRegion region) { reconcile(); } @@ -68,10 +70,11 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon /** * @see IReconcilingStrategy#reconcile(DirtyRegion, IRegion) */ + @Override public void reconcile(DirtyRegion dirtyRegion, IRegion region) { assert false : "This is a non-incremental reconciler"; //$NON-NLS-1$ } - + private void reconcile() { try { IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput()); @@ -82,7 +85,7 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon makefile.parse(makefile.getFileURI(), reader); } catch (IOException e) { } - + fOutliner.update(); } } finally { @@ -99,6 +102,7 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon /* * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void setProgressMonitor(IProgressMonitor monitor) { // no use for a progress monitor at the moment } @@ -106,8 +110,9 @@ public class MakefileReconcilingStrategy implements IReconcilingStrategy, IRecon /* * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#initialReconcile() */ + @Override public void initialReconcile() { // no need to reconcile initially // reconcile(); - } + } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileTextHover.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileTextHover.java index 990c4c59eb9..a5972f75687 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileTextHover.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileTextHover.java @@ -26,14 +26,14 @@ import org.eclipse.ui.IEditorPart; /** * MakefileTextHover - * + * */ public class MakefileTextHover implements ITextHover { private IEditorPart fEditor; /** - * + * */ public MakefileTextHover(IEditorPart editor) { fEditor = editor; @@ -41,10 +41,11 @@ public class MakefileTextHover implements ITextHover { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer, * org.eclipse.jface.text.IRegion) */ + @Override public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { if (hoverRegion != null) { try { @@ -64,7 +65,7 @@ public class MakefileTextHover implements ITextHover { statements = makefile.getBuiltinMacroDefinitions(name); } } - + if (statements == null) { statements = new IMacroDefinition[0]; } @@ -77,7 +78,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(); } @@ -90,10 +91,11 @@ public class MakefileTextHover implements ITextHover { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer, * int) */ + @Override public IRegion getHoverRegion(ITextViewer textViewer, int offset) { Point selection = textViewer.getSelectedRange(); if (selection.x <= offset && offset < selection.x + selection.y) { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileWordDetector.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileWordDetector.java index de816fe4f28..37f9ad31aa1 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileWordDetector.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/text/makefile/MakefileWordDetector.java @@ -21,6 +21,7 @@ public class MakefileWordDetector implements IWordDetector { /** * @see IWordDetector#isWordPart(char) */ + @Override public boolean isWordPart(char character) { return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0); } @@ -28,6 +29,7 @@ public class MakefileWordDetector implements IWordDetector { /** * @see IWordDetector#isWordStart(char) */ + @Override public boolean isWordStart(char character) { return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java index 06d5f0ef584..366738cc997 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeContentProvider.java @@ -55,7 +55,7 @@ import org.eclipse.swt.widgets.Display; /** * Content provider for Make Targets view and for Make Targets dialog from * "Make Targets"->"Build..." in project context menu. - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -76,7 +76,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /** * Constructor. - * + * * @param flat - {@code true} for "flat" representation for a table * or {@code false} to represent as a tree. */ @@ -87,6 +87,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) */ + @Override public Object[] getChildren(Object obj) { if (obj instanceof IWorkspaceRoot) { try { @@ -97,9 +98,9 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis } else if (obj instanceof IContainer) { IContainer container = (IContainer)obj; ArrayList children = new ArrayList(); - + boolean isAddingSourceRoots = !bFlatten && (container instanceof IProject) && CCorePlugin.showSourceRootsAtTopOfProject(); - + // add source roots if necessary if (isAddingSourceRoots) { IProject project = (IProject) container; @@ -110,7 +111,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis } } } - + // add regular folders try { IResource[] resources = container.members(); @@ -124,7 +125,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis } catch (CoreException e) { MakeCorePlugin.log(e); } - + // finally add targets try { IMakeTarget[] targets = MakeCorePlugin.getDefault().getTargetManager().getTargets(container); @@ -133,7 +134,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis MakeCorePlugin.log(e); } return children.toArray(); - + } else if (obj instanceof TargetSourceContainer) { ArrayList children = new ArrayList(); try { @@ -156,6 +157,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) */ + @Override public Object getParent(Object obj) { if (obj instanceof IMakeTarget) { // this is ambiguous as make target can sit in 2 places, in its container @@ -174,6 +176,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) */ + @Override public boolean hasChildren(Object obj) { return getChildren(obj).length > 0; } @@ -181,6 +184,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /* (non-Javadoc) * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object) */ + @Override public Object[] getElements(Object obj) { if (bFlatten) { List list = new ArrayList(); @@ -197,6 +201,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#dispose() */ + @Override public void dispose() { if (viewer != null) { MakeCorePlugin.getDefault().getTargetManager().removeListener(this); @@ -206,6 +211,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (this.viewer == null) { MakeCorePlugin.getDefault().getTargetManager().addListener(this); @@ -245,6 +251,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /* (non-Javadoc) * @see org.eclipse.cdt.make.core.IMakeTargetListener#targetChanged(org.eclipse.cdt.make.core.MakeTargetEvent) */ + @Override public void targetChanged(final MakeTargetEvent event) { final Control ctrl = viewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { @@ -253,6 +260,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis case MakeTargetEvent.PROJECT_REMOVED : ctrl.getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (!ctrl.isDisposed()) { viewer.refresh(); @@ -265,6 +273,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis case MakeTargetEvent.TARGET_REMOVED : ctrl.getDisplay().asyncExec(new Runnable() { + @Override public void run() { if (!ctrl.isDisposed()) { if (bFlatten) { @@ -331,6 +340,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis } if (!affected.isEmpty()) { Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) return; @@ -355,6 +365,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis } if (!affected.isEmpty()) { Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed()) return; @@ -372,6 +383,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /* (non-Javadoc) * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) */ + @Override public void resourceChanged(IResourceChangeEvent event) { final IResourceDelta delta = event.getDelta(); Control ctrl = viewer.getControl(); @@ -381,29 +393,31 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /** * {@inheritDoc} - * + * * @since 7.1 */ + @Override public void handleEvent(final CProjectDescriptionEvent event) { Display display = Display.getDefault(); display.asyncExec(new Runnable() { + @Override public void run() { ICDescriptionDelta delta = event.getDefaultSettingCfgDelta(); if (delta==null) return; - + int flags = delta.getChangeFlags(); if ( ((flags & ICDescriptionDelta.SOURCE_ADDED) != 0) || ((flags & ICDescriptionDelta.SOURCE_REMOVED) != 0) ) { - + IProject project = null; ICSettingObject setting = delta.getOldSetting(); if (setting==null) setting = delta.getNewSetting(); - + if (setting instanceof ICConfigurationDescription) project = ((ICConfigurationDescription) setting).getProjectDescription().getProject(); - + if (project!=null) viewer.refresh(project); else @@ -415,12 +429,14 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis /** * {@inheritDoc} - * + * * @since 7.1 */ + @Override public void preferenceChange(PreferenceChangeEvent event) { if (event.getKey().equals(CCorePreferenceConstants.SHOW_SOURCE_ROOTS_AT_TOP_LEVEL_OF_PROJECT)) { Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { viewer.refresh(); } @@ -441,16 +457,16 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis return srcEntries; } } - + return new ICSourceEntry[0]; } /** * Check if the resource is in the list of source entries. - + * @param rc - resource to check. * @return {@code true} if the resource is a source folder, {@code false} otherwise. - * + * * @since 7.1 */ public static boolean isSourceEntry(IResource rc) { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java index 38981bbcb51..a243effc37d 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/MakeLabelProvider.java @@ -27,7 +27,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider; /** * Label provider for Make Targets view and for Make Targets dialog from * "Make Targets"->"Build..." in project context menu. - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -85,10 +85,12 @@ public class MakeLabelProvider extends LabelProvider implements ITableLabelProvi fLableProvider.dispose(); } + @Override public Image getColumnImage(Object obj, int columnIndex) { return columnIndex == 0 ? getImage(obj) : null; } + @Override public String getColumnText(Object obj, int columnIndex) { switch (columnIndex) { case 0 : diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java index a496a8556f6..c7cb4d5b276 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java @@ -112,6 +112,7 @@ public class TargetBuild { final IMakeTarget target = targets[i]; IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { target.build(new SubProgressMonitor(monitor, 1)); } @@ -126,7 +127,7 @@ public class TargetBuild { } return Status.OK_STATUS; } - + @Override public boolean belongsTo(Object family) { return ResourcesPlugin.FAMILY_MANUAL_BUILD == family; diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java index 6b0ea061fab..c3d4dcba73a 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetListViewerPart.java @@ -46,12 +46,12 @@ public class TargetListViewerPart extends StructuredViewerPart { private final int REMOVE_TARGET = 1; private final int EDIT_TARGET = 2; private IContainer fContainer; - private boolean recursive; - - /** - * @param container + private boolean recursive; + + /** + * @param container * @param recursive {@code true} if to search recursively for target - * + * * @since 7.0 */ public TargetListViewerPart(IContainer container, boolean recursive) { @@ -88,7 +88,8 @@ public class TargetListViewerPart extends StructuredViewerPart { tableViewer .addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent e) { + @Override + public void selectionChanged(SelectionChangedEvent e) { TargetListViewerPart.this .selectionChanged((IStructuredSelection) e .getSelection()); @@ -170,7 +171,7 @@ public class TargetListViewerPart extends StructuredViewerPart { /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.make.internal.ui.part.SharedPart#updateEnabledState() */ @Override @@ -182,7 +183,7 @@ public class TargetListViewerPart extends StructuredViewerPart { /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.make.internal.ui.part.SharedPart#createControl(org.eclipse.swt.widgets.Composite, * int, int) */ diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java index 3e2c3a7cf28..0fe3cee36c1 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractTargetAction.java @@ -56,10 +56,12 @@ public abstract class AbstractTargetAction return fContainer; } + @Override public void setActivePart(IAction action, IWorkbenchPart targetPart) { fPart = targetPart; } + @Override public void init(IWorkbenchWindow window) { fWindow = window; } @@ -92,7 +94,7 @@ public abstract class AbstractTargetAction } else { fContainer = null; } - } else if (selection instanceof ITextSelection) { + } else if (selection instanceof ITextSelection) { // Key binding pressed inside active text editor fContainer= null; IWorkbenchPart part = fPart != null ? fPart : fWindow.getActivePage().getActivePart(); @@ -101,7 +103,7 @@ public abstract class AbstractTargetAction if (file != null) { fContainer = file.getParent(); } - } + } } if (fContainer != null && MakeCorePlugin.getDefault().getTargetManager().hasTargetBuilder(fContainer.getProject())) { isEnabled = true; @@ -112,7 +114,7 @@ public abstract class AbstractTargetAction /** * @return {@code true} if the action is enabled or {@code false} otherwise. - * + * * @since 7.0 */ public boolean isEnabled() { diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildLastTargetHandler.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildLastTargetHandler.java index e8a4153a576..2b17b3fa69e 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildLastTargetHandler.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildLastTargetHandler.java @@ -19,14 +19,15 @@ import org.eclipse.ui.handlers.HandlerUtil; /** * Handler for {@link org.eclipse.cdt.make.ui.actions.BuildLastTargetAction} - * + * * @since 7.0 - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ public class BuildLastTargetHandler extends AbstractHandler { - + + @Override public Object execute(ExecutionEvent event) throws ExecutionException { final BuildLastTargetAction buildAction= new BuildLastTargetAction(); ISelection selection = HandlerUtil.getCurrentSelection( event ); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java index 52ab4f2d034..b216a50c077 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetAction.java @@ -32,28 +32,28 @@ import org.eclipse.ui.keys.IBindingService; * @noinstantiate This class is not intended to be instantiated by clients. */ public class BuildTargetAction extends AbstractTargetAction { - + private static final String TARGET_BUILD_COMMAND = "org.eclipse.cdt.make.ui.targetBuildCommand"; //$NON-NLS-1$ private IBindingService bindingService; private IAction InitAction; - + public BuildTargetAction(){ bindingService = null; InitAction = null; } - + @Override public void init(IAction action) { bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class); if (bindingService != null) { bindingService.addBindingManagerListener(bindingManagerListener); String keyBinding = bindingService.getBestActiveBindingFormattedFor(TARGET_BUILD_COMMAND); - if (keyBinding != null) + if (keyBinding != null) action.setText(MakeUIPlugin.getResourceString("ActionMakeBuildTarget.label")+"\t"+ keyBinding); //$NON-NLS-1$ //$NON-NLS-2$ } InitAction = action; } - + @Override public void run(IAction action) { IContainer container = getSelectedContainer(); @@ -86,26 +86,27 @@ public class BuildTargetAction extends AbstractTargetAction { } } } - + @Override public void dispose() { if (bindingService != null) { bindingService.removeBindingManagerListener(bindingManagerListener); bindingService = null; } - + super.dispose(); } private IBindingManagerListener bindingManagerListener = new IBindingManagerListener() { + @Override public void bindingManagerChanged(BindingManagerEvent event) { - + if (event.isActiveBindingsChanged()) { String keyBinding = bindingService.getBestActiveBindingFormattedFor(TARGET_BUILD_COMMAND); if (keyBinding != null) InitAction.setText( MakeUIPlugin.getResourceString("ActionMakeBuildTarget.label")+"\t"+ keyBinding); //$NON-NLS-1$ //$NON-NLS-2$ - + } } }; diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetHandler.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetHandler.java index ebee40f2fbb..c6f85d422cc 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetHandler.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/BuildTargetHandler.java @@ -19,14 +19,15 @@ import org.eclipse.ui.handlers.HandlerUtil; /** * Handler for {@link org.eclipse.cdt.make.ui.actions.BuildTargetAction} - * + * * @since 7.1 - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ public class BuildTargetHandler extends AbstractHandler { - + + @Override public Object execute(ExecutionEvent event) throws ExecutionException { final BuildTargetAction buildAction= new BuildTargetAction(); ISelection selection = HandlerUtil.getCurrentSelection( event ); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java index d13dfe0abb0..a5f3ecedfd6 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java @@ -57,12 +57,15 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate { private ISelection fSelection; + @Override public void dispose() { } + @Override public void init(IWorkbenchWindow window) { } + @Override public void run(IAction action) { if (fSelection instanceof IStructuredSelection) { Object[] elems = ((IStructuredSelection) fSelection).toArray(); @@ -126,9 +129,11 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate { static public void run(boolean fork, IRunnableContext context, final IProject[] projects) { try { context.run(fork, true, new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { doProjectUpdate(monitor, projects); } @@ -161,6 +166,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate { monitor.beginTask(MakeUIPlugin.getResourceString("UpdateMakeProjectAction.monitor.convert"), TOTAL_WORK); //$NON-NLS-1$ } + @Override public boolean visit(IResourceProxy proxy) throws CoreException { try { if (proxy.getType() != IResource.FOLDER && proxy.getType() != IResource.PROJECT) { @@ -254,6 +260,7 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate { } } + @Override public void selectionChanged(IAction action, ISelection selection) { boolean enabled = false; fSelection = selection; diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java index 9fc5dba5f8d..c22f842fb96 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/AbstractDiscoveryOptionsBlock.java @@ -39,7 +39,7 @@ import org.eclipse.swt.widgets.Composite; /** * Fremework for loading profile option pages - * + * * @author vhirsl */ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage { @@ -57,12 +57,12 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage private static final String ERROR_MESSAGE = "ScannerConfigOptionsDialog.error.message"; //$NON-NLS-1$ private static final String PROFILE_PAGE = "profilePage"; //$NON-NLS-1$ private static final String PROFILE_ID = "profileId"; //$NON-NLS-1$ - + private Preferences fPrefs; private IScannerConfigBuilderInfo2 fBuildInfo; private boolean fInitialized = false; private String fPersistedProfileId = null; - + private Map fProfilePageMap = null; // Composite parent provided by the block. @@ -124,19 +124,19 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage } return rc; } - + public boolean isProfileDifferentThenPersisted() { - return (fPersistedProfileId != null && + return (fPersistedProfileId != null && !fPersistedProfileId.equals(getBuildInfo().getSelectedProfileId())); } - + public void updatePersistedProfile() { fPersistedProfileId = getBuildInfo().getSelectedProfileId(); } - + /** * Create a profile page only on request - * + * * @author vhirsl */ protected static class DiscoveryProfilePageConfiguration { @@ -170,11 +170,11 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage } /** - * + * */ private void initializeProfilePageMap() { fProfilePageMap = new HashMap(5); - + IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(MakeUIPlugin.getPluginId(), "DiscoveryProfilePage"); //$NON-NLS-1$ IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); for (int i = 0; i < infos.length; i++) { @@ -191,7 +191,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage @Override public void setContainer(ICOptionContainer container) { super.setContainer(container); - + fPrefs = getContainer().getPreferences(); IProject project = getContainer().getProject(); @@ -200,7 +200,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage try { fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project); } catch (CoreException e) { - // missing builder information (builder disabled or legacy project) + // missing builder information (builder disabled or legacy project) fInitialized = false; fBuildInfo = null; } @@ -245,7 +245,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage fBuildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fPrefs, true); } } - + protected Composite getCompositeParent() { return fCompositeParent; } @@ -305,7 +305,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage public boolean isValid() { return (getCurrentPage() == null) ? true : getCurrentPage().isValid(); } - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage() */ @@ -313,9 +313,9 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage public String getErrorMessage() { return getCurrentPage().getErrorMessage(); } - + protected AbstractDiscoveryPage getDiscoveryProfilePage(String profileId) { - DiscoveryProfilePageConfiguration configElement = + DiscoveryProfilePageConfiguration configElement = fProfilePageMap.get(profileId); if (configElement != null) { try { @@ -327,14 +327,14 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage } protected String getDiscoveryProfileName(String profileId) { - DiscoveryProfilePageConfiguration configElement = + DiscoveryProfilePageConfiguration configElement = fProfilePageMap.get(profileId); if (configElement != null) { return configElement.getName(); } return null; } - + protected String getDiscoveryProfileId(String profileName) { Set profileIds = fProfilePageMap.keySet(); for (String profileId : profileIds) { @@ -345,21 +345,22 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage } return null; } - + protected List getDiscoveryProfileIdList() { return new ArrayList(fProfilePageMap.keySet()); } - + protected abstract String getCurrentProfileId(); /** - * + * */ public void callPerformApply() { try { new ProgressMonitorDialog(getShell()).run(false, false, new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { performApply(monitor); } @@ -367,7 +368,7 @@ public abstract class AbstractDiscoveryOptionsBlock extends AbstractCOptionPage throw new InvocationTargetException(e); } } - + }); } catch (InvocationTargetException e) { String title = MakeUIPlugin.getResourceString(ERROR_TITLE); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java index 0d8cb5d9d46..33f5d14451a 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/BuildTargetDialog.java @@ -47,7 +47,7 @@ public class BuildTargetDialog extends Dialog { fContainer = container; targetPart = new TargetListViewerPart(fContainer, recursive); } - + public BuildTargetDialog(Shell parent, IContainer container) { this(parent, container, true); } @@ -91,11 +91,13 @@ public class BuildTargetDialog extends Dialog { gd.widthHint = convertWidthInCharsToPixels(50); targetPart.getControl().setLayoutData(gd); targetPart.getViewer().addDoubleClickListener(new IDoubleClickListener() { + @Override public void doubleClick(DoubleClickEvent event) { okPressed(); } }); targetPart.getViewer().addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { getButton(IDialogConstants.OK_ID).setEnabled(targetPart.getSelectedTarget() != null); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java index e6933eb3a9a..6417ebaaa7e 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java @@ -79,12 +79,12 @@ import org.eclipse.ui.contexts.IWorkbenchContextSupport; /** * A dialog page to manage discovered scanner configuration - * + * * @deprecated as of CDT 4.0. This tab was used to set preferences/properties * for 3.X style projects. - * + * * @author vhirsl - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -98,12 +98,12 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr private static final String DISABLE = DISC_COMMON_PREFIX + ".discoveredGroup.buttons.disable.label"; //$NON-NLS-1$ private static final String ENABLE = DISC_COMMON_PREFIX + ".discoveredGroup.buttons.enable.label"; //$NON-NLS-1$ private static final String DELETE = DISC_COMMON_PREFIX + ".discoveredGroup.buttons.delete.label"; //$NON-NLS-1$ - + private static final String CONTAINER_LABEL = PREFIX + ".title"; //$NON-NLS-1$ private static final String CONTAINER_DESCRIPTION = PREFIX + ".description"; //$NON-NLS-1$ private static final String CONTAINER_LIST_LABEL = PREFIX + ".list.title"; //$NON-NLS-1$ private static final String CONTAINER_INITIALIZATION_ERROR = PREFIX +".initialization.error.message"; //$NON-NLS-1$ - + private final int IDX_UP = 0; private final int IDX_DOWN = 1; private final int IDX_ENABLE = 2; @@ -113,7 +113,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr private static final int DISC_UP = 0; private static final int DISC_DOWN = 1; - + private static final int DO_DISABLE = 0; private static final int DO_ENABLE = 1; @@ -127,7 +127,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr private CopyTextAction copyTextAction; private HandlerSubmission submission; - + public DiscoveredPathContainerPage() { super("DiscoveredScannerConfigurationContainerPage"); //$NON-NLS-1$ @@ -155,7 +155,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr dirty = false; deletedEntries = new ArrayList(); } - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#dispose() */ @@ -168,6 +168,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.ui.wizards.ICPathContainerPage#initialize(org.eclipse.cdt.core.model.ICProject, org.eclipse.cdt.core.model.IPathEntry[]) */ + @Override public void initialize(ICProject project, IPathEntry[] currentEntries) { fCProject = project; try { @@ -180,6 +181,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.ui.wizards.ICPathContainerPage#finish() */ + @Override public boolean finish() { if (!dirty) { return true; @@ -213,13 +215,13 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr } } } - + if (info instanceof IPerProjectDiscoveredPathInfo) { IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) info; - + LinkedHashMap includes = new LinkedHashMap(); LinkedHashMap symbols = new LinkedHashMap(); - + DiscoveredElement container = (DiscoveredElement) fDiscoveredContainerList.getElement(0); if (container != null && container.getEntryKind() == DiscoveredElement.CONTAINER) { Object[] cChildren = container.getChildren(); @@ -256,7 +258,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr projectPathInfo.setIncludeMap(includes); projectPathInfo.setSymbolMap(symbols); } - + try { // update scanner configuration List resourceDelta = new ArrayList(1); @@ -272,13 +274,15 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.ui.wizards.ICPathContainerPage#getContainerEntries() */ + @Override public IContainerEntry[] getNewContainers() { - return new IContainerEntry[] { fPathEntry }; + return new IContainerEntry[] { fPathEntry }; } /* (non-Javadoc) * @see org.eclipse.cdt.ui.wizards.ICPathContainerPage#setSelection(org.eclipse.cdt.core.model.IPathEntry) */ + @Override public void setSelection(IContainerEntry containerEntry) { if (containerEntry != null) { fPathEntry = containerEntry; @@ -312,22 +316,22 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr for (String include : includesKeySet) { Boolean removed = paths.get(include); removed = (removed == null) ? Boolean.FALSE : removed; - DiscoveredElement.createNew(container, fCProject.getProject(), include, + DiscoveredElement.createNew(container, fCProject.getProject(), include, DiscoveredElement.INCLUDE_PATH, removed.booleanValue(), false); } - // get defined symbols + // get defined symbols LinkedHashMap symbols = projectPathInfo.getSymbolMap(); Set symbolsKeySet = symbols.keySet(); for (String symbol : symbolsKeySet) { SymbolEntry se = symbols.get(symbol); List activeValues = se.getActiveRaw(); for (String value : activeValues) { - DiscoveredElement.createNew(container, fCProject.getProject(), value, + DiscoveredElement.createNew(container, fCProject.getProject(), value, DiscoveredElement.SYMBOL_DEFINITION, false, false); } List removedValues = se.getRemovedRaw(); for (String value : removedValues) { - DiscoveredElement.createNew(container, fCProject.getProject(), value, + DiscoveredElement.createNew(container, fCProject.getProject(), value, DiscoveredElement.SYMBOL_DEFINITION, true, false); } } @@ -338,7 +342,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr IPath[] includes = filePathInfo.getIncludePaths(); for (int i = 0; i < includes.length; i++) { String include = includes[i].toPortableString(); - DiscoveredElement.createNew(container, fCProject.getProject(), include, + DiscoveredElement.createNew(container, fCProject.getProject(), include, DiscoveredElement.INCLUDE_PATH, false, false); } // get defined symbols @@ -347,21 +351,21 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr for (String key : symbolsKeySet) { String value = symbols.get(key); String symbol = (value != null && value.length() > 0) ? key + "=" + value : key; //$NON-NLS-1$ - DiscoveredElement.createNew(container, fCProject.getProject(), symbol, + DiscoveredElement.createNew(container, fCProject.getProject(), symbol, DiscoveredElement.SYMBOL_DEFINITION, false, false); } // get include files IPath[] includeFiles = filePathInfo.getIncludeFiles(fCProject.getPath()); for (IPath incFile : includeFiles) { String includeFile = incFile.toPortableString(); - DiscoveredElement.createNew(container, fCProject.getProject(), includeFile, + DiscoveredElement.createNew(container, fCProject.getProject(), includeFile, DiscoveredElement.INCLUDE_FILE, false, false); } // get macros files IPath[] macrosFiles = filePathInfo.getMacroFiles(fCProject.getPath()); for (IPath macrosFilePath : macrosFiles) { String macrosFile = macrosFilePath.toPortableString(); - DiscoveredElement.createNew(container, fCProject.getProject(), macrosFile, + DiscoveredElement.createNew(container, fCProject.getProject(), macrosFile, DiscoveredElement.MACROS_FILE, false, false); } } @@ -374,6 +378,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { PixelConverter converter = new PixelConverter(parent); @@ -403,9 +408,9 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr }); setControl(composite); - + fDiscoveredContainerList.selectFirstElement(); - + // Create copy text action Shell shell = fDiscoveredContainerList.getTreeViewer().getControl().getShell(); copyTextAction = new CopyTextAction(shell); @@ -417,6 +422,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { + @Override public void menuAboutToShow(IMenuManager manager) { // if (copyTextAction.canBeApplied(fDiscoveredContainerList.getSelectedElements())) { manager.add(copyTextAction); @@ -429,10 +435,10 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr private void registerActionHandler(Shell shell, IAction action) { IWorkbench workbench = PlatformUI.getWorkbench(); - + IWorkbenchContextSupport contextSupport = workbench.getContextSupport(); IWorkbenchCommandSupport commandSupport = workbench.getCommandSupport(); - + submission = new HandlerSubmission(null, shell, null, CopyTextAction.ACTION_ID, new ActionHandler(action), Priority.MEDIUM); commandSupport.addHandlerSubmission(submission); @@ -441,10 +447,10 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr private void deregisterActionHandlers() { IWorkbench workbench = PlatformUI.getWorkbench(); - + IWorkbenchContextSupport contextSupport = workbench.getContextSupport(); IWorkbenchCommandSupport commandSupport = workbench.getCommandSupport(); - + commandSupport.removeHandlerSubmission(submission); contextSupport.unregisterShell(fDiscoveredContainerList.getTreeViewer().getControl().getShell()); } @@ -459,15 +465,17 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener#dialogFieldChanged(org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField) */ + @Override public void dialogFieldChanged(DialogField field) { // TODO Auto-generated method stub - + } // -------- IListAdapter -------- /* (non-Javadoc) * @see org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter#customButtonPressed(org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField, int) */ + @Override public void customButtonPressed(TreeListDialogField field, int index) { containerPageCustomButtonPressed(field, index); } @@ -475,6 +483,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter#selectionChanged(org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField) */ + @Override public void selectionChanged(TreeListDialogField field) { if (copyTextAction != null) { copyTextAction.canBeApplied(field.getSelectedElements()); @@ -485,6 +494,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter#doubleClicked(org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField) */ + @Override public void doubleClicked(TreeListDialogField field) { // TODO Auto-generated method stub @@ -493,6 +503,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter#keyPressed(org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField, org.eclipse.swt.events.KeyEvent) */ + @Override public void keyPressed(TreeListDialogField field, KeyEvent event) { // TODO Auto-generated method stub @@ -501,6 +512,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter#getChildren(org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField, java.lang.Object) */ + @Override public Object[] getChildren(TreeListDialogField field, Object element) { if (element instanceof DiscoveredElement) { DiscoveredElement elem = (DiscoveredElement) element; @@ -512,6 +524,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter#getParent(org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField, java.lang.Object) */ + @Override public Object getParent(TreeListDialogField field, Object element) { if (element instanceof DiscoveredElement) { DiscoveredElement elem = (DiscoveredElement) element; @@ -523,6 +536,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr /* (non-Javadoc) * @see org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter#hasChildren(org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField, java.lang.Object) */ + @Override public boolean hasChildren(TreeListDialogField field, Object element) { if (element instanceof DiscoveredElement) { DiscoveredElement elem = (DiscoveredElement) element; @@ -614,7 +628,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr fDiscoveredContainerList.postSetSelection(new StructuredSelection(selElements)); return rc; } - + private boolean enableDisableEntry(int action) { boolean rc = false; boolean remove = (action == DO_DISABLE); @@ -640,7 +654,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr DiscoveredElement elem = (DiscoveredElement) selElements.get(i); if (elem.getEntryKind() == DiscoveredElement.CONTAINER) { deletedEntries.add(elem); - + Object[] children = elem.getChildren(); for (int j = 0; j < children.length; j++) { if (children[j] instanceof DiscoveredElement) { @@ -739,7 +753,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr DiscoveredElement borderElem = null; int borderElementIndex = (direction == DISC_UP) ? 0 : parent.getChildren().length - 1; if (parent.getEntryKind() == DiscoveredElement.PATHS_GROUP) { - borderElem = (DiscoveredElement)(parent.getChildren())[borderElementIndex]; + borderElem = (parent.getChildren())[borderElementIndex]; } if (borderElem != null) { if (borderElem.equals(elem)) { @@ -779,7 +793,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr */ private boolean canDelete(List selElements) { if (info instanceof IPerFileDiscoveredPathInfo) { - if (selElements.size() > 0 && + if (selElements.size() > 0 && ((DiscoveredElement) selElements.get(0)).getEntryKind() == DiscoveredElement.CONTAINER) { return true; } @@ -790,10 +804,10 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr } return true; } - + /** * Support for text copy/paste - * + * * @author vhirsl */ public class CopyTextAction extends Action { @@ -835,7 +849,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr public void run() { if (discoveredEntry != null) { // copy to clipboard - clipboard.setContents(new Object[] {discoveredEntry}, + clipboard.setContents(new Object[] {discoveredEntry}, new Transfer[] {TextTransfer.getInstance()}); discoveredEntry = null; } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java index 7732acf00a9..8d73dda3d95 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerFileSCDProfilePage.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation *******************************************************************************/ @@ -40,9 +40,9 @@ import org.eclipse.swt.widgets.Text; /** * SCD per project profile property/preference page - * + * * @author vhirsl - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -61,7 +61,8 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ - public void createControl(Composite parent) { + @Override + public void createControl(Composite parent) { Composite page = ControlFactory.createComposite(parent, 1); // ((GridData) page.getLayoutData()).grabExcessVerticalSpace = true; // ((GridData) page.getLayoutData()).verticalAlignment = GridData.FILL; @@ -69,7 +70,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { // Add the profile UI contribution. Group profileGroup = ControlFactory.createGroup(page, MakeUIPlugin.getResourceString("ScannerConfigOptionsDialog.profile.group.label"), 3); //$NON-NLS-1$ - + GridData gd = (GridData) profileGroup.getLayoutData(); gd.grabExcessHorizontalSpace = true; // PixelConverter converter = new PixelConverter(profileGroup); @@ -82,14 +83,14 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { ((GridData)bopEnabledButton.getLayoutData()).horizontalSpan = 3; ((GridData)bopEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true; bopEnabledButton.addSelectionListener(new SelectionAdapter() { - + @Override public void widgetSelected(SelectionEvent e) { handleModifyOpenFileText(); } - + }); - + // load label Label loadLabel = ControlFactory.createLabel(profileGroup, L_OPEN); ((GridData) loadLabel.getLayoutData()).horizontalSpan = 2; @@ -98,7 +99,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { bopLoadButton = ControlFactory.createPushButton(profileGroup, B_LOAD); ((GridData) bopLoadButton.getLayoutData()).minimumWidth = 120; bopLoadButton.addSelectionListener(new SelectionAdapter() { - + @Override public void widgetSelected(SelectionEvent event) { handleBOPLoadFileButtonSelected(); @@ -108,19 +109,20 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { if (getContainer().getProject() == null) { // project properties bopLoadButton.setVisible(false); } - + // text field bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER); bopOpenFileText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { + @Override + public void modifyText(ModifyEvent e) { handleModifyOpenFileText(); } }); bopLoadButton.setEnabled(loadButtonInitialEnabled && handleModifyOpenFileText()); - + // browse button Button browseButton = ControlFactory.createPushButton(profileGroup, B_BROWSE); - ((GridData) browseButton.getLayoutData()).minimumWidth = 120; + ((GridData) browseButton.getLayoutData()).minimumWidth = 120; browseButton.addSelectionListener(new SelectionAdapter() { @Override @@ -151,7 +153,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { // variable button addVariablesButton(profileGroup, bopOpenFileText); - + setControl(page); // set the shell variable; must be after setControl //lock.acquire(); @@ -186,7 +188,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { } return fileName; } - + private void setBopOpenFileText(String fileName) { // from absolute path to project relative path if (fileName.length() > 0) { @@ -204,7 +206,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { } bopOpenFileText.setText(fileName); } - + private void initializeValues() { bopEnabledButton.setSelection(getContainer().getBuildInfo().isBuildOutputParserEnabled()); setBopOpenFileText(getContainer().getBuildInfo().getBuildOutputFilePath()); @@ -214,22 +216,23 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { if (!getContainer().checkDialogForChanges()) return; loadButtonInitialEnabled = false; bopLoadButton.setEnabled(false); - + // populate buildInfo to be used by the reader job populateBuildInfo(getContainer().getBuildInfo()); IProject project = getContainer().getProject(); Job readerJob = new BuildOutputReaderJob(project, getContainer().getBuildInfo()); readerJob.setPriority(Job.LONG); readerJob.addJobChangeListener(new JobChangeAdapter() { - + @Override public void done(IJobChangeEvent event) { //lock.acquire(); synchronized (lock) { if (!instance.shell.isDisposed()) { instance.shell.getDisplay().asyncExec(new Runnable() { - - public void run() { + + @Override + public void run() { if (!instance.shell.isDisposed()) { loadButtonInitialEnabled = instance.bopEnabledButton.getSelection() && handleModifyOpenFileText(); instance.bopLoadButton.setEnabled(loadButtonInitialEnabled); @@ -238,7 +241,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { loadButtonInitialEnabled = true; } } - + }); } else { @@ -247,7 +250,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { } //lock.release(); } - + }); readerJob.schedule(); } @@ -283,14 +286,14 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage { bopEnabledButton.setSelection(buildInfo.isBuildOutputParserEnabled()); } } - + private String getProviderIDForSelectedProfile() { IScannerConfigBuilderInfo2 builderInfo = getContainer().getBuildInfo(); // Provider IDs for selected profile - List providerIDs = builderInfo.getProviderIdList(); + List providerIDs = builderInfo.getProviderIdList(); if(providerIDs.size() == 0) return ""; //$NON-NLS-1$ - return providerIDs.iterator().next(); + return providerIDs.iterator().next(); } } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java index 24f985c5d97..daa29524948 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/GCCPerProjectSCDProfilePage.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation *******************************************************************************/ @@ -40,19 +40,19 @@ import org.eclipse.swt.widgets.Text; /** * SCD per project profile property/preference page - * + * * @author vhirsl - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { - + private static Object lock = GCCPerProjectSCDProfilePage.class; private Shell shell; private static GCCPerProjectSCDProfilePage instance; private static boolean loadButtonInitialEnabled = true; - + private Button bopEnabledButton; private Text bopOpenFileText; private Button bopLoadButton; @@ -60,13 +60,13 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { private Text sipRunCommandText; private Text sipRunArgsText; private Button sipConsoleEnabledButton; - + private boolean isValid = true; /** * Static variable corresponding to global preference to show scanner * discovery console. - * + * * @since 7.1 */ public static boolean isSIConsoleEnabled = false; @@ -74,20 +74,21 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { /* (non-Javadoc) * @see org.eclipse.cdt.ui.dialogs.AbstractCOptionPage#createControl(org.eclipse.swt.widgets.Composite) */ - public void createControl(Composite parent) { + @Override + public void createControl(Composite parent) { Composite page = ControlFactory.createComposite(parent, 1); // ((GridData) page.getLayoutData()).grabExcessVerticalSpace = true; // ((GridData) page.getLayoutData()).verticalAlignment = GridData.FILL; - + // Add the profile UI contribution. Group profileGroup = ControlFactory.createGroup(page, MakeUIPlugin.getResourceString("ScannerConfigOptionsDialog.profile.group.label"), 3); //$NON-NLS-1$ - + GridData gd = (GridData) profileGroup.getLayoutData(); gd.grabExcessHorizontalSpace = true; gd.horizontalAlignment = GridData.FILL; ((GridLayout) profileGroup.getLayout()).makeColumnsEqualWidth = false; - + // Add bop enabled checkbox bopEnabledButton = ControlFactory.createCheckBox(profileGroup, B_ENABLE); ((GridData)bopEnabledButton.getLayoutData()).horizontalSpan = 3; @@ -98,7 +99,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { handleModifyOpenFileText(); } }); - + // load label Label loadLabel = ControlFactory.createLabel(profileGroup, L_OPEN); ((GridData) loadLabel.getLayoutData()).horizontalSpan = 2; @@ -115,16 +116,17 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { if (getContainer().getProject() == null) { // project properties bopLoadButton.setVisible(false); } - + // text field bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER); bopOpenFileText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { + @Override + public void modifyText(ModifyEvent e) { handleModifyOpenFileText(); } }); bopLoadButton.setEnabled(loadButtonInitialEnabled && handleModifyOpenFileText()); - + // browse button Button browseButton = ControlFactory.createPushButton(profileGroup, B_BROWSE); ((GridData) browseButton.getLayoutData()).minimumWidth = 120; @@ -159,7 +161,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { // variable button addVariablesButton(profileGroup, bopOpenFileText); ControlFactory.createSeparator(profileGroup, 3); - + // si provider enabled checkbox sipEnabledButton = ControlFactory.createCheckBox(profileGroup, SI_ENABLE); ((GridData)sipEnabledButton.getLayoutData()).horizontalSpan = 3; @@ -170,7 +172,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { handleSIPEnabledButtonSelected(); } }); - + // si command label Label siCommandLabel = ControlFactory.createLabel(profileGroup, SI_COMMAND); ((GridData) siCommandLabel.getLayoutData()).horizontalSpan = 3; @@ -178,11 +180,12 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { // text field sipRunCommandText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER); sipRunCommandText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { + @Override + public void modifyText(ModifyEvent e) { handleModifyRunCommandText(); } }); - + // si browse button Button siBrowseButton = ControlFactory.createPushButton(profileGroup, SI_BROWSE); ((GridData) siBrowseButton.getLayoutData()).minimumWidth = 120; @@ -217,11 +220,12 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { sipRunArgsText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER); ((GridData) sipRunArgsText.getLayoutData()).horizontalSpan = 3; sipRunArgsText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { + @Override + public void modifyText(ModifyEvent e) { handleModifyRunArgsText(); } }); - + // si provider console enabled checkbox String sipConsoleEnabledLabel = MakeUIPlugin.getResourceString("ScannerConfigOptionsDialog.siProvider.show.console.label"); //$NON-NLS-1$ sipConsoleEnabledButton = ControlFactory.createCheckBox(profileGroup, sipConsoleEnabledLabel); @@ -266,7 +270,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { protected void handleModifyRunArgsText() { getContainer().updateContainer(); } - + /** * @since 7.0 */ @@ -274,7 +278,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { sipRunCommandText.setEnabled(sipEnabledButton.getSelection()); sipRunArgsText.setEnabled(sipEnabledButton.getSelection()); } - + private String getBopOpenFileText() { // from project relative path to absolute path String fileName = bopOpenFileText.getText().trim(); @@ -290,7 +294,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { } return fileName; } - + private void setBopOpenFileText(String fileName) { // from absolute path to project relative path if (fileName.length() > 0) { @@ -308,11 +312,11 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { } bopOpenFileText.setText(fileName); } - + private void initializeValues() { IScannerConfigBuilderInfo2 builderInfo = getContainer().getBuildInfo(); - String providerId = getProviderIDForSelectedProfile(); - + String providerId = getProviderIDForSelectedProfile(); + bopEnabledButton.setSelection(builderInfo.isBuildOutputParserEnabled()); setBopOpenFileText(builderInfo.getBuildOutputFilePath()); sipEnabledButton.setSelection(builderInfo.isProviderOutputParserEnabled(providerId)); @@ -320,35 +324,36 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { sipRunArgsText.setText(builderInfo.getProviderRunArguments(providerId)); sipConsoleEnabledButton.setSelection(isSIConsoleEnabled); } - + private String getProviderIDForSelectedProfile() { IScannerConfigBuilderInfo2 builderInfo = getContainer().getBuildInfo(); // Provider IDs for selected profile - List providerIDs = builderInfo.getProviderIdList(); + List providerIDs = builderInfo.getProviderIdList(); if(providerIDs.size() == 0) return ""; //$NON-NLS-1$ - return providerIDs.iterator().next(); + return providerIDs.iterator().next(); } private void handleBOPLoadFileButtonSelected() { if (!getContainer().checkDialogForChanges()) return; loadButtonInitialEnabled = false; bopLoadButton.setEnabled(false); - + // populate buildInfo to be used by the reader job populateBuildInfo(getContainer().getBuildInfo()); IProject project = getContainer().getProject(); Job readerJob = new BuildOutputReaderJob(project, getContainer().getBuildInfo()); readerJob.setPriority(Job.LONG); readerJob.addJobChangeListener(new JobChangeAdapter() { - + @Override public void done(IJobChangeEvent event) { synchronized (lock) { if (!instance.shell.isDisposed()) { instance.shell.getDisplay().asyncExec(new Runnable() { - - public void run() { + + @Override + public void run() { if (!instance.shell.isDisposed()) { loadButtonInitialEnabled = instance.bopEnabledButton.getSelection() && handleModifyOpenFileText(); instance.bopLoadButton.setEnabled(loadButtonInitialEnabled); @@ -357,7 +362,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { loadButtonInitialEnabled = true; } } - + }); } else { @@ -365,7 +370,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { } } } - + }); readerJob.schedule(); } @@ -377,7 +382,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { public boolean isValid() { return isValid; } - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage() */ @@ -385,7 +390,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage { public String getErrorMessage() { return (isValid) ? null : SI_ERROR; } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#populateBuildInfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2) */ diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MBSPerProjectSCDProfilePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MBSPerProjectSCDProfilePage.java index 418528430ef..b64329a648c 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MBSPerProjectSCDProfilePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MBSPerProjectSCDProfilePage.java @@ -31,15 +31,15 @@ import org.eclipse.swt.widgets.Text; /** * SCD per project profile property/preference page - * + * * @author vhirsl - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ public class MBSPerProjectSCDProfilePage extends AbstractDiscoveryPage { private static final String providerId = "specsFile"; //$NON-NLS-1$ - + private Button sipEnabledButton; private Text sipRunCommandText; private boolean isValid = true; @@ -47,28 +47,29 @@ public class MBSPerProjectSCDProfilePage extends AbstractDiscoveryPage { /* (non-Javadoc) * @see org.eclipse.cdt.ui.dialogs.AbstractCOptionPage#createControl(org.eclipse.swt.widgets.Composite) */ - public void createControl(Composite parent) { + @Override + public void createControl(Composite parent) { Composite page = ControlFactory.createComposite(parent, 1); - + // Add the profile UI contribution. Group profileGroup = ControlFactory.createGroup(page, MakeUIPlugin.getResourceString("ScannerConfigOptionsDialog.profile.group.label"), 3); //$NON-NLS-1$ - + GridData gd = (GridData) profileGroup.getLayoutData(); gd.grabExcessHorizontalSpace = true; gd.horizontalAlignment = GridData.FILL; ((GridLayout) profileGroup.getLayout()).makeColumnsEqualWidth = false; - + // si provider enabled checkbox sipEnabledButton = ControlFactory.createCheckBox(profileGroup, SI_ENABLE); ((GridData)sipEnabledButton.getLayoutData()).horizontalSpan = 3; ((GridData)sipEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true; sipEnabledButton.addSelectionListener(new SelectionAdapter() { @Override - public void widgetSelected(SelectionEvent e) { + public void widgetSelected(SelectionEvent e) { } }); - + // si command label Label siCommandLabel = ControlFactory.createLabel(profileGroup, SI_COMMAND); ((GridData) siCommandLabel.getLayoutData()).horizontalSpan = 3; @@ -77,11 +78,12 @@ public class MBSPerProjectSCDProfilePage extends AbstractDiscoveryPage { sipRunCommandText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER); //((GridData) sipRunCommandText.getLayoutData()).horizontalSpan = 2; sipRunCommandText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { + @Override + public void modifyText(ModifyEvent e) { handleModifyRunCommandText(); } }); - + // si browse button Button siBrowseButton = ControlFactory.createPushButton(profileGroup, SI_BROWSE); ((GridData) siBrowseButton.getLayoutData()).minimumWidth = 120; @@ -129,7 +131,7 @@ public class MBSPerProjectSCDProfilePage extends AbstractDiscoveryPage { public boolean isValid() { return isValid; } - + /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#getErrorMessage() */ @@ -137,7 +139,7 @@ public class MBSPerProjectSCDProfilePage extends AbstractDiscoveryPage { public String getErrorMessage() { return (isValid) ? null : SI_ERROR; } - + /* (non-Javadoc) * @see org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage#populateBuildInfo(org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2) */ diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java index 01053fa3186..a28a8724af5 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/MakeTargetDialog.java @@ -123,6 +123,7 @@ public class MakeTargetDialog extends Dialog { } } + @Override public void handleEvent(Event e) { setStatusLine(); updateButtons(); @@ -339,6 +340,7 @@ public class MakeTargetDialog extends Dialog { /* Add a listener to the target name text to update the targetText */ targetNameText.addModifyListener(new ModifyListener() { + @Override public void modifyText(ModifyEvent e) { if (sameAsNameCheckBox.getSelection()) { targetText.setText(targetNameText.getText()); @@ -354,6 +356,7 @@ public class MakeTargetDialog extends Dialog { ((GridData) (targetText.getLayoutData())).grabExcessHorizontalSpace = true; targetText.setText(targetString); targetText.addListener(SWT.Modify, new Listener() { + @Override public void handleEvent(Event e) { updateButtons(); } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java index adb3a12fd5c..9886c9ccf7b 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/SettingsBlock.java @@ -55,7 +55,7 @@ import org.eclipse.ui.dialogs.ContainerSelectionDialog; /** * @deprecated as of CDT 4.0. This tab was used to set preferences/properties * for 3.X style projects. - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -82,7 +82,7 @@ public class SettingsBlock extends AbstractCOptionPage { private static final String MAKE_WORKBENCH_BUILD_CLEAN = PREFIX + ".makeWorkbench.clean"; //$NON-NLS-1$ private static final String MAKE_BUILD_DIR_GROUP = PREFIX + ".makeLoc.group_label"; //$NON-NLS-1$ - private static final String MAKE_BUILD_DIR_LABEL = PREFIX + ".makeDir.label"; //$NON-NLS-1$ + private static final String MAKE_BUILD_DIR_LABEL = PREFIX + ".makeDir.label"; //$NON-NLS-1$ private static final String MAKE_BUILD_DIR_BROWSE_FILESYSTEM = PREFIX + ".makeDir.browseFilesystem"; //$NON-NLS-1$ private static final String MAKE_BUILD_DIR_BROWSE_WORKSPACE = PREFIX + ".makeDir.browseWorkspace"; //$NON-NLS-1$ @@ -110,7 +110,7 @@ public class SettingsBlock extends AbstractCOptionPage { Button incrVariableButton; Button autoVariableButton; Button cleanVariableButton; - + IMakeBuilderInfo fBuildInfo; Preferences fPrefs; String fBuilderID; @@ -169,6 +169,7 @@ public class SettingsBlock extends AbstractCOptionPage { ((GridData) (buildCommand.getLayoutData())).grabExcessHorizontalSpace = true; buildCommand.addListener(SWT.Modify, new Listener() { + @Override public void handleEvent(Event e) { getContainer().updateContainer(); } @@ -176,7 +177,7 @@ public class SettingsBlock extends AbstractCOptionPage { if (fBuildInfo.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, null) != null) { StringBuffer cmd = new StringBuffer(fBuildInfo.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "")); //$NON-NLS-1$ if (!fBuildInfo.isDefaultBuildCmd()) { - String args = fBuildInfo.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, ""); //$NON-NLS-1$ + String args = fBuildInfo.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, ""); //$NON-NLS-1$ if (args != null && !args.equals("")) { //$NON-NLS-1$ cmd.append(" "); //$NON-NLS-1$ cmd.append(args); @@ -184,7 +185,7 @@ public class SettingsBlock extends AbstractCOptionPage { } buildCommand.setText(cmd.toString()); } - argumentVariablesButton = addVariablesButton(group, buildCommand); + argumentVariablesButton = addVariablesButton(group, buildCommand); if (fBuildInfo.isDefaultBuildCmd()) { buildCommand.setEnabled(false); argumentVariablesButton.setEnabled(false); @@ -265,7 +266,7 @@ public class SettingsBlock extends AbstractCOptionPage { /* * (non-Javadoc) - * + * * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override @@ -293,6 +294,7 @@ public class SettingsBlock extends AbstractCOptionPage { final IPropertyChangeListener fontListener = new IPropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent event) { if (JFaceResources.BANNER_FONT.equals(event.getProperty())) { noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT)); @@ -302,6 +304,7 @@ public class SettingsBlock extends AbstractCOptionPage { JFaceResources.getFontRegistry().addListener(fontListener); noteLabel.addDisposeListener(new DisposeListener() { + @Override public void widgetDisposed(DisposeEvent event) { JFaceResources.getFontRegistry().removeListener(fontListener); } @@ -341,6 +344,7 @@ public class SettingsBlock extends AbstractCOptionPage { ((GridData) (buildLocation.getLayoutData())).grabExcessHorizontalSpace = true; buildLocation.addListener(SWT.Modify, new Listener() { + @Override public void handleEvent(Event e) { getContainer().updateContainer(); } @@ -353,10 +357,10 @@ public class SettingsBlock extends AbstractCOptionPage { GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; buttons.setLayoutData(gd); - + Label emptyLabel = ControlFactory.createLabel(buttons, ""); //$NON-NLS-1$ emptyLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + Button browseWorkspace = new Button(buttons, SWT.NONE); browseWorkspace.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE_WORKSPACE)); browseWorkspace.addSelectionListener(new SelectionAdapter() { @@ -462,6 +466,7 @@ public class SettingsBlock extends AbstractCOptionPage { // To avoid multi-build IWorkspaceRunnable operation = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { monitor.beginTask(MakeUIPlugin.getResourceString("SettingsBlock.monitor.applyingSettings"), 1); //$NON-NLS-1$ IMakeBuilderInfo info = null; @@ -556,9 +561,9 @@ public class SettingsBlock extends AbstractCOptionPage { argumentVariablesButton.setEnabled(true); stopOnErrorButton.setEnabled(false); } - + defButton.setSelection(info.isDefaultBuildCmd()); - + autoButton.setSelection(info.isAutoBuildEnable()); autoVariableButton.setEnabled(info.isAutoBuildEnable()); targetAuto.setEnabled(info.isAutoBuildEnable()); diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/FilterEmtpyFoldersAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/FilterEmtpyFoldersAction.java index d6fc6d5d847..325682c4147 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/FilterEmtpyFoldersAction.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/FilterEmtpyFoldersAction.java @@ -69,8 +69,9 @@ public class FilterEmtpyFoldersAction extends Action { final boolean [] haveTargets = new boolean[1]; haveTargets[0] = false; - + IResourceProxyVisitor visitor = new IResourceProxyVisitor() { + @Override public boolean visit(IResourceProxy proxy) throws CoreException { if(haveTargets[0]) { return false; //We found what we were looking for diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java index a043f073dcb..8c0e5df196b 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java @@ -66,7 +66,7 @@ import org.eclipse.ui.part.ViewPart; /** * Implementation of Make Target View. - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -119,12 +119,14 @@ public class MakeView extends ViewPart { fViewer.addDoubleClickListener(new IDoubleClickListener() { + @Override public void doubleClick(DoubleClickEvent event) { handleDoubleClick(event); } }); fViewer.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { handleSelectionChanged(event); } @@ -147,9 +149,9 @@ public class MakeView extends ViewPart { makeActions(); hookContextMenu(); contributeToActionBars(); - + updateActions((IStructuredSelection)fViewer.getSelection()); - + bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class); if (bindingService != null) { bindingService.addBindingManagerListener(bindingManagerListener); @@ -223,7 +225,7 @@ public class MakeView extends ViewPart { textActionHandler.setCopyAction(copyTargetAction); textActionHandler.setPasteAction(pasteTargetAction); textActionHandler.setDeleteAction(deleteTargetAction); - + actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), editTargetAction); } @@ -244,6 +246,7 @@ public class MakeView extends ViewPart { menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { + @Override public void menuAboutToShow(IMenuManager manager) { MakeView.this.fillContextMenu(manager); updateActions((IStructuredSelection)fViewer.getSelection()); @@ -299,41 +302,42 @@ public class MakeView extends ViewPart { clipboard.dispose(); clipboard = null; } - + if (bindingService != null) { bindingService.removeBindingManagerListener(bindingManagerListener); bindingService = null; } - + super.dispose(); } private IBindingManagerListener bindingManagerListener = new IBindingManagerListener() { + @Override public void bindingManagerChanged(BindingManagerEvent event) { - + if (event.isActiveBindingsChanged()) { String keyBinding = bindingService.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.FILE_RENAME); if (keyBinding != null) editTargetAction.setText( MakeUIPlugin.getResourceString("EditTargetAction.label")+"\t"+ keyBinding); //$NON-NLS-1$ //$NON-NLS-2$ - + keyBinding = bindingService.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.EDIT_COPY); if (keyBinding != null) copyTargetAction.setText( MakeUIPlugin.getResourceString("CopyTargetAction.label")+"\t"+ keyBinding); //$NON-NLS-1$ //$NON-NLS-2$ - + keyBinding = bindingService.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.EDIT_PASTE); if (keyBinding != null) pasteTargetAction.setText( MakeUIPlugin.getResourceString("PasteTargetAction.label")+"\t"+ keyBinding); //$NON-NLS-1$ //$NON-NLS-2$ - + keyBinding = bindingService.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.EDIT_DELETE); if (keyBinding != null) deleteTargetAction.setText( MakeUIPlugin.getResourceString("DeleteTargetAction.label")+"\t"+ keyBinding); //$NON-NLS-1$ //$NON-NLS-2$ - + keyBinding = bindingService.getBestActiveBindingFormattedFor(TARGET_BUILD_LAST_COMMAND); if (keyBinding != null) buildLastTargetAction.setText( MakeUIPlugin.getResourceString("BuildLastTargetAction.label")+"\t"+ keyBinding); //$NON-NLS-1$ //$NON-NLS-2$ } } }; - + } diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizardPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizardPage.java index 6bacf5cb123..567089d0b9f 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizardPage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/UpdateMakeProjectWizardPage.java @@ -41,13 +41,16 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage { private TablePart tablePart; public class MakeProjectContentProvider implements IStructuredContentProvider { + @Override public Object[] getElements(Object parent) { return UpdateMakeProjectAction.getOldProjects(); } + @Override public void dispose() { } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } } @@ -81,6 +84,7 @@ public class UpdateMakeProjectWizardPage extends StatusWizardPage { super.dispose(); } + @Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/AbstractBuilderTest.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/AbstractBuilderTest.java index 759109984c9..722fb5d7629 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/AbstractBuilderTest.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/AbstractBuilderTest.java @@ -95,6 +95,7 @@ public abstract class AbstractBuilderTest extends TestCase { try { // batch changes IWorkspaceRunnable body = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { getWorkspace().build(configs, kind, true, monitor); } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/BuildSystemTestHelper.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/BuildSystemTestHelper.java index 28df9d1f5ce..06bcd4b69ca 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/BuildSystemTestHelper.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/BuildSystemTestHelper.java @@ -40,36 +40,36 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; public class BuildSystemTestHelper { - + static public IProject createProject(String name, IPath location, String projTypeId) throws CoreException { IProject project = createProject(name, location); return createDescription(project, projTypeId); } - + static public IProject createDescription(IProject project, String projTypeId) throws CoreException { CoreModel coreModel = CoreModel.getDefault(); ICProjectDescription des = coreModel.getProjectDescription(project); Assert.assertNull("detDescription1 returned not null!", des); - + des = coreModel.createProjectDescription(project, true); Assert.assertNotNull("createDescription returned null!", des); - + Assert.assertNull("detDescription2 returned not null!", coreModel.getProjectDescription(project)); - + Assert.assertFalse("new des should be not valid", des.isValid()); - + Assert.assertEquals(0, des.getConfigurations().length); - + ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); IProjectType type = ManagedBuildManager.getProjectType(projTypeId); Assert.assertNotNull("project type not found", type); ManagedProject mProj = new ManagedProject(project, type); info.setManagedProject(mProj); - + IConfiguration cfgs[] = type.getConfigurations(); - + for(int i = 0; i < cfgs.length; i++){ String id = ManagedBuildManager.calculateChildId(cfgs[i].getId(), null); Configuration config = new Configuration(mProj, (Configuration)cfgs[i], id, false, true, false); @@ -80,19 +80,19 @@ public class BuildSystemTestHelper { coreModel.setProjectDescription(project, des); return project; } - + static public IProject createProject(String name) throws CoreException{ return createProject(name, (IPath)null); } - + static public IProject createProject( - final String name, + final String name, final IPath location) throws CoreException{ IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); final IProject newProjectHandle = root.getProject(name); IProject project = null; - + if (!newProjectHandle.exists()) { IWorkspaceDescription workspaceDesc = workspace.getDescription(); workspaceDesc.setAutoBuilding(false); @@ -104,6 +104,7 @@ public class BuildSystemTestHelper { project = CCorePlugin.getDefault().createCDTProject(description, newProjectHandle, new NullProgressMonitor()); } else { IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -112,15 +113,15 @@ public class BuildSystemTestHelper { workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor); project = newProjectHandle; } - + // Open the project if we have to if (!project.isOpen()) { project.open(new NullProgressMonitor()); } - - return project; + + return project; } - + static public void checkDiff(Object[] arr1, Object[] arr2){ LinkedHashSet set1 = new LinkedHashSet(Arrays.asList(arr1)); LinkedHashSet set2 = new LinkedHashSet(Arrays.asList(arr2)); @@ -130,13 +131,13 @@ public class BuildSystemTestHelper { String set1String = collectionToString(set1); String set2String = collectionToString(set2); - String diffMsg = "array1 entries: " + set1String + ",\n array2 entries: " + set2String + "\n"; + String diffMsg = "array1 entries: " + set1String + ",\n array2 entries: " + set2String + "\n"; Assert.assertEquals("arrays have different size\n" + diffMsg, arr1.length, arr2.length); Assert.assertEquals("arrays have different contents\n" + diffMsg, 0, set1.size()); Assert.assertEquals("arrays have different contents\n" + diffMsg, 0, set2.size()); - + if(!Arrays.equals(arr1, arr2)){ - Assert.fail("different element order, dumping..\n array1 entries: " + arrayToString(arr1) + "\n array2 entries: " + arrayToString(arr2) + "\n"); + Assert.fail("different element order, dumping..\n array1 entries: " + arrayToString(arr1) + "\n array2 entries: " + arrayToString(arr2) + "\n"); } } @@ -150,7 +151,7 @@ public class BuildSystemTestHelper { for(int i = 0; i < arr.length; i++) { if(i != 0) buf.append(", "); - + buf.append(arr[i].toString()); } buf.append(']'); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java index f7dca9a39f8..b2259c60509 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ManagedBuildTestHelper.java @@ -79,24 +79,24 @@ public class ManagedBuildTestHelper { private static final String rcbsToolOutputTypeId = new String("org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype"); //$NON-NLS-1$ private static final String rcbsToolOutputTypeName = new String("Resource Custom Build Step Output Type"); //$NON-NLS-1$ - + /* (non-Javadoc) - * Create a new project named name or return the project in + * Create a new project named name or return the project in * the workspace of the same name if it exists. - * + * * @param name The name of the project to create or retrieve. - * @return + * @return * @throws CoreException */ static public IProject createProject( - final String name, - final IPath location, - final String projectId, + final String name, + final IPath location, + final String projectId, final String projectTypeId) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IProject newProjectHandle = root.getProject(name); IProject project = null; - + if (!newProjectHandle.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); if (projectId.equals(ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID)) { @@ -113,6 +113,7 @@ public class ManagedBuildTestHelper { } else { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -121,15 +122,15 @@ public class ManagedBuildTestHelper { workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor); project = newProjectHandle; } - + // Open the project if we have to if (!project.isOpen()) { project.open(new NullProgressMonitor()); - // CDT opens the Project with BACKGROUND_REFRESH enabled which causes the + // CDT opens the Project with BACKGROUND_REFRESH enabled which causes the // refresh manager to refresh the project 200ms later. This Job interferes // with the resource change handler firing see: bug 271264 try { - // CDT opens the Project with BACKGROUND_REFRESH enabled which causes the + // CDT opens the Project with BACKGROUND_REFRESH enabled which causes the // refresh manager to refresh the project 200ms later. This Job interferes // with the resource change handler firing see: bug 271264 Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null); @@ -137,24 +138,24 @@ public class ManagedBuildTestHelper { // Ignore } } - - return project; + + return project; } - + static public IProject createProject( - final String name, + final String name, final String projectTypeId) { try { - return createProject(name, - null, - ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID, + return createProject(name, + null, + ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID, projectTypeId); } catch (CoreException e) { TestCase.fail(e.getLocalizedMessage()); } return null; } - + static public IFile createFile(IProject project, String name){ return createFile(project, name, new ByteArrayInputStream(new byte[0])); } @@ -174,7 +175,7 @@ public class ManagedBuildTestHelper { rc.create(true, true, null); } } - + // file.create( new ByteArrayInputStream( "#include \n extern void bar(); \n int main() { \nprintf(\"Hello, World!!\"); \n bar();\n return 0; }".getBytes() ), false, null ); file.create(contents, false, null ); } catch (CoreException e) { @@ -195,7 +196,7 @@ public class ManagedBuildTestHelper { rc.create(true, true, null); } } - + // file.create( new ByteArrayInputStream( "#include \n extern void bar(); \n int main() { \nprintf(\"Hello, World!!\"); \n bar();\n return 0; }".getBytes() ), false, null ); folder.create(true , false, null ); } catch (CoreException e) { @@ -206,9 +207,9 @@ public class ManagedBuildTestHelper { } /** - * Remove the IProject with the name specified in the argument from the + * Remove the IProject with the name specified in the argument from the * receiver's workspace. - * + * * @param name */ static public void removeProject(String name) { @@ -217,6 +218,7 @@ public class ManagedBuildTestHelper { if (project.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { System.gc(); System.runFinalization(); @@ -276,7 +278,7 @@ public class ManagedBuildTestHelper { static public IProject createProject(String projectName, File importFrom, IPath location, String projectTypeId) throws CoreException, InvocationTargetException, IOException { IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); IProject project= root.getProject(projectName); - if (project.exists()) + if (project.exists()) removeProject(projectName); IPath destPath = (location != null) ? @@ -296,6 +298,7 @@ public class ManagedBuildTestHelper { try { ImportOperation op= new ImportOperation(destPath, importRoot, importStructure, new IOverwriteQuery() { + @Override public String queryOverwrite(String file) { return ALL; } @@ -311,15 +314,16 @@ public class ManagedBuildTestHelper { return createProject(projectName, location, ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID, projectTypeId); } - static public IProject createNewManagedProject(IProject newProjectHandle, - final String name, - final IPath location, - final String projectId, + static public IProject createNewManagedProject(IProject newProjectHandle, + final String name, + final IPath location, + final String projectId, final String projectTypeId) throws CoreException { final IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); final IProject project = newProjectHandle; IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { // Create the base project IWorkspaceDescription workspaceDesc = workspace.getDescription(); @@ -332,11 +336,11 @@ public class ManagedBuildTestHelper { CCorePlugin.getDefault().createCProject(description, project, new NullProgressMonitor(), projectId); // Add the managed build nature and builder addManagedBuildNature(project); - + // Find the base project type definition IProjectType projType = ManagedBuildManager.getProjectType(projectTypeId); Assert.assertNotNull(projType); - + // Create the managed-project (.cdtbuild) for our project that builds an executable. IManagedProject newProject = null; try { @@ -352,7 +356,7 @@ public class ManagedBuildTestHelper { IConfiguration defaultConfig = null; IConfiguration[] configs = projType.getConfigurations(); for (int i = 0; i < configs.length; ++i) { - // Make the first configuration the default + // Make the first configuration the default if (i == 0) { defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i); } else { @@ -360,12 +364,12 @@ public class ManagedBuildTestHelper { } } ManagedBuildManager.setDefaultConfiguration(project, defaultConfig); - + IConfiguration cfgs[] = newProject.getConfigurations(); for(int i = 0; i < cfgs.length; i++){ cfgs[i].setArtifactName(newProject.getDefaultArtifactName()); } - + ManagedBuildManager.getBuildInfo(project).setValid(true); } }; @@ -375,11 +379,11 @@ public class ManagedBuildTestHelper { } catch (CoreException e2) { Assert.fail(e2.getLocalizedMessage()); } - // CDT opens the Project with BACKGROUND_REFRESH enabled which causes the + // CDT opens the Project with BACKGROUND_REFRESH enabled which causes the // refresh manager to refresh the project 200ms later. This Job interferes // with the resource change handler firing see: bug 271264 try { - // CDT opens the Project with BACKGROUND_REFRESH enabled which causes the + // CDT opens the Project with BACKGROUND_REFRESH enabled which causes the // refresh manager to refresh the project 200ms later. This Job interferes // with the resource change handler firing see: bug 271264 Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null); @@ -400,7 +404,7 @@ public class ManagedBuildTestHelper { IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); Assert.assertNotNull(info); // info.setValid(true); - + // Add the managed build nature try { ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor()); @@ -424,10 +428,11 @@ public class ManagedBuildTestHelper { } catch (CoreException e) { Assert.fail("Test failed on saving the ICDescriptor data: " + e.getLocalizedMessage()); } } - + static public boolean compareBenchmarks(final IProject project, IPath testLocationBase, IPath[] files, IPath benchmarkLocationBase) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { project.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -462,7 +467,7 @@ public class ManagedBuildTestHelper { buffer.append("but was:\n "); buffer.append("\"").append(testBuffer).append("\""); buffer.append("\n\n "); - + buffer.append(">>>>>>>>>>>>>>>start diff: \n"); String location1 = benchmarkFileLocation.isAbsolute() ? benchmarkFileLocation.toString() @@ -476,9 +481,9 @@ public class ManagedBuildTestHelper { buffer.append(diff); buffer.append("\n<<<<<<<<<< testArray = mergeContinuationLines(getContents(testFile)); ArrayList benchmarkArray = mergeContinuationLines(getContents(benchmarkFile)); - + Set testNotMatchingLines = new TreeSet(); Set benchNotMatchingLines = new TreeSet(); Set extraLines = new TreeSet(); @@ -577,12 +582,12 @@ public class ManagedBuildTestHelper { System.err.println("expected: ["+benchmarkLine+"], file "+benchmarkFile); return false; } - + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); final IWorkspaceRoot root = workspace.getRoot(); final String workspaceLocation = root.getLocation().toOSString(); final String platformFileSeparator = System.getProperty("file.separator", Character.toString(IPath.SEPARATOR)); //$NON-NLS-1$ - + for (int j=0;j testArray = getContents(testFile); ArrayList benchmarkArray = getContents(benchmarkFile); - + for (int i=0;i mergeContinuationLines(ArrayList lines) { for (int i=0;i>>>>>>>>>>>>>>start diff: \n"); String location1 = getFileLocation(bmFile.getProject(), bmFile.getProjectRelativePath()); String location2 = getFileLocation(tFile.getProject(), tFile.getProjectRelativePath()); @@ -795,15 +801,16 @@ public class ManagedBuildTestHelper { buffer.append(diff); buffer.append("\n<<<<<<<<<< list = new ArrayList(); ITool tools[] = rcConfig.getTools(); @@ -1127,7 +1134,7 @@ public class ManagedBuildTestHelper { public static IOption getOption(IHoldsOptions tool, int type){ IOption opts[] = tool.getOptions(); - + for(int i = 0; i < opts.length; i++){ IOption option = opts[i]; try { @@ -1142,7 +1149,7 @@ public class ManagedBuildTestHelper { public static boolean setOption(ITool tool, int type, Object value){ IOption option = getOption(tool, type); - + if(option == null) return false; IBuildObject obj = tool.getParent(); @@ -1200,5 +1207,5 @@ public class ManagedBuildTestHelper { } return false; } - + } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ResourceDeltaVerifier.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ResourceDeltaVerifier.java index 0a3cc1c7c5d..b432b3a7515 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ResourceDeltaVerifier.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/testplugin/ResourceDeltaVerifier.java @@ -29,12 +29,12 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; /** - * Based on org.eclipse.core.tests.resources.ResourceDeltaVerifier with + * Based on org.eclipse.core.tests.resources.ResourceDeltaVerifier with * additional support for ignoring changes in certain resources. - * + * * Verifies the state of an IResourceDelta by comparing * it with a client's expectations. The delta is considered valid - * if it contains exactly the set of changes expected by the client, + * if it contains exactly the set of changes expected by the client, * and parents of those changes (having ignore filtered resources). * *

    Example usage: @@ -121,7 +121,7 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList * verifications. When a getMessage() or isDeltaValid() method is * called, the verification completes, and the state becomes * VERIFICATION_COMPLETE. While in this state, any number of - * getMessage() and isDeltaValid() methods can be called. + * getMessage() and isDeltaValid() methods can be called. * While in the third state, any call to addExpectedChange() * resets the verifier and puts it back in its RECEIVING_INPUTS state. */ @@ -819,6 +819,7 @@ public class ResourceDeltaVerifier extends Assert implements IResourceChangeList /** * Part of the IResourceChangedListener interface. */ + @Override public void resourceChanged(IResourceChangeEvent e) { fMessage.append("Resource Changed Delta\n"); verifyDelta(e.getDelta()); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/build/core/scannerconfig/tests/GCCSpecsConsoleParserTest.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/build/core/scannerconfig/tests/GCCSpecsConsoleParserTest.java index 06ff95dfe1b..4b15e3beeb4 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/build/core/scannerconfig/tests/GCCSpecsConsoleParserTest.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/build/core/scannerconfig/tests/GCCSpecsConsoleParserTest.java @@ -29,11 +29,13 @@ public class GCCSpecsConsoleParserTest extends TestCase { protected void setUp() throws Exception { collector = new IScannerInfoCollector() { + @Override public List getCollectedScannerInfo(Object resource, ScannerInfoTypes type) { // TODO Auto-generated method stub return null; } + @Override public void contributeToScannerConfig(Object resource, Map scannerInfo1) { Map> scannerInfo = scannerInfo1; includes = scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/AlwaysOffApplicabilityCalculator.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/AlwaysOffApplicabilityCalculator.java index fdb9dc5b90b..9d5fe25945c 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/AlwaysOffApplicabilityCalculator.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/AlwaysOffApplicabilityCalculator.java @@ -4,25 +4,26 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Texas Instruments Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.managedbuilder.core.tests; -import org.eclipse.cdt.managedbuilder.core.IHoldsOptions; import org.eclipse.cdt.managedbuilder.core.IBuildObject; +import org.eclipse.cdt.managedbuilder.core.IHoldsOptions; import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOptionApplicability; /** - * + * */ public class AlwaysOffApplicabilityCalculator implements IOptionApplicability { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine() */ + @Override public boolean isOptionUsedInCommandLine( IBuildObject config, IHoldsOptions holder, @@ -33,6 +34,7 @@ public class AlwaysOffApplicabilityCalculator implements IOptionApplicability { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible() */ + @Override public boolean isOptionVisible( IBuildObject config, IHoldsOptions holder, @@ -43,6 +45,7 @@ public class AlwaysOffApplicabilityCalculator implements IOptionApplicability { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled() */ + @Override public boolean isOptionEnabled( IBuildObject config, IHoldsOptions holder, diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/AlwaysOnApplicabilityCalculator.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/AlwaysOnApplicabilityCalculator.java index 5f557c14d53..f8085e42ea4 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/AlwaysOnApplicabilityCalculator.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/AlwaysOnApplicabilityCalculator.java @@ -4,25 +4,26 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Texas Instruments Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.managedbuilder.core.tests; -import org.eclipse.cdt.managedbuilder.core.IHoldsOptions; import org.eclipse.cdt.managedbuilder.core.IBuildObject; +import org.eclipse.cdt.managedbuilder.core.IHoldsOptions; import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOptionApplicability; /** - * + * */ public class AlwaysOnApplicabilityCalculator implements IOptionApplicability { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine() */ + @Override public boolean isOptionUsedInCommandLine( IBuildObject config, IHoldsOptions holder, @@ -33,6 +34,7 @@ public class AlwaysOnApplicabilityCalculator implements IOptionApplicability { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible() */ + @Override public boolean isOptionVisible( IBuildObject config, IHoldsOptions holder, @@ -43,6 +45,7 @@ public class AlwaysOnApplicabilityCalculator implements IOptionApplicability { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled() */ + @Override public boolean isOptionEnabled( IBuildObject config, IHoldsOptions holder, diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BidirectionalPathConverter.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BidirectionalPathConverter.java index c40efdc9ca9..6623897e954 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BidirectionalPathConverter.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BidirectionalPathConverter.java @@ -19,11 +19,12 @@ import org.eclipse.core.runtime.Path; public class BidirectionalPathConverter extends OneDirectionalPathConverter implements IReverseOptionPathConverter { + @Override public String convertToOptionValue(ICSettingEntry entry, IOption option, ITool tool) { String name = entry.getName(); IPath path = new Path(name); - + if(PREFIX.isPrefixOf(path)) return path.removeFirstSegments(PREFIX.segmentCount()).makeAbsolute().toString(); else if (!path.isAbsolute()) diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java index 25588ba20da..adf45e6c086 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildDescriptionModelTests.java @@ -16,8 +16,8 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; import junit.framework.Test; import junit.framework.TestCase; @@ -66,10 +66,10 @@ import org.eclipse.core.runtime.Path; public class BuildDescriptionModelTests extends TestCase { private static final String PREFIX = "BuildDescription_"; private static final String PROJ_PATH = "testBuildDescriptionProjects"; - + private CompositeCleaner fCompositeCleaner = new CompositeCleaner(); private Runnable fCleaner = fCompositeCleaner; - + private class CompositeCleaner implements Runnable{ private List fRunnables = new ArrayList(); @@ -77,6 +77,7 @@ public class BuildDescriptionModelTests extends TestCase { fRunnables.add(r); } + @Override public void run() { for(Iterator iter = fRunnables.iterator(); iter.hasNext();){ Runnable r = iter.next(); @@ -84,11 +85,11 @@ public class BuildDescriptionModelTests extends TestCase { } fRunnables.clear(); } - + } private class ProjectCleaner implements Runnable{ List fProjList = new ArrayList(); - + public ProjectCleaner(IProject project){ addProject(project); } @@ -101,6 +102,7 @@ public class BuildDescriptionModelTests extends TestCase { fProjList.add(name); } + @Override public void run() { for(Iterator iter = fProjList.iterator(); iter.hasNext();){ String name = iter.next(); @@ -108,29 +110,29 @@ public class BuildDescriptionModelTests extends TestCase { } fProjList.clear(); } - + } public static Test suite() { return new TestSuite(BuildDescriptionModelTests.class); } - + public void testDes_Model(){ IProject project = createProject(PREFIX + "1", "test30_2.tar"); IFile aAsm = ManagedBuildTestHelper.createFile(project, "a.asm"); ManagedBuildTestHelper.createFile(project, "b.asm"); ManagedBuildTestHelper.createFile(project, "c.cpp"); ManagedBuildTestHelper.createFile(project, "d.cpp"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; cfg.setArtifactExtension("tmp"); BuildDescription des = new BuildDescription(cfg); - + BuildResource aAsmRc = des.createResource("a.asm"); assertNotNull("failed to create resource a.asm", aAsmRc); - + if(aAsmRc != des.createResource(aAsm)) fail("new build resource created for the same resource"); @@ -146,26 +148,26 @@ public class BuildDescriptionModelTests extends TestCase { BuildStep inStep = (BuildStep)des.getInputStep(); assertEquals("input step has inputs", inStep.getInputIOTypes().length, 0); assertEquals("initial input step has outputs", inStep.getOutputIOTypes().length, 0); - + BuildIOType type = inStep.createIOType(false, true, null); if(type == null) fail("failed to create output type"); - + assertNotNull(type); assertEquals(type.getStep(), inStep); - + type.addResource(aAsmRc); - + assertEquals(aAsmRc.getProducerIOType(), type); assertEquals(aAsmRc.getDependentIOTypes().length, 0); assertEquals("input step has inputs", inStep.getInputIOTypes().length, 0); assertEquals(inStep.getOutputIOTypes().length, 1); assertEquals(inStep.getOutputIOTypes()[0], type); - + assertEquals(type.getResources().length, 1); assertEquals(type.getResources()[0], aAsmRc); - + BuildResource bAsmRc = des.createResource("b.asm"); assertEquals(bAsmRc.getProducerIOType(), null); assertEquals(bAsmRc.getDependentIOTypes().length, 0); @@ -177,24 +179,24 @@ public class BuildDescriptionModelTests extends TestCase { assertEquals("input step has inputs", inStep.getInputIOTypes().length, 0); assertEquals(inStep.getOutputIOTypes().length, 1); assertEquals(inStep.getOutputIOTypes()[0], type); - + assertEquals(type.getResources().length, 2); - + BuildStep step = des.createStep(null, null); assertEquals("new step has inputs", inStep.getInputIOTypes().length, 0); assertEquals("new step has outputs", inStep.getOutputIOTypes().length, 1); - + BuildIOType iType = step.createIOType(true, true, null); if(iType == null) fail("failed to create in type"); - + assertEquals(iType.getStep(), step); - + assertEquals(aAsmRc.getProducerIOType(), type); assertEquals(aAsmRc.getDependentIOTypes().length, 0); iType.addResource(aAsmRc); - + assertEquals(aAsmRc.getProducerIOType(), type); assertEquals(aAsmRc.getDependentIOTypes().length, 1); assertEquals(aAsmRc.getDependentIOTypes()[0], iType); @@ -202,10 +204,10 @@ public class BuildDescriptionModelTests extends TestCase { assertEquals("input step has inputs", inStep.getInputIOTypes().length, 0); assertEquals(inStep.getOutputIOTypes().length, 1); assertEquals(inStep.getOutputIOTypes()[0], type); - + assertEquals(iType.getResources().length, 1); assertEquals(iType.getResources()[0], aAsmRc); - + assertEquals(bAsmRc.getProducerIOType(), type); assertEquals(bAsmRc.getDependentIOTypes().length, 0); @@ -217,13 +219,13 @@ public class BuildDescriptionModelTests extends TestCase { assertEquals("input step has inputs", inStep.getInputIOTypes().length, 0); assertEquals(inStep.getOutputIOTypes().length, 1); assertEquals(inStep.getOutputIOTypes()[0], type); - + assertEquals(type.getResources().length, 2); - - + + // ManagedBuildTestHelper.removeProject(PREFIX + "1"); } - + public void testDesTest30_2_asm_only(){ IProject project = createProject(PREFIX + "1", "test30_2.tar"); ManagedBuildTestHelper.createFile(project, "a.asm"); @@ -234,7 +236,7 @@ public class BuildDescriptionModelTests extends TestCase { IConfiguration cfg = mProj.getConfigurations()[0]; cfg.setArtifactExtension("tmp"); BuildDescription tDes = new BuildDescription(cfg); - + IBuildDescription des = null; try { des = BuildDescriptionManager.createBuildDescription(cfg, null, BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED | BuildDescriptionManager.DEPS); @@ -243,7 +245,7 @@ public class BuildDescriptionModelTests extends TestCase { } doTestBuildDescription(des, tDes); - + // ManagedBuildTestHelper.removeProject(PREFIX + "1"); } @@ -264,7 +266,7 @@ public class BuildDescriptionModelTests extends TestCase { } doTestBuildDescription(des, tDes); - + // ManagedBuildTestHelper.removeProject(PREFIX + "1"); } @@ -272,7 +274,7 @@ public class BuildDescriptionModelTests extends TestCase { IProject project = createProject(PREFIX + "1", "test30_2.tar"); ManagedBuildTestHelper.createFile(project, "c.cpp"); ManagedBuildTestHelper.createFile(project, "d.cpp"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; @@ -289,7 +291,7 @@ public class BuildDescriptionModelTests extends TestCase { BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); @@ -299,35 +301,35 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/new.tar")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/new.tar")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/new.log")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/new.log")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName + ".tmp")); // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName + ".tmp")); // @@ -340,27 +342,27 @@ public class BuildDescriptionModelTests extends TestCase { } doTestBuildDescription(des, tDes); - + // ManagedBuildTestHelper.removeProject(PREFIX + "1"); - } - + } + public void testDesTest30_1(){ IProject project = loadProject("test30_1"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IConfiguration cfg = info.getDefaultConfiguration(); String out = cfg.getName() + "/"; - + BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getOutputStep(); type = step.createIOType(true, true, null); type.addResource(tDes.createResource(out + "Test30_1.so.4.5.6")); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource(out + "CDT.jpeg")); // @@ -369,7 +371,7 @@ public class BuildDescriptionModelTests extends TestCase { type = step.createIOType(false, true, null); type.addResource(tDes.createResource(out + "CDT.jpeg")); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(out + "CDT.bmp")); // @@ -458,18 +460,18 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e) { fail("build description creation failed: " + e.getLocalizedMessage()); } - + doTestBuildDescription(des, tDes); } - + public void testDesTest30_2(){ IProject project = createProject(PREFIX + "1", "test30_2.tar"); ManagedBuildTestHelper.createFile(project, "a.asm"); ManagedBuildTestHelper.createFile(project, "b.asm"); ManagedBuildTestHelper.createFile(project, "c.cpp"); ManagedBuildTestHelper.createFile(project, "d.cpp"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; @@ -486,53 +488,53 @@ public class BuildDescriptionModelTests extends TestCase { BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); type = step.createIOType(false, false, null); type.addResource(tDes.createResource("a.asm")); type.addResource(tDes.createResource("b.asm")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("a.asm")); type.addResource(tDes.createResource("b.asm")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/new.tar")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/new.tar")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/new.log")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/new.log")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName + ".tmp")); // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName + ".tmp")); // @@ -545,60 +547,60 @@ public class BuildDescriptionModelTests extends TestCase { } doTestBuildDescription(des, tDes); - + // ManagedBuildTestHelper.removeProject(PREFIX + "1"); } -/* +/* private void doTestStep(IBuildStep step, StepDes testStep){ IBuildIOType iTs[] = step.getInputIOTypes(); TypeDes tITs[] = testStep.fInTypes; IBuildIOType oTs[] = step.getOutputIOTypes(); TypeDes tOTs[] = testStep.fOutTypes; - + assertEquals(iTs.length, tITs.length); assertEquals(oTs.length, tOTs.length); - - + + } */ private void doTestStep(IBuildStep step, IBuildStep oStep, boolean up){ Map inMap = new HashMap(); Map outMap = new HashMap(); - + stepsMatch(step, oStep, inMap, outMap, true); - + Map map = up ? outMap : inMap; - + for (Entry entry : map.entrySet()) { doTestType(entry.getKey(), entry.getValue()); } } - + private void doTestType(IBuildIOType type, IBuildIOType oType){ Map map = new HashMap(); - + typesMatch(type, oType, map, true); - + for (Entry entry : map.entrySet()) { doTestResource(entry.getKey(), entry.getValue(), !type.isInput()); } } - + private void doTestResource(IBuildResource rc, IBuildResource oRc, boolean up){ Map outMap = new HashMap(); - + doTestResourceMatch(rc, oRc, outMap); - + if(!up){ typesMatch(rc.getProducerIOType(), oRc.getProducerIOType(), null, true); doTestStep(rc.getProducerIOType().getStep(), oRc.getProducerIOType().getStep(), up); } else { Set stepSet = new HashSet(); - + for (Entry entry : outMap.entrySet()) { IBuildIOType type = entry.getKey(); - + IBuildStep step = type.getStep(); if(stepSet.add(step)){ IBuildIOType oType = entry.getValue(); @@ -608,38 +610,38 @@ public class BuildDescriptionModelTests extends TestCase { } } } - + private void doTestResourceMatch(IBuildResource rc, IBuildResource oRc, Map outTypeMap){ - + doTrace("matching resource " + DbgUtil.resourceName(rc)); - + if(!rc.getLocation().equals(oRc.getLocation())) doFail("different resource locsations", rc, oRc); - + IBuildIOType inType = rc.getProducerIOType(); IBuildIOType oInType = oRc.getProducerIOType(); - + typesMatch(inType, oInType, null, true); - - + + IBuildIOType outTypes[] = rc.getDependentIOTypes(); IBuildIOType oOutTypes[] = oRc.getDependentIOTypes(); - + if(outTypes.length != oOutTypes.length) doFail("resources do not match: different number of output types", rc, oRc); - + for(int i = 0; i < outTypes.length; i++){ IBuildIOType oType = getCorType(outTypes[i], oOutTypes); if(oType == null) doFail("resources not match: no cor dep type found", rc, oRc); - + Object obj = outTypeMap.put(outTypes[i], oType); - + if(obj != null){ doFail("there was corresponding type",rc, oRc); } } - + doTrace("end matching resource"); } @@ -651,9 +653,9 @@ public class BuildDescriptionModelTests extends TestCase { private boolean stepsMatch(IBuildStep step, IBuildStep oStep, Map inTypeMap, Map outTypeMap, boolean checkSteps, boolean failOnErr){ IBuildIOType inTypes[] = step.getInputIOTypes(); IBuildIOType oInTypes[] = oStep.getInputIOTypes(); - + doTrace("matching step " + DbgUtil.stepName(step)); - + if(inTypes.length != oInTypes.length){ if(failOnErr) doFail("steps do not match: different number of input types",step, oStep); @@ -666,9 +668,9 @@ public class BuildDescriptionModelTests extends TestCase { doFail("steps not match, no corresponding input type found", step, oStep); return false; } - + Object obj = inTypeMap.put(inTypes[i], oType); - + if(obj != null){ if(failOnErr) doFail("there was already corresponding input type", step, oStep); @@ -678,13 +680,13 @@ public class BuildDescriptionModelTests extends TestCase { IBuildIOType outTypes[] = step.getOutputIOTypes(); IBuildIOType oOutTypes[] = oStep.getOutputIOTypes(); - + if(outTypes.length != oOutTypes.length){ if(failOnErr) doFail("steps do not match: different number of output types", step, oStep); return false; } - + for(int i = 0; i < outTypes.length; i++){ IBuildIOType oType = getCorType(outTypes[i], oOutTypes, null, checkSteps); if(oType == null){ @@ -692,18 +694,18 @@ public class BuildDescriptionModelTests extends TestCase { doFail("steps not match, no corresponding output type found", step, oStep); return false; } - + Object obj = outTypeMap.put(outTypes[i], oType); - + if(obj != null){ if(failOnErr) doFail("there was already corresponding output type", step, oStep); return false; } } - + doTrace("end matching step"); - + return true; } @@ -715,31 +717,31 @@ public class BuildDescriptionModelTests extends TestCase { for(int i = 0; i < oTypes.length; i++){ if(typesMatch(type, oTypes[i], rcMap, checkSteps, false)) return oTypes[i]; - + if(rcMap != null) rcMap.clear(); } - + return null; -/* +/* IBuildStep step = type.getStep(); IBuildResource rcs[] = type.getResources(); for(int i = 0; i < oTypes.length; i++){ if(type.isInput() != oTypes[i].isInput()) continue; - + IBuildResource oRcs[] = oTypes[i].getResources(); - + if(rcs.length != oRcs.length) continue; - + if(resourcesMatch(rcs, oRcs, null)){ if(!checkSteps) return oTypes[i]; IBuildIOType oType = oTypes[i]; IBuildStep step = type.getStep(); IBuildStep oStep = oType.getStep(); - + if(typesMatch(step.get)) for(int j = 0; j < ) } @@ -753,7 +755,7 @@ public class BuildDescriptionModelTests extends TestCase { } private boolean typesMatch(IBuildIOType type, IBuildIOType oType, Map rcMap, boolean checkStep, boolean failOnError){ - + // doTrace("matching io type"); if(type.isInput() != oType.isInput()){ if(failOnError){ @@ -761,12 +763,12 @@ public class BuildDescriptionModelTests extends TestCase { } return false; } - + IBuildResource rcs[] = type.getResources(); IBuildResource oRcs[] = oType.getResources(); if(rcs.length != oRcs.length) return false; - + if(resourcesMatch(rcs, oRcs, rcMap)){ Map inMap = new HashMap(); Map outMap = new HashMap(); @@ -780,11 +782,11 @@ public class BuildDescriptionModelTests extends TestCase { return false; } - + private boolean resourcesMatch(IBuildResource rcs[], IBuildResource oRcs[], Map rcMap){ if(rcs.length != oRcs.length) return false; - + for(int j = 0; j < rcs.length; j++){ IPath location = rcs[j].getLocation(); int k; @@ -817,25 +819,25 @@ public class BuildDescriptionModelTests extends TestCase { DbgUtil.trace(getClass().getSimpleName()+'.'+getName()+ ": "+ message+dump); fail(message+" (see console output)"); } - + private void doTrace(String str){ if(DbgUtil.DEBUG) DbgUtil.trace(str); } - + private void doTestBuildDescription(IBuildDescription des, IBuildDescription tDes){ assertEquals(des.getConfiguration(), tDes.getConfiguration()); - + assertNotNull(des.getConfiguration()); - + IBuildStep inStep = des.getInputStep(); IBuildStep outStep = des.getOutputStep(); - + if(inStep.getInputIOTypes().length != 0){ doFail("input step contains unexpected inputs", DbgUtil.dumpStep(inStep)); } if(outStep.getOutputIOTypes().length != 0){ - doFail("output step contains unexpected outputs", DbgUtil.dumpStep(outStep)); + doFail("output step contains unexpected outputs", DbgUtil.dumpStep(outStep)); } IBuildStep tInStep = tDes.getInputStep(); @@ -844,36 +846,36 @@ public class BuildDescriptionModelTests extends TestCase { doTrace("*****testing down to up.."); doTestStep(inStep, tInStep, true); doTrace("*****down to up passed"); - + doTrace("*****testing up to down.."); doTestStep(outStep, tOutStep, false); doTrace("*****up to down passed"); } - + @Override protected void tearDown() throws Exception { fCleaner.run(); if(DbgUtil.DEBUG) DbgUtil.flush(); } - + private IProject createProject(String name, String id){ IProject proj = ManagedBuildTestHelper.createProject(name, id); if(proj != null) fCompositeCleaner.addRunnable(new ProjectCleaner(proj)); - + return proj; } - + private IProject loadProject(String name){ IProject proj = ManagedBuildTestHelper.loadProject(name, PROJ_PATH); if(proj != null) fCompositeCleaner.addRunnable(new ProjectCleaner(proj)); - + return proj; } - + public void testDes_gnu30_exe(){ IProject project = createProject(PREFIX + "1", "cdt.managedbuild.target.gnu30.exe"); try { @@ -881,16 +883,16 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + ManagedBuildTestHelper.createFile(project, "a.c"); ManagedBuildTestHelper.createFile(project, "b.c"); ManagedBuildTestHelper.createFile(project, "c.cpp"); ManagedBuildTestHelper.createFile(project, "d.cpp"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; - + String artifactName=null; try { artifactName = ManagedBuildManager.getBuildMacroProvider().resolveValue(cfg.getArtifactName(), "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg); @@ -900,20 +902,20 @@ public class BuildDescriptionModelTests extends TestCase { String ext = cfg.getArtifactExtension(); if(ext != null && ext.length() > 0) artifactName = artifactName + "." + ext; - + String cName = cfg.getName(); BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); type = step.createIOType(false, false, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("a.c")); type.addResource(tDes.createResource("b.c")); @@ -921,55 +923,55 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("a.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/a.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("b.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/b.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("c.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/c.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/d.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/a.o")); type.addResource(tDes.createResource(cName + "/b.o")); type.addResource(tDes.createResource(cName + "/c.o")); type.addResource(tDes.createResource(cName + "/d.o")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // @@ -983,7 +985,7 @@ public class BuildDescriptionModelTests extends TestCase { doTestBuildDescription(des, tDes); } - + public void testDes_gnu30_exe_deps(){ IProject project = createProject(PREFIX + "gnu30_exe_deps", "cdt.managedbuild.target.gnu30.exe"); try { @@ -991,7 +993,7 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + ManagedBuildTestHelper.createFile(project, "a.c", "\n#include \"a.h\"\n#include \"d.h\"\n"); ManagedBuildTestHelper.createFile(project, "b.c"); ManagedBuildTestHelper.createFile(project, "c.cpp", "\n#include \"b.h\"\n#include \"e.h\"\n"); @@ -1002,7 +1004,7 @@ public class BuildDescriptionModelTests extends TestCase { ManagedBuildTestHelper.createFile(project, "d.h", "\n"); ManagedBuildTestHelper.createFile(project, "e.h", "\n"); ManagedBuildTestHelper.createFile(project, "f.h", "\n"); - + ICProject cProject = CoreModel.getDefault().create(project); CCorePlugin.getIndexManager().setIndexerId(cProject, IPDOMManager.ID_FAST_INDEXER); IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); @@ -1018,20 +1020,20 @@ public class BuildDescriptionModelTests extends TestCase { String ext = cfg.getArtifactExtension(); if(ext != null && ext.length() > 0) artifactName = artifactName + "." + ext; - + String cName = cfg.getName(); BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); type = step.createIOType(false, false, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("a.c")); type.addResource(tDes.createResource("b.c")); @@ -1045,7 +1047,7 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("a.c")); @@ -1060,16 +1062,16 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("b.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/b.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("c.cpp")); @@ -1083,28 +1085,28 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/d.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/a.o")); type.addResource(tDes.createResource(cName + "/b.o")); type.addResource(tDes.createResource(cName + "/c.o")); type.addResource(tDes.createResource(cName + "/d.o")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // @@ -1121,7 +1123,7 @@ public class BuildDescriptionModelTests extends TestCase { Thread.sleep(5000); } catch (InterruptedException e) { } - + CCorePlugin.getIndexManager().joinIndexer(-1, new NullProgressMonitor()); CCorePlugin.getIndexManager().reindex(cProject); CCorePlugin.getIndexManager().joinIndexer(-1, new NullProgressMonitor()); @@ -1135,7 +1137,7 @@ public class BuildDescriptionModelTests extends TestCase { doTestBuildDescription(des, tDes); } - + public void testDesTestgnu21_exe(){ IProject project = createProject(PREFIX + "1", "cdt.managedbuild.target.testgnu21.exe"); try { @@ -1143,12 +1145,12 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + ManagedBuildTestHelper.createFile(project, "a.c"); ManagedBuildTestHelper.createFile(project, "b.c"); ManagedBuildTestHelper.createFile(project, "c.cpp"); ManagedBuildTestHelper.createFile(project, "d.cpp"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; @@ -1161,20 +1163,20 @@ public class BuildDescriptionModelTests extends TestCase { String ext = cfg.getArtifactExtension(); if(ext != null && ext.length() > 0) artifactName = artifactName + "." + ext; - + String cName = cfg.getName(); BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); type = step.createIOType(false, false, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("a.c")); type.addResource(tDes.createResource("b.c")); @@ -1182,55 +1184,55 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("a.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/a.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("b.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/b.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("c.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/c.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/d.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/a.o")); type.addResource(tDes.createResource(cName + "/b.o")); type.addResource(tDes.createResource(cName + "/c.o")); type.addResource(tDes.createResource(cName + "/d.o")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // @@ -1244,7 +1246,7 @@ public class BuildDescriptionModelTests extends TestCase { doTestBuildDescription(des, tDes); } - + public void testDesRcCfg(){ IProject project = createProject(PREFIX + "1", "cdt.managedbuild.target.gnu30.exe"); try { @@ -1252,12 +1254,12 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + IFile ac = ManagedBuildTestHelper.createFile(project, "a.c"); ManagedBuildTestHelper.createFile(project, "b.c"); IFile ccpp = ManagedBuildTestHelper.createFile(project, "c.cpp"); ManagedBuildTestHelper.createFile(project, "d.cpp"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; @@ -1271,7 +1273,7 @@ public class BuildDescriptionModelTests extends TestCase { String ext = cfg.getArtifactExtension(); if(ext != null && ext.length() > 0) artifactName = artifactName + "." + ext; - + String cName = cfg.getName(); IResourceConfiguration rcCfg = cfg.createResourceConfiguration(ac); assertNotNull(rcCfg); @@ -1281,14 +1283,14 @@ public class BuildDescriptionModelTests extends TestCase { BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); type = step.createIOType(false, false, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("a.c")); type.addResource(tDes.createResource("b.c")); @@ -1296,55 +1298,55 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("a.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/a.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("b.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/b.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("c.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/c.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/d.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/a.o")); type.addResource(tDes.createResource(cName + "/b.o")); type.addResource(tDes.createResource(cName + "/c.o")); type.addResource(tDes.createResource(cName + "/d.o")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // @@ -1367,7 +1369,7 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + ManagedBuildTestHelper.createFile(project, "a.c"); ManagedBuildTestHelper.createFile(project, "b.c"); IFile ccpp = ManagedBuildTestHelper.createFile(project, "c.cpp"); @@ -1377,12 +1379,12 @@ public class BuildDescriptionModelTests extends TestCase { ManagedBuildTestHelper.createFile(project, "dir1/g.r"); ManagedBuildTestHelper.createFile(project, "dir2/h.r"); ManagedBuildTestHelper.createFile(project, "dir2/i.r"); - - + + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; - + String artifactName=null; try { artifactName = ManagedBuildManager.getBuildMacroProvider().resolveValue(cfg.getArtifactName(), "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg); @@ -1392,11 +1394,11 @@ public class BuildDescriptionModelTests extends TestCase { String ext = cfg.getArtifactExtension(); if(ext != null && ext.length() > 0) artifactName = artifactName + "." + ext; - + String cName = cfg.getName(); String out = cName + "/"; - - + + ManagedBuildTestHelper.createRcbsTool(cfg, ccpp, "f.r;dir1/g.r;dir2/h.r", "q.o;w.o;e.o", "a;b;c"); ManagedBuildTestHelper.createRcbsTool(cfg, er, "f.r;dir1/g.r;dir2/h.r;dir2/i.r", "z.cpp;x.c", "d;e;f"); // IResourceConfiguration rcCfg = cfg.createResourceConfiguration(ac); @@ -1407,14 +1409,14 @@ public class BuildDescriptionModelTests extends TestCase { BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); type = step.createIOType(false, false, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("a.c")); type.addResource(tDes.createResource("b.c")); @@ -1428,25 +1430,25 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("a.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/a.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("b.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/b.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("c.cpp")); @@ -1462,16 +1464,16 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/d.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("e.r")); @@ -1480,7 +1482,7 @@ public class BuildDescriptionModelTests extends TestCase { type.addResource(tDes.createResource("dir1/g.r")); type.addResource(tDes.createResource("dir2/h.r")); type.addResource(tDes.createResource("dir2/i.r")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(out + "z.cpp")); type.addResource(tDes.createResource(out + "x.c")); @@ -1490,25 +1492,25 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource(out + "z.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/z.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource(out + "x.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/x.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/a.o")); type.addResource(tDes.createResource(cName + "/b.o")); @@ -1522,13 +1524,13 @@ public class BuildDescriptionModelTests extends TestCase { // type.addResource(tDes.createResource(cName + "/r.o")); // type.addResource(tDes.createResource(cName + "/t.o")); // type.addResource(tDes.createResource(cName + "/y.o")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // @@ -1551,7 +1553,7 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + ManagedBuildTestHelper.createFile(project, "a.c"); ManagedBuildTestHelper.createFile(project, "b.c"); IFile ccpp = ManagedBuildTestHelper.createFile(project, "c.cpp"); @@ -1563,8 +1565,8 @@ public class BuildDescriptionModelTests extends TestCase { ManagedBuildTestHelper.createFile(project, "dir2/i.r"); ManagedBuildTestHelper.createFile(project, "o1.o"); ManagedBuildTestHelper.createFile(project, "dir3/o2.o"); - - + + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; @@ -1578,13 +1580,13 @@ public class BuildDescriptionModelTests extends TestCase { String ext = cfg.getArtifactExtension(); if(ext != null && ext.length() > 0) artifactName = artifactName + "." + ext; - + String cName = cfg.getName(); String out = cName + "/"; - + ManagedBuildTestHelper.setObjs(cfg, new String[]{"o1.o", "dir3/o2.o", "dir4/d/o3.o"}); - - + + ManagedBuildTestHelper.createRcbsTool(cfg, ccpp, "f.r;dir1/g.r;dir2/h.r", "q.o;w.o;e.o", "a;b;c"); ManagedBuildTestHelper.createRcbsTool(cfg, er, "f.r;dir1/g.r;dir2/h.r;dir2/i.r", "z.cpp;x.c", "d;e;f"); // IResourceConfiguration rcCfg = cfg.createResourceConfiguration(ac); @@ -1595,14 +1597,14 @@ public class BuildDescriptionModelTests extends TestCase { BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); type = step.createIOType(false, false, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("a.c")); type.addResource(tDes.createResource("b.c")); @@ -1613,7 +1615,7 @@ public class BuildDescriptionModelTests extends TestCase { type.addResource(tDes.createResource("dir1/g.r")); type.addResource(tDes.createResource("dir2/h.r")); type.addResource(tDes.createResource("dir2/i.r")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("o1.o")); type.addResource(tDes.createResource("dir3/o2.o")); @@ -1622,25 +1624,25 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("a.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/a.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("b.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/b.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("c.cpp")); @@ -1656,16 +1658,16 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/d.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("e.r")); @@ -1674,7 +1676,7 @@ public class BuildDescriptionModelTests extends TestCase { type.addResource(tDes.createResource("dir1/g.r")); type.addResource(tDes.createResource("dir2/h.r")); type.addResource(tDes.createResource("dir2/i.r")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(out + "z.cpp")); type.addResource(tDes.createResource(out + "x.c")); @@ -1684,25 +1686,25 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource(out + "z.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/z.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource(out + "x.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/x.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/a.o")); type.addResource(tDes.createResource(cName + "/b.o")); @@ -1727,7 +1729,7 @@ public class BuildDescriptionModelTests extends TestCase { // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // @@ -1742,7 +1744,7 @@ public class BuildDescriptionModelTests extends TestCase { doTestBuildDescription(des, tDes); } - + public void testDesAddlInVar(){ IProject project = createProject(PREFIX + "1", "cdt.managedbuild.target.bdm.exe"); try { @@ -1750,7 +1752,7 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + ManagedBuildTestHelper.createFile(project, "a.c"); ManagedBuildTestHelper.createFile(project, "b.c"); ManagedBuildTestHelper.createFile(project, "c.cpp"); @@ -1759,11 +1761,11 @@ public class BuildDescriptionModelTests extends TestCase { ManagedBuildTestHelper.createFile(project, "dir/f.s1"); ManagedBuildTestHelper.createFile(project, "g.s2"); ManagedBuildTestHelper.createFile(project, "dir/h.s2"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; - + String artifactName=null; try { artifactName = ManagedBuildManager.getBuildMacroProvider().resolveValue(cfg.getArtifactName(), "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg); @@ -1773,21 +1775,21 @@ public class BuildDescriptionModelTests extends TestCase { String ext = cfg.getArtifactExtension(); if(ext != null && ext.length() > 0) artifactName = artifactName + "." + ext; - + String cName = cfg.getName(); String out = cName + "/"; BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); type = step.createIOType(false, false, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("a.c")); type.addResource(tDes.createResource("b.c")); @@ -1802,87 +1804,87 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("e.s1")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(out + "e.o1")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("dir/f.s1")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(out + "dir/f.o1")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("g.s2")); type = step.createIOType(true, false, null); type.addResource(tDes.createResource(out + "e.o1")); type.addResource(tDes.createResource(out + "dir/f.o1")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(out + "g.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("dir/h.s2")); type = step.createIOType(true, false, null); type.addResource(tDes.createResource(out + "e.o1")); type.addResource(tDes.createResource(out + "dir/f.o1")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(out + "dir/h.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("a.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/a.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("b.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/b.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("c.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/c.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/d.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/a.o")); type.addResource(tDes.createResource(cName + "/b.o")); @@ -1890,13 +1892,13 @@ public class BuildDescriptionModelTests extends TestCase { type.addResource(tDes.createResource(cName + "/d.o")); type.addResource(tDes.createResource(out + "g.o")); type.addResource(tDes.createResource(out + "dir/h.o")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // @@ -1918,18 +1920,18 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + ManagedBuildTestHelper.createFile(project, "a.c"); ManagedBuildTestHelper.createFile(project, "b.c"); ManagedBuildTestHelper.createFile(project, "c.cpp"); ManagedBuildTestHelper.createFile(project, "d.cpp"); ManagedBuildTestHelper.createFile(project, "e.o"); ManagedBuildTestHelper.createFile(project, "dir/f.o"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; - + String artifactName=null; try { artifactName = ManagedBuildManager.getBuildMacroProvider().resolveValue(cfg.getArtifactName(), "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, cfg); @@ -1939,20 +1941,20 @@ public class BuildDescriptionModelTests extends TestCase { String ext = cfg.getArtifactExtension(); if(ext != null && ext.length() > 0) artifactName = artifactName + "." + ext; - + String cName = cfg.getName(); BuildDescription tDes = new BuildDescription(cfg); BuildStep step; BuildIOType type; - + // step = (BuildStep)tDes.getInputStep(); type = step.createIOType(false, false, null); type.addResource(tDes.createResource("c.cpp")); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource("a.c")); type.addResource(tDes.createResource("b.c")); @@ -1960,55 +1962,55 @@ public class BuildDescriptionModelTests extends TestCase { // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("a.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/a.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("b.c")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/b.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("c.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/c.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, false, null); type.addResource(tDes.createResource("d.cpp")); - + type = step.createIOType(false, true, null); type.addResource(tDes.createResource(cName + "/d.o")); // // step = tDes.createStep(null, null); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/a.o")); type.addResource(tDes.createResource(cName + "/b.o")); type.addResource(tDes.createResource(cName + "/c.o")); type.addResource(tDes.createResource(cName + "/d.o")); - + type = step.createIOType(false, false, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // // step = (BuildStep)tDes.getOutputStep(); - + type = step.createIOType(true, true, null); type.addResource(tDes.createResource(cName + "/" + artifactName)); // @@ -2022,7 +2024,7 @@ public class BuildDescriptionModelTests extends TestCase { doTestBuildDescription(des, tDes); } - + public void testDesRebuildState(){ IProject project = createProject(PREFIX + "1", "cdt.managedbuild.target.gnu30.exe"); try { @@ -2030,22 +2032,22 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + ManagedBuildTestHelper.createFile(project, "a.c"); ManagedBuildTestHelper.createFile(project, "b.c"); ManagedBuildTestHelper.createFile(project, "c.cpp"); ManagedBuildTestHelper.createFile(project, "d.cpp"); ManagedBuildTestHelper.createFile(project, "e.o"); ManagedBuildTestHelper.createFile(project, "dir/f.o"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); IConfiguration cfg = mProj.getConfigurations()[0]; - + cfg.setRebuildState(false); - + assertFalse(cfg.needsRebuild()); - + ITool targetTool = ((Configuration)cfg).calculateTargetTool(); cfg.setArtifactName("asdafasdfasdfasdfasdf"); @@ -2080,13 +2082,13 @@ public class BuildDescriptionModelTests extends TestCase { // cfg.setRebuildState(false); assertFalse(targetTool.needsRebuild()); assertFalse(cfg.needsRebuild()); - + cfg.setPostannouncebuildStep("sdfasdfasdfsdfadfasf"); assertFalse(cfg.needsRebuild()); cfg.setPostbuildStep("asdf;asdf;asdf;asdf;asdf"); assertFalse(cfg.needsRebuild()); - + cfg.setPreannouncebuildStep("sdfgsdgsdhnbvxcvbxcv"); assertFalse(cfg.needsRebuild()); @@ -2095,20 +2097,20 @@ public class BuildDescriptionModelTests extends TestCase { ITool tools[] = cfg.getFilteredTools(); ITool tool = null; - + for(int i = 0; i < tools.length; i++){ tool = tools[i]; if(tool != targetTool) break; } - + cfg.setToolCommand(tool, "sdgsdcxvzcxvzxc"); assertTrue(tool.needsRebuild()); assertTrue(cfg.needsRebuild()); tool.setRebuildState(false); assertFalse(tool.needsRebuild()); assertFalse(cfg.needsRebuild()); - + cfg.setArtifactExtension("adsfasdfasdfasdfasdf"); assertTrue(targetTool.needsRebuild()); assertTrue(cfg.needsRebuild()); @@ -2129,16 +2131,16 @@ public class BuildDescriptionModelTests extends TestCase { if(obj != null){ IHoldsOptions ho = (IHoldsOptions)obj[0]; IOption o = (IOption)obj[1]; - + assertFalse(ho.needsRebuild()); assertFalse(cfg.needsRebuild()); - + try { cfg.setOption(ho, o, !o.getBooleanValue()); } catch (BuildException e) { fail("failed to set the option: " + e.getLocalizedMessage()); } - + assertTrue(ho.needsRebuild()); assertTrue(cfg.needsRebuild()); ho.setRebuildState(false); @@ -2150,16 +2152,16 @@ public class BuildDescriptionModelTests extends TestCase { if(obj != null){ IHoldsOptions ho = (IHoldsOptions)obj[0]; IOption o = (IOption)obj[1]; - + assertFalse(ho.needsRebuild()); assertFalse(cfg.needsRebuild()); - + try { cfg.setOption(ho, o, "sdfgsdfcvsdfgvxcsdf"); } catch (BuildException e) { fail("failed to set the option: " + e.getLocalizedMessage()); } - + assertTrue(ho.needsRebuild()); assertTrue(cfg.needsRebuild()); ho.setRebuildState(false); @@ -2171,16 +2173,16 @@ public class BuildDescriptionModelTests extends TestCase { if(obj != null){ IHoldsOptions ho = (IHoldsOptions)obj[0]; IOption o = (IOption)obj[1]; - + assertFalse(ho.needsRebuild()); assertFalse(cfg.needsRebuild()); - + try { cfg.setOption(ho, o, "sdfgsdfcvsdfgvxcfdgvsdf"); } catch (BuildException e) { fail("failed to set the option: " + e.getLocalizedMessage()); } - + assertTrue(ho.needsRebuild()); assertTrue(cfg.needsRebuild()); ho.setRebuildState(false); @@ -2192,16 +2194,16 @@ public class BuildDescriptionModelTests extends TestCase { if(obj != null){ IHoldsOptions ho = (IHoldsOptions)obj[0]; IOption o = (IOption)obj[1]; - + assertFalse(ho.needsRebuild()); assertFalse(cfg.needsRebuild()); - + try { cfg.setOption(ho, o, new String[]{"sdfgsd","fcvsdfgvxcfdgvsdf"}); } catch (BuildException e) { fail("failed to set the option: " + e.getLocalizedMessage()); } - + assertTrue(ho.needsRebuild()); assertTrue(cfg.needsRebuild()); ho.setRebuildState(false); @@ -2213,16 +2215,16 @@ public class BuildDescriptionModelTests extends TestCase { if(obj != null){ IHoldsOptions ho = (IHoldsOptions)obj[0]; IOption o = (IOption)obj[1]; - + assertFalse(ho.needsRebuild()); assertFalse(cfg.needsRebuild()); - + try { cfg.setOption(ho, o, new String[]{"sdfgsd","fcvsdfgvxcfdgvsdf"}); } catch (BuildException e) { fail("failed to set the option: " + e.getLocalizedMessage()); } - + assertTrue(ho.needsRebuild()); assertTrue(cfg.needsRebuild()); ho.setRebuildState(false); @@ -2230,21 +2232,21 @@ public class BuildDescriptionModelTests extends TestCase { assertFalse(cfg.needsRebuild()); } - + obj = ManagedBuildTestHelper.getOption(cfg, IOption.PREPROCESSOR_SYMBOLS); if(obj != null){ IHoldsOptions ho = (IHoldsOptions)obj[0]; IOption o = (IOption)obj[1]; - + assertFalse(ho.needsRebuild()); assertFalse(cfg.needsRebuild()); - + try { cfg.setOption(ho, o, new String[]{"sdfgsd","fcvsdfgvxcfdgvsdf"}); } catch (BuildException e) { fail("failed to set the option: " + e.getLocalizedMessage()); } - + assertTrue(ho.needsRebuild()); assertTrue(cfg.needsRebuild()); ho.setRebuildState(false); @@ -2256,16 +2258,16 @@ public class BuildDescriptionModelTests extends TestCase { if(obj != null){ IHoldsOptions ho = (IHoldsOptions)obj[0]; IOption o = (IOption)obj[1]; - + assertFalse(ho.needsRebuild()); assertFalse(cfg.needsRebuild()); - + try { cfg.setOption(ho, o, new String[]{"sdfgsd","fcvsdfgvxcfdgvsdf"}); } catch (BuildException e) { fail("failed to set the option: " + e.getLocalizedMessage()); } - + assertTrue(ho.needsRebuild()); assertTrue(cfg.needsRebuild()); ho.setRebuildState(false); @@ -2277,16 +2279,16 @@ public class BuildDescriptionModelTests extends TestCase { if(obj != null){ IHoldsOptions ho = (IHoldsOptions)obj[0]; IOption o = (IOption)obj[1]; - + assertFalse(ho.needsRebuild()); assertFalse(cfg.needsRebuild()); - + try { cfg.setOption(ho, o, new String[]{"sdfgsd","fcvsdfgvxcfdgvsdf"}); } catch (BuildException e) { fail("failed to set the option: " + e.getLocalizedMessage()); } - + assertTrue(ho.needsRebuild()); assertTrue(cfg.needsRebuild()); ho.setRebuildState(false); @@ -2302,26 +2304,26 @@ public class BuildDescriptionModelTests extends TestCase { tch.setRebuildState(false); assertFalse(tch.needsRebuild()); assertFalse(cfg.needsRebuild()); - + for(int i = 0; i < tools.length; i++){ doTestTool(tools[i]); } - + IResourceConfiguration rcCfgs[] = cfg.getResourceConfigurations(); for(int i = 0; i < rcCfgs.length; i++){ IResourceConfiguration rcCfg = rcCfgs[i]; - + assertFalse(rcCfg.needsRebuild()); assertFalse(cfg.needsRebuild()); - + rcCfg.setRebuildState(true); assertTrue(rcCfg.needsRebuild()); assertTrue(cfg.needsRebuild()); - + rcCfg.setRebuildState(false); assertFalse(rcCfg.needsRebuild()); assertFalse(cfg.needsRebuild()); - + rcCfg.setExclude(!rcCfg.isExcluded()); assertTrue(rcCfg.needsRebuild()); assertTrue(cfg.needsRebuild()); @@ -2347,7 +2349,7 @@ public class BuildDescriptionModelTests extends TestCase { rcCfg.setRcbsApplicability(rcCfg.getRcbsApplicability()); assertFalse(rcCfg.needsRebuild()); assertFalse(cfg.needsRebuild()); - + ITool t = rcCfg.getToolsToInvoke()[0]; assertFalse(t.needsRebuild()); rcCfg.setToolCommand(t, "sdsdcdsffewffdvcx"); @@ -2358,14 +2360,14 @@ public class BuildDescriptionModelTests extends TestCase { assertFalse(t.needsRebuild()); assertFalse(rcCfg.needsRebuild()); assertFalse(cfg.needsRebuild()); - + rcCfg.setToolCommand(t, t.getToolCommand()); assertFalse(t.needsRebuild()); assertFalse(rcCfg.needsRebuild()); assertFalse(cfg.needsRebuild()); } } - + private void doTestTool(ITool tool){ IBuildObject obj = tool.getParent(); IConfiguration cfg; @@ -2373,31 +2375,31 @@ public class BuildDescriptionModelTests extends TestCase { cfg = ((IResourceConfiguration)obj).getParent(); else cfg = ((IToolChain)obj).getParent(); - + cfg.setRebuildState(false); - + assertFalse(tool.needsRebuild()); - + tool.setRebuildState(true); assertTrue(tool.needsRebuild()); - + assertTrue(cfg.needsRebuild()); - + cfg.setRebuildState(false); assertFalse(tool.needsRebuild()); assertFalse(cfg.needsRebuild()); - + tool.setRebuildState(true); assertTrue(tool.needsRebuild()); - + assertTrue(cfg.needsRebuild()); - + tool.setRebuildState(false); assertFalse(tool.needsRebuild()); assertFalse(cfg.needsRebuild()); - + tool.setCommandLinePattern("asdfasdfasdfasdfasdfasdsdfghdsfg"); assertTrue(tool.needsRebuild()); assertTrue(cfg.needsRebuild()); @@ -2411,7 +2413,7 @@ public class BuildDescriptionModelTests extends TestCase { tool.setRebuildState(false); assertFalse(tool.needsRebuild()); assertFalse(cfg.needsRebuild()); - + tool.setOutputPrefix("afgsdfgfadcvwerfdvsdczxv"); assertTrue(tool.needsRebuild()); assertTrue(cfg.needsRebuild()); @@ -2434,20 +2436,20 @@ public class BuildDescriptionModelTests extends TestCase { assertFalse(cfg.needsRebuild()); IInputType iTypes[] = tool.getInputTypes(); - + for(int i = 0; i < iTypes.length; i++){ IInputType iType = iTypes[i]; - + if(iType.isExtensionElement()) continue; - + iType.setAssignToOptionId("qwertyuiop"); assertTrue(tool.needsRebuild()); assertTrue(cfg.needsRebuild()); tool.setRebuildState(false); assertFalse(tool.needsRebuild()); assertFalse(cfg.needsRebuild()); - + iType.setBuildVariable("asdfghjkl"); assertTrue(tool.needsRebuild()); assertTrue(cfg.needsRebuild()); @@ -2479,7 +2481,7 @@ public class BuildDescriptionModelTests extends TestCase { IAdditionalInput addlIns[] = iType.getAdditionalInputs(); for(int j = 0; j < addlIns.length; j++){ IAdditionalInput a = addlIns[j]; - + a.setPaths("as;sd;fgl;fg;qw;er;ty;ui;op"); assertTrue(tool.needsRebuild()); assertTrue(cfg.needsRebuild()); @@ -2488,9 +2490,9 @@ public class BuildDescriptionModelTests extends TestCase { assertFalse(cfg.needsRebuild()); } } - + IOutputType oTypes[] = tool.getOutputTypes(); - + for(int i = 0; i < oTypes.length; i++){ IOutputType oType = oTypes[i]; @@ -2510,7 +2512,7 @@ public class BuildDescriptionModelTests extends TestCase { tool.setRebuildState(false); assertFalse(tool.needsRebuild()); assertFalse(cfg.needsRebuild()); - + oType.setNamePattern("qwerytuuioioyuioghjgfd"); assertTrue(tool.needsRebuild()); assertTrue(cfg.needsRebuild()); @@ -2547,7 +2549,7 @@ public class BuildDescriptionModelTests extends TestCase { assertFalse(cfg.needsRebuild()); } } - + public void testDesRebuildStateInDescription(){ IProject project = createProject(PREFIX + "1", "cdt.managedbuild.target.bdm.exe"); try { @@ -2555,34 +2557,34 @@ public class BuildDescriptionModelTests extends TestCase { } catch (CoreException e1) { fail("fail to add CC nature"); } - + ManagedBuildTestHelper.createFile(project, "a.c"); ManagedBuildTestHelper.createFile(project, "b.c"); ManagedBuildTestHelper.createFile(project, "c.cpp"); ManagedBuildTestHelper.createFile(project, "d/d.cpp"); ManagedBuildTestHelper.createFile(project, "d2/e.s2"); ManagedBuildTestHelper.createFile(project, "f.s2"); - + ManagedBuildTestHelper.createFile(project, "e.o"); ManagedBuildTestHelper.createFile(project, "dir/f.o"); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject mProj = info.getManagedProject(); Configuration cfg = (Configuration)mProj.getConfigurations()[0]; String out = cfg.getName() + "/"; - + cfg.setRebuildState(false); - + IBuildDescription des = null; try { des = BuildDescriptionManager.createBuildDescription(cfg, null, BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED | BuildDescriptionManager.DEPS); } catch (CoreException e) { fail("build description creation failed: " + e.getLocalizedMessage()); } - + IBuildResource rcs[] = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REBUILD); assertEquals(rcs.length, 0); - + rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REMOVED); assertEquals(rcs.length, 0); @@ -2591,7 +2593,7 @@ public class BuildDescriptionModelTests extends TestCase { //target ITool tool = cfg.calculateTargetTool(); - + tool.setToolCommand("fgdfgcvbcbv"); try { des = BuildDescriptionManager.createBuildDescription(cfg, null, BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED); @@ -2605,9 +2607,9 @@ public class BuildDescriptionModelTests extends TestCase { assertEquals(oRcs.length, 1); if(rcs[0] != oRcs[0]) fail("rebuild resources do not match"); - + targetRc = oRcs[0]; - + rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REMOVED); assertEquals(rcs.length, 0); @@ -2616,9 +2618,9 @@ public class BuildDescriptionModelTests extends TestCase { assertEquals(oRcs.length, 1); if(rcs[0] != oRcs[0]) fail("rebuild resources do not match"); - + cfg.setRebuildState(false); - + //cpp tool = getToolForInExt(cfg, "cpp"); tool.setToolCommand("sdfgzxcvzxcvzxv"); @@ -2642,13 +2644,13 @@ public class BuildDescriptionModelTests extends TestCase { assertNotNull(oRcs[0]); oRcs[4] = getResourceForProjPath(des, out + "b.o"); assertNotNull(oRcs[1]); - + assertEquals(rcs.length, 5); assertEquals(oRcs.length, 5); if(!resourcesEqual(rcs, oRcs)) fail("rebuild resources do not match"); - - + + rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REMOVED); assertEquals(rcs.length, 0); @@ -2656,9 +2658,9 @@ public class BuildDescriptionModelTests extends TestCase { assertEquals(rcs.length, 5); if(!resourcesEqual(rcs, oRcs)) fail("rebuild resources do not match"); - + cfg.setRebuildState(false); - + //s2 tool = getToolForInExt(cfg, "s2"); tool.setToolCommand("sdfgzxcvzxcvzxv"); @@ -2678,13 +2680,13 @@ public class BuildDescriptionModelTests extends TestCase { oRcs[1] = getResourceForProjPath(des, out + "f.o"); assertNotNull(oRcs[1]); oRcs[2] = targetRc; - + assertEquals(rcs.length, 3); assertEquals(oRcs.length, 3); if(!resourcesEqual(rcs, oRcs)) fail("rebuild resources do not match"); - - + + rcs = BuildDescriptionManager.filterGeneratedBuildResources(des.getResources(), BuildDescriptionManager.REMOVED); assertEquals(rcs.length, 0); @@ -2692,11 +2694,11 @@ public class BuildDescriptionModelTests extends TestCase { assertEquals(rcs.length, 3); if(!resourcesEqual(rcs, oRcs)) fail("rebuild resources do not match"); - + cfg.setRebuildState(false); - + } - + private IBuildResource getResourceForProjPath(IBuildDescription des, String path){ return getResourceForProjPath(des, new Path(path)); } @@ -2714,11 +2716,11 @@ public class BuildDescriptionModelTests extends TestCase { } return null; } - + private boolean resourcesEqual(IBuildResource rcs[], IBuildResource oRcs[]){ if(rcs.length != oRcs.length) return false; - + for(int j = 0; j < rcs.length; j++){ int k; for(k = 0; k < oRcs.length; k++){ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildFileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildFileGenerator.java index 4d392bd6d0f..cd45ee7b444 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildFileGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildFileGenerator.java @@ -11,8 +11,8 @@ package org.eclipse.cdt.managedbuilder.core.tests; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; -import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator; import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator; +import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceDelta; @@ -25,12 +25,13 @@ import org.eclipse.core.runtime.MultiStatus; * Test build file generator */ public class BuildFileGenerator implements IManagedBuilderMakefileGenerator { - + private IManagedBuilderMakefileGenerator defGen = new GnuMakefileGenerator(); /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#generateDependencies() */ + @Override public void generateDependencies() throws CoreException { defGen.generateDependencies(); } @@ -38,6 +39,7 @@ public class BuildFileGenerator implements IManagedBuilderMakefileGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#generateMakefiles(org.eclipse.core.resources.IResourceDelta) */ + @Override public MultiStatus generateMakefiles(IResourceDelta delta) throws CoreException { return defGen.generateMakefiles(delta); @@ -46,6 +48,7 @@ public class BuildFileGenerator implements IManagedBuilderMakefileGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#getBuildWorkingDir() */ + @Override public IPath getBuildWorkingDir() { IPath current = defGen.getBuildWorkingDir(); current.append("temp"); @@ -55,6 +58,7 @@ public class BuildFileGenerator implements IManagedBuilderMakefileGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#getMakefileName() */ + @Override public String getMakefileName() { return new String("TestBuildFile.mak"); } @@ -62,6 +66,7 @@ public class BuildFileGenerator implements IManagedBuilderMakefileGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#initialize(org.eclipse.core.resources.IProject, org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void initialize(IProject project, IManagedBuildInfo info, IProgressMonitor monitor) { defGen.initialize(project, info, monitor); @@ -70,6 +75,7 @@ public class BuildFileGenerator implements IManagedBuilderMakefileGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#isGeneratedResource(org.eclipse.core.resources.IResource) */ + @Override public boolean isGeneratedResource(IResource resource) { return defGen.isGeneratedResource(resource); } @@ -77,6 +83,7 @@ public class BuildFileGenerator implements IManagedBuilderMakefileGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#regenerateDependencies(boolean) */ + @Override public void regenerateDependencies(boolean force) throws CoreException { defGen.regenerateDependencies(force); } @@ -84,6 +91,7 @@ public class BuildFileGenerator implements IManagedBuilderMakefileGenerator { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#regenerateMakefiles() */ + @Override public MultiStatus regenerateMakefiles() throws CoreException { return defGen.regenerateMakefiles(); } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildSystem40Tests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildSystem40Tests.java index 15ab7e6a458..0fec09cc1e9 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildSystem40Tests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/BuildSystem40Tests.java @@ -52,22 +52,22 @@ public class BuildSystem40Tests extends TestCase { public static Test suite() { TestSuite suite = new TestSuite(BuildSystem40Tests.class); - + return suite; } - + private String platformDependentPath(String cfgFolder, String winPath) { if (!Platform.getOS().equals(Platform.OS_WIN32)) { return cfgFolder + '/' + winPath; } return winPath; } - + public void test40() throws Exception{ String[] makefiles = { - "makefile", - "objects.mk", - "sources.mk", + "makefile", + "objects.mk", + "sources.mk", "d1/subdir.mk", "d1/d2/subdir.mk", "d1/d2/d3/subdir.mk", @@ -92,11 +92,11 @@ public class BuildSystem40Tests extends TestCase { des.setActiveConfiguration(cfgDes); mngr.setProjectDescription(projects[0], des); buildProjects(projects, makefiles); - + des = mngr.getProjectDescription(projects[0]); cfgDes = des.getConfigurationByName("dbg 3"); IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes); - + ICFolderDescription foDes = cfgDes.getRootFolderDescription(); ICLanguageSetting ls = foDes.getLanguageSettingForFile("foo.cpp"); IFolderInfo foInfo = cfg.getRootFolderInfo(); @@ -113,18 +113,18 @@ public class BuildSystem40Tests extends TestCase { new CIncludePathEntry("/test_40", ICSettingEntry.VALUE_WORKSPACE_PATH/* | ICSettingEntry.RESOLVED*/), new CIncludePathEntry(platformDependentPath("dbg 3", "D:\\docs\\incs"), 0), }; - + assertTrue(Arrays.equals(entries, expectedEntries)); - + ls.setSettingEntries(ICSettingEntry.INCLUDE_PATH, entries); - + entries = ls.getSettingEntries(ICSettingEntry.INCLUDE_PATH); assertTrue(Arrays.equals(entries, expectedEntries)); option = tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]; OptionStringValue[] modifiedValue = option.getBasicStringListValueElements(); assertTrue(Arrays.equals(modifiedValue, value)); - + { List list = new ArrayList(); list.addAll(Arrays.asList(entries)); @@ -135,7 +135,7 @@ public class BuildSystem40Tests extends TestCase { entries = ls.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH); assertTrue(Arrays.equals(entries, expectedEntries)); } - + { ArrayList list = new ArrayList(); list.addAll(Arrays.asList(value)); @@ -145,16 +145,16 @@ public class BuildSystem40Tests extends TestCase { option = tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]; modifiedValue = option.getBasicStringListValueElements(); - + assertTrue(Arrays.equals(value, modifiedValue)); - + foDes = (ICFolderDescription)cfgDes.getResourceDescription(new Path("d1/d2"), true); foInfo = (IFolderInfo)cfg.getResourceInfo(new Path("d1/d2"), true); - + ls = foDes.getLanguageSettingForFile("foo.cpp"); tool = (Tool)foInfo.getToolFromInputExtension("cpp"); option = tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]; - + expectedEntries = new ICLanguageSettingEntry[] { new CIncludePathEntry("dbg 3/d2_rel/path", 0), new CIncludePathEntry("d2_proj/rel/path", 0), @@ -175,11 +175,11 @@ public class BuildSystem40Tests extends TestCase { new CIncludePathEntry(platformDependentPath("dbg 3", "D:\\d1_docs\\incs"), 0), new CIncludePathEntry(platformDependentPath("dbg 3", "D:\\d2_docs\\incs"), 0), }; - + entries = ls.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH); - + BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + OptionStringValue[] expectedValue = new OptionStringValue[] { new OptionStringValue("d2_rel/path"), new OptionStringValue("../d2_proj/rel/path"), @@ -188,25 +188,25 @@ public class BuildSystem40Tests extends TestCase { new OptionStringValue("${IncludeDefaults}"), new OptionStringValue("\"D:\\d2_docs\\incs\""), }; - + value = option.getBasicStringListValueElements(); BuildSystemTestHelper.checkDiff(expectedValue, value); - + ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, entries); value = option.getBasicStringListValueElements(); entries = ls.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH); BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + { ArrayList list = new ArrayList(Arrays.asList(entries)); list.remove(6); //new CIncludePathEntry("/d1_abs/path", 0), expectedEntries = list.toArray(new ICLanguageSettingEntry[0]); ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, list); } - + option = tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]; - + expectedValue = new OptionStringValue[] { new OptionStringValue("d2_rel/path"), new OptionStringValue("../d2_proj/rel/path"), @@ -227,10 +227,10 @@ public class BuildSystem40Tests extends TestCase { new OptionStringValue("\"D:\\d1_docs\\incs\""), new OptionStringValue("\"D:\\d2_docs\\incs\""), }; - + value = option.getBasicStringListValueElements(); BuildSystemTestHelper.checkDiff(expectedValue, value); - + entries = ls.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH); BuildSystemTestHelper.checkDiff(expectedEntries, entries); @@ -239,7 +239,7 @@ public class BuildSystem40Tests extends TestCase { ls = foDes.getLanguageSettingForFile("foo.cpp"); tool = (Tool)foInfo.getToolFromInputExtension("cpp"); option = tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]; - + { ArrayList list = new ArrayList(Arrays.asList(option.getBasicStringListValueElements())); assertTrue(list.remove(new OptionStringValue("${IncludeDefaults}"))); @@ -248,7 +248,7 @@ public class BuildSystem40Tests extends TestCase { option = foInfo.setOption(tool, option, list.toArray(new OptionStringValue[0])); value = option.getBasicStringListValueElements(); } - + expectedEntries = new ICLanguageSettingEntry[] { new CIncludePathEntry("dbg 3/rel/path", 0), new CIncludePathEntry("proj/rel/path", 0), @@ -259,22 +259,22 @@ public class BuildSystem40Tests extends TestCase { new CIncludePathEntry(platformDependentPath("dbg 3", "D:\\docs\\incs"), 0), new CIncludePathEntry(platformDependentPath("dbg 3", "E:\\tmp\\w"), 0), }; - - entries = ls.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH); - - BuildSystemTestHelper.checkDiff(expectedValue, value); - BuildSystemTestHelper.checkDiff(expectedEntries, entries); - - ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, entries); - - assertTrue(option == tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]); - value = option.getBasicStringListValueElements(); - + entries = ls.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH); BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + + ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, entries); + + assertTrue(option == tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]); + value = option.getBasicStringListValueElements(); + + entries = ls.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH); + + BuildSystemTestHelper.checkDiff(expectedValue, value); + BuildSystemTestHelper.checkDiff(expectedEntries, entries); + { ArrayList list = new ArrayList(Arrays.asList(option.getBasicStringListValueElements())); @@ -284,7 +284,7 @@ public class BuildSystem40Tests extends TestCase { option = foInfo.setOption(tool, option, list.toArray(new OptionStringValue[0])); value = option.getBasicStringListValueElements(); } - + expectedEntries = new ICLanguageSettingEntry[] { new CIncludePathEntry("dbg 3/rel/path", 0), new CIncludePathEntry("proj/rel/path", 0), @@ -295,30 +295,30 @@ public class BuildSystem40Tests extends TestCase { new CIncludePathEntry(platformDependentPath("dbg 3", "D:\\docs\\incs"), 0), new CIncludePathEntry(platformDependentPath("dbg 3", "E:\\tmp\\w"), 0), }; - + entries = ls.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH); - + BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, entries); - + assertTrue(option == tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]); value = option.getBasicStringListValueElements(); - + entries = ls.getSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH); BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + //deletion is performed in case if no fail occured for(int i = 0; i < projects.length; i++){ try { projects[i].delete(true, null); assertNull(mngr.getProjectDescription(projects[i])); assertNull(mngr.getProjectDescription(projects[i], false)); - + assertNull(ManagedBuildManager.getBuildInfo(projects[i])); } catch (Exception e) { System.err.println("Exception deleting a project " + projects[i].getName()); @@ -326,15 +326,15 @@ public class BuildSystem40Tests extends TestCase { } } } - + public void test40_pathconverter() throws Exception { IProject[] projects = createProjects("test_40_pathconverter", null, null, true); ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager(); - + ICProjectDescription des = mngr.getProjectDescription(projects[0]); ICConfigurationDescription cfgDes = des.getConfigurationByName("Test 4.0 ConfigName.Dbg"); IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes); - + ICFolderDescription foDes = cfgDes.getRootFolderDescription(); ICLanguageSetting ls = foDes.getLanguageSettingForFile("foo.cpp"); IFolderInfo foInfo = cfg.getRootFolderInfo(); @@ -342,78 +342,78 @@ public class BuildSystem40Tests extends TestCase { IOption option = tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]; OptionStringValue[] value = option.getBasicStringListValueElements(); ICLanguageSettingEntry[] entries = ls.getSettingEntries(ICSettingEntry.INCLUDE_PATH); - + OptionStringValue[] expectedValue = new OptionStringValue[] { new OptionStringValue("../rel"), new OptionStringValue("/abs"), }; - + ICLanguageSettingEntry[] expectedEntries = new ICLanguageSettingEntry[] { new CIncludePathEntry("rel", 0), new CIncludePathEntry("/test/abs", 0), }; - + BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, entries); assertTrue(option == tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]); value = option.getBasicStringListValueElements(); entries = ls.getSettingEntries(ICSettingEntry.INCLUDE_PATH); - + BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + ArrayList list = new ArrayList(); list.addAll(Arrays.asList(entries)); list.add(new CIncludePathEntry("/test/another/abs", 0)); expectedEntries = list.toArray(new ICLanguageSettingEntry[0]); - + expectedValue = new OptionStringValue[] { new OptionStringValue("../rel"), new OptionStringValue("/abs"), new OptionStringValue("/another/abs"), }; - + ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, list); - + assertTrue(option == tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]); - + value = option.getBasicStringListValueElements(); entries = ls.getSettingEntries(ICSettingEntry.INCLUDE_PATH); - + BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + //testing one-way converter ls = foDes.getLanguageSettingForFile("foo.c"); tool = (Tool)foInfo.getToolFromInputExtension("c"); option = tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]; value = option.getBasicStringListValueElements(); entries = ls.getSettingEntries(ICSettingEntry.INCLUDE_PATH); - + expectedValue = new OptionStringValue[] { new OptionStringValue("../rel"), new OptionStringValue("/abs"), }; - + expectedEntries = new ICLanguageSettingEntry[] { new CIncludePathEntry("rel", 0), new CIncludePathEntry("/test/abs", 0), }; - + BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, entries); assertTrue(option == tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]); value = option.getBasicStringListValueElements(); entries = ls.getSettingEntries(ICSettingEntry.INCLUDE_PATH); - + BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + list = new ArrayList(); list.addAll(Arrays.asList(entries)); list.add(new CIncludePathEntry("/another/abs", 0)); @@ -423,52 +423,52 @@ public class BuildSystem40Tests extends TestCase { new CIncludePathEntry("/test/abs", 0), new CIncludePathEntry("/test/another/abs", 0), }; - + expectedValue = new OptionStringValue[] { new OptionStringValue("../rel"), new OptionStringValue("/abs"), new OptionStringValue("/another/abs"), }; - + ls.setSettingEntries(ICLanguageSettingEntry.INCLUDE_PATH, list); - + assertTrue(option == tool.getOptionsOfType(IOption.INCLUDE_PATH)[0]); - + value = option.getBasicStringListValueElements(); entries = ls.getSettingEntries(ICSettingEntry.INCLUDE_PATH); - + BuildSystemTestHelper.checkDiff(expectedValue, value); BuildSystemTestHelper.checkDiff(expectedEntries, entries); - + //deletion is performed in case if no fail occured for(int i = 0; i < projects.length; i++){ projects[i].delete(true, null); assertNull(mngr.getProjectDescription(projects[i])); assertNull(mngr.getProjectDescription(projects[i], false)); - + assertNull(ManagedBuildManager.getBuildInfo(projects[i])); } } - + private void buildProjects(IProject projects[], String[] files) { buildProjectsWorker(projects, files, true); } - - private void buildProjectsWorker(IProject projects[], String[] files, boolean compareBenchmark) { + + private void buildProjectsWorker(IProject projects[], String[] files, boolean compareBenchmark) { if(projects == null || projects.length == 0) return; - + for (int i = 0; i < projects.length; i++){ IProject curProject = projects[i]; - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject); - + //check whether the managed build info is converted boolean isCompatible = true;//UpdateManagedProjectManager.isCompatibleProject(info); //assertTrue(isCompatible); - + if (isCompatible){ - // Build the project in order to generate the makefiles + // Build the project in order to generate the makefiles try{ curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,null); } @@ -478,7 +478,7 @@ public class BuildSystem40Tests extends TestCase { catch(OperationCanceledException e){ fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + e.getMessage()); } - + //compare the generated makefiles to their benchmarks if (files != null && files.length > 0) { if (i == 0) { @@ -492,13 +492,13 @@ public class BuildSystem40Tests extends TestCase { paths[ii] = buildDir.append(files[ii]); } ManagedBuildTestHelper.compareBenchmarks(curProject, buildLocationBase, paths, benchmarkLocationBase); - } + } } } } } } - + private IProject[] createProjects(String projName, IPath location, String projectTypeId, boolean containsZip) { IProject projects[] = createProject(projName, location, projectTypeId, containsZip); return projects; @@ -514,20 +514,21 @@ public class BuildSystem40Tests extends TestCase { } File projectZips[] = testDir.listFiles(new FileFilter(){ + @Override public boolean accept(File pathname){ if(pathname.isDirectory()) return false; return true; } }); - + projectList = new ArrayList(projectZips.length); for(int i = 0; i < projectZips.length; i++){ try{ String projectName = projectZips[i].getName(); if(!projectName.endsWith(".zip")) continue; - + projectName = projectName.substring(0,projectName.length()-".zip".length()); if(projectName.length() == 0) continue; @@ -550,7 +551,7 @@ public class BuildSystem40Tests extends TestCase { projectList.add(project); } catch(Exception e){} } - + return projectList.toArray(new IProject[projectList.size()]); } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/CmdLineApplicabilityCalculator.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/CmdLineApplicabilityCalculator.java index 94cfc30a918..e0836065f7c 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/CmdLineApplicabilityCalculator.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/CmdLineApplicabilityCalculator.java @@ -4,25 +4,26 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Texas Instruments Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.managedbuilder.core.tests; -import org.eclipse.cdt.managedbuilder.core.IHoldsOptions; import org.eclipse.cdt.managedbuilder.core.IBuildObject; +import org.eclipse.cdt.managedbuilder.core.IHoldsOptions; import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOptionApplicability; /** - * + * */ public class CmdLineApplicabilityCalculator implements IOptionApplicability { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionUsedInCommandLine() */ + @Override public boolean isOptionUsedInCommandLine( IBuildObject config, IHoldsOptions holder, @@ -33,6 +34,7 @@ public class CmdLineApplicabilityCalculator implements IOptionApplicability { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionVisible() */ + @Override public boolean isOptionVisible( IBuildObject config, IHoldsOptions holder, @@ -43,6 +45,7 @@ public class CmdLineApplicabilityCalculator implements IOptionApplicability { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionApplicability#isOptionEnabled() */ + @Override public boolean isOptionEnabled( IBuildObject config, IHoldsOptions holder, diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/CustomOptionCommandGenerator.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/CustomOptionCommandGenerator.java index 7aad898880c..c9b025538ef 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/CustomOptionCommandGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/CustomOptionCommandGenerator.java @@ -24,26 +24,27 @@ public class CustomOptionCommandGenerator implements IOptionCommandGenerator /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionCommandGenerator#generateCommand(org.eclipse.cdt.managedbuilder.core.IOption, org.eclipse.cdt.utils.cdtvariables.IVariableSubstitutor) */ + @Override public String generateCommand(IOption option, IVariableSubstitutor macroSubstitutor) { Object value = option.getValue(); - + if(value instanceof List) { try { String[] list = CdtVariableResolver.resolveStringListValues(option.getBasicStringListValue(), macroSubstitutor, true); if(list != null) { StringBuilder sb = new StringBuilder(); - + for(String entry : list) { sb.append(entry + ';'); } - + return option.getCommand() + '\"' + sb.toString() + '\"'; } } catch(Exception x) { } } - + return null; } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/DefaultFortranDependencyCalculator.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/DefaultFortranDependencyCalculator.java index 3ec3df0aab3..e2bf91bbf39 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/DefaultFortranDependencyCalculator.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/DefaultFortranDependencyCalculator.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM - Initial API and implementation *******************************************************************************/ @@ -41,7 +41,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen IManagedOutputNameProvider { public static final String MODULE_EXTENSION = "mod"; //$NON-NLS-1$ - + /* * Return a list of the names of all modules used by a file */ @@ -57,7 +57,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen st.slashSlashComments(false); st.slashStarComments(false); st.wordChars('_', '_'); - + while (st.nextToken() != StreamTokenizer.TT_EOF) { if (st.ttype == StreamTokenizer.TT_WORD) { if (st.sval.equalsIgnoreCase("use")) { @@ -81,7 +81,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen } return names.toArray(new String[names.size()]); } - + /* * Return a list of the names of all modules defined in a file */ @@ -97,7 +97,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen st.slashSlashComments(false); st.slashStarComments(false); st.wordChars('_', '_'); - + while (st.nextToken() != StreamTokenizer.TT_EOF) { if (st.ttype == StreamTokenizer.TT_WORD) { if (st.sval.equalsIgnoreCase("module")) { @@ -135,12 +135,12 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen } return false; } - + /* * Given a set of the module names used by a source file, and a set of resources to search, determine * if any of the source files implements the module names. */ - private IResource[] FindModulesInResources(IProject project, ITool tool, IResource resource, IResource[] resourcesToSearch, + private IResource[] FindModulesInResources(IProject project, ITool tool, IResource resource, IResource[] resourcesToSearch, String topBuildDir, String[] usedNames) { ArrayList modRes = new ArrayList(); for (int ir = 0; ir < resourcesToSearch.length; ir++) { @@ -156,8 +156,8 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen if (usedNames[iu].equalsIgnoreCase(modules[im])) { // Get the path to the module file that will be created by the build. By default, ifort appears // to generate .mod files in the directory from which the compiler is run. For MBS, this - // is the top-level build directory. - // TODO: Support the /module:path option and use that in determining the path of the module file + // is the top-level build directory. + // TODO: Support the /module:path option and use that in determining the path of the module file IPath modName = Path.fromOSString(topBuildDir + Path.SEPARATOR + modules[im] + "." + MODULE_EXTENSION); modRes.add(project.getFile(modName)); modRes.add(resourcesToSearch[ir]); @@ -170,7 +170,7 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen } } else if (resourcesToSearch[ir].getType() == IResource.FOLDER) { try { - IResource[] modFound = FindModulesInResources(project, tool, resource, ((IFolder)resourcesToSearch[ir]).members(), + IResource[] modFound = FindModulesInResources(project, tool, resource, ((IFolder)resourcesToSearch[ir]).members(), topBuildDir, usedNames); if (modFound != null) { for (int i=0; i dependencies = new ArrayList(); @@ -201,18 +202,18 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen break; } } - + File file = resource.getLocation().toFile(); try { if (!isFortranFile(tool, resource)) return null; - + // Get the names of the modules USE'd by the source file String[] usedNames = findUsedModuleNames(file); if (usedNames.length == 0) return null; - + // Search the project files for a Fortran source that creates the module. If we find one, then compiling this // source file is dependent upon first compiling the found source file. - IResource[] resources = project.members(); + IResource[] resources = project.members(); IResource[] modRes = FindModulesInResources(project, tool, resource, resources, config.getName(), usedNames); if (modRes != null) { for (int i=0; i outs = new ArrayList(); @@ -261,16 +265,16 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen for (int i = 0; i < modules.length; i++) { // Return the path to the module file that will be created by the build. By default, ifort appears // to generate .mod files in the directory from which the compiler is run. For MBS, this - // is the top-level build directory. + // is the top-level build directory. // TODO: Support the /module:path option and use that in determining the path of the module file - // TODO: The nameProvider documentation should note that the returned path is relative to the top-level + // TODO: The nameProvider documentation should note that the returned path is relative to the top-level // build directory. HOWEVER, if only a file name is returned, MBS will automatically add on the // directory path relative to the top-level build directory. The relative path comes from the source - // file location. In order to specify that this output file is always in the top-level build + // file location. In order to specify that this output file is always in the top-level build // directory, regardless of the source file directory structure, return "./path". IPath modName = new Path("./").append(Path.fromOSString(modules[i] + "." + MODULE_EXTENSION)); - - outs.add(modName); + + outs.add(modName); } } } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCommandLineGenerator.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCommandLineGenerator.java index b78f725a2a1..aff294d7c31 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCommandLineGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCommandLineGenerator.java @@ -24,6 +24,7 @@ public class ManagedBuildCommandLineGenerator implements /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator#generateCommandLineInfo(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String[], java.lang.String) */ + @Override public IManagedCommandLineInfo generateCommandLineInfo(ITool tool, String commandName, String[] flags, String outputFlag, String outputPrefix, String outputName, String[] inputResources, diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCommandLineInfo.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCommandLineInfo.java index 3a055548e46..b8b554d7938 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCommandLineInfo.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCommandLineInfo.java @@ -28,6 +28,7 @@ public class ManagedBuildCommandLineInfo implements IManagedCommandLineInfo { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getCommandLine() */ + @Override public String getCommandLine() { return commandLine; } @@ -35,6 +36,7 @@ public class ManagedBuildCommandLineInfo implements IManagedCommandLineInfo { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getCommandLinePattern() */ + @Override public String getCommandLinePattern() { return commandLinePattern; } @@ -42,6 +44,7 @@ public class ManagedBuildCommandLineInfo implements IManagedCommandLineInfo { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getCommandName() */ + @Override public String getCommandName() { return commandName; } @@ -49,6 +52,7 @@ public class ManagedBuildCommandLineInfo implements IManagedCommandLineInfo { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getFlags() */ + @Override public String getFlags() { return commandFlags; } @@ -56,6 +60,7 @@ public class ManagedBuildCommandLineInfo implements IManagedCommandLineInfo { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getInputs() */ + @Override public String getInputs() { return commandInputs; } @@ -63,6 +68,7 @@ public class ManagedBuildCommandLineInfo implements IManagedCommandLineInfo { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getOutput() */ + @Override public String getOutput() { return commandOutput; } @@ -70,6 +76,7 @@ public class ManagedBuildCommandLineInfo implements IManagedCommandLineInfo { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getOutputFlag() */ + @Override public String getOutputFlag() { return commandOutputFlag; } @@ -77,6 +84,7 @@ public class ManagedBuildCommandLineInfo implements IManagedCommandLineInfo { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getOutputPrefix() */ + @Override public String getOutputPrefix() { return commandOutputPrefix; } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java index b3ea80125a9..4d86f955298 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java @@ -56,7 +56,7 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; /* - * These tests exercise CDT 2.0 manifest file functionality + * These tests exercise CDT 2.0 manifest file functionality */ public class ManagedBuildCoreTests20 extends TestCase { private static final boolean boolVal = true; @@ -72,14 +72,14 @@ public class ManagedBuildCoreTests20 extends TestCase { private static final String stringVal = "-c -Wall"; private static final String anotherStringVal = "thevalue"; private static final String subExt = "bus"; - + public ManagedBuildCoreTests20(String name) { super(name); } - + public static Test suite() { TestSuite suite = new TestSuite(ManagedBuildCoreTests20.class.getName()); - + // Note that some of the tests are dependent on others so run the suite as a whole suite.addTest(new ManagedBuildCoreTests20("testExtensions")); suite.addTest(new ManagedBuildCoreTests20("testProjectCreation")); @@ -91,7 +91,7 @@ public class ManagedBuildCoreTests20 extends TestCase { suite.addTest(new ManagedBuildCoreTests20("testProjectRename")); suite.addTest(new ManagedBuildCoreTests20("testErrorParsers")); suite.addTest(new ManagedBuildCoreTests20("cleanup")); - + return suite; } @@ -107,13 +107,13 @@ public class ManagedBuildCoreTests20 extends TestCase { IProjectType testForwardParent = null; IProjectType testForwardGrandchild = null; int numTypes = 0; - + // Note secret null parameter which means just extensions IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes(); for (int i = 0; i < projTypes.length; ++i) { IProjectType type = projTypes[i]; - + if (type.getName().equals("Test Root")) { testRoot = type; checkRootProjectType(testRoot); @@ -139,10 +139,10 @@ public class ManagedBuildCoreTests20 extends TestCase { assertNotNull(testForwardParent); assertNotNull(testForwardGrandchild); checkForwardProjectTypes(testForwardParent, testForwardChild, testForwardGrandchild); - + // check that the proper number of projectTypes were dynamically provided assertEquals(3, numTypes); - + // All these project types are defines in the plugin files, so none // of them should be null at this point assertNotNull(testRoot); @@ -151,13 +151,13 @@ public class ManagedBuildCoreTests20 extends TestCase { } /** - * This test exercises the interface the IConfiguration exposes to manipulate + * This test exercises the interface the IConfiguration exposes to manipulate * its make command. */ public void testMakeCommandManipulation () { String oldMakeCmd = "make"; String newMakeCmd = "Ant"; - + // Open the test project IProject project = null; try { @@ -171,7 +171,7 @@ public class ManagedBuildCoreTests20 extends TestCase { fail("Failed to open project in 'testMakeCommandManipulation': " + e.getLocalizedMessage()); } assertNotNull(project); - + // Now get the default configuration IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); assertNotNull(info); @@ -179,25 +179,25 @@ public class ManagedBuildCoreTests20 extends TestCase { assertNotNull(managedProj); IConfiguration defaultConfig = info.getDefaultConfiguration(); assertNotNull(defaultConfig); - + // Does it have a default build command assertFalse(defaultConfig.hasOverriddenBuildCommand()); assertEquals(oldMakeCmd, defaultConfig.getBuildCommand()); - + // Change it defaultConfig.setBuildCommand(newMakeCmd); assertEquals(newMakeCmd, defaultConfig.getBuildCommand()); assertTrue(defaultConfig.hasOverriddenBuildCommand()); - + // Reset it defaultConfig.setBuildCommand(null); assertFalse(defaultConfig.hasOverriddenBuildCommand()); assertEquals(oldMakeCmd, defaultConfig.getBuildCommand()); - + ManagedBuildManager.saveBuildInfo(project, false); } - - + + /** * The purpose of this test is to exercise the build path info interface. * To get to that point, a new project/config has to be created in the test @@ -216,7 +216,7 @@ public class ManagedBuildCoreTests20 extends TestCase { } catch (CoreException e) { fail("Failed to open project in 'testScannerInfoInterface': " + e.getLocalizedMessage()); } - + //These are the expected path settings final String[] expectedPaths = new String[5]; @@ -230,11 +230,11 @@ public class ManagedBuildCoreTests20 extends TestCase { expectedPaths[2] = project.getLocation().append("Sub Config").append(path).toOSString(); expectedPaths[3] = project.getLocation().append( "includes" ).toOSString(); expectedPaths[4] = (new Path("/usr/gnu/include")).toOSString(); - + // Create a new managed project based on the sub project type IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub"); assertNotNull(projType); - + // Create the managed-project (.cdtbuild) for our project IManagedProject newProject = null; try { @@ -244,13 +244,13 @@ public class ManagedBuildCoreTests20 extends TestCase { } assertNotNull(newProject); ManagedBuildManager.setNewProjectVersion(project); - + // Copy over the configs IConfiguration[] baseConfigs = projType.getConfigurations(); for (int i = 0; i < baseConfigs.length; ++i) { newProject.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i); } - + // Change the default configuration to the sub config IConfiguration[] configs = newProject.getConfigurations(); assertEquals(4, configs.length); @@ -271,7 +271,7 @@ public class ManagedBuildCoreTests20 extends TestCase { fail("Failed on project open: " + e.getLocalizedMessage()); } buildInfo = ManagedBuildManager.getBuildInfo(project); - + // Use the plugin mechanism to discover the supplier of the path information IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID + ".ScannerInfoProvider"); if (extensionPoint == null) { @@ -281,12 +281,13 @@ public class ManagedBuildCoreTests20 extends TestCase { // Find the first IScannerInfoProvider that supplies build info for the project IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project); assertNotNull(provider); - + // Now subscribe (note that the method will be called after a change provider.subscribe(project, new IScannerInfoChangeListener () { + @Override public void changeNotification(IResource project, IScannerInfo info) { // Test the symbols: expect "BUILTIN" from the manifest, and "DEBUG" and "GNOME=ME" - // from the overidden settings + // from the overidden settings Map definedSymbols = info.getDefinedSymbols(); assertTrue(definedSymbols.containsKey("BUILTIN")); assertTrue(definedSymbols.containsKey("DEBUG")); @@ -303,12 +304,12 @@ public class ManagedBuildCoreTests20 extends TestCase { // Check the build information before we change it IScannerInfo currentSettings = provider.getScannerInformation(project); - + Map currentSymbols = currentSettings.getDefinedSymbols(); // It should simply contain the built-in assertTrue(currentSymbols.containsKey("BUILTIN")); assertEquals(currentSymbols.get("BUILTIN"), ""); - + String[] currentPaths = currentSettings.getIncludePaths(); BuildSystemTestHelper.checkDiff(expectedPaths, currentPaths); @@ -346,16 +347,16 @@ public class ManagedBuildCoreTests20 extends TestCase { info.setDirty(false); assertFalse(info.isDirty()); } - + /** * Create a new configuration based on one defined in the plugin file. - * Overrides all of the configuration settings. Saves, closes, and reopens + * Overrides all of the configuration settings. Saves, closes, and reopens * the project. Then calls a method to check the overridden options. - * + * * Tests creating a new configuration. * Tests setting options. * Tests persisting overridden options between project sessions. - * + * */ public void testConfigurations() throws CoreException, BuildException { final String rootName = "Root Config"; @@ -363,7 +364,7 @@ public class ManagedBuildCoreTests20 extends TestCase { final String completeOverrideName = "Complete Override Config"; final String toolCmd = "doIt"; final String newCmd = "never"; - + // Open the test project IProject project = createProject(projectName); IProjectDescription description = project.getDescription(); @@ -371,17 +372,17 @@ public class ManagedBuildCoreTests20 extends TestCase { if (description != null) { assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID)); } - + // Make sure there is a ManagedProject with 3 configs IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject managedProj = info.getManagedProject(); - IConfiguration[] definedConfigs = managedProj.getConfigurations(); + IConfiguration[] definedConfigs = managedProj.getConfigurations(); assertEquals(3, definedConfigs.length); IConfiguration baseConfig = definedConfigs[0]; assertEquals(definedConfigs[0].getName(), rootName); assertEquals(definedConfigs[1].getName(), overrideName); assertEquals(definedConfigs[2].getName(), completeOverrideName); - + // Create a new configuration and test the rename function IConfiguration newConfig = managedProj.createConfigurationClone(baseConfig, testConfigId); assertEquals(4, managedProj.getConfigurations().length); @@ -393,12 +394,12 @@ public class ManagedBuildCoreTests20 extends TestCase { ITool[] definedTools = newConfig.getTools(); assertEquals(1, definedTools.length); ITool rootTool = definedTools[0]; - + // Test changing its command assertEquals(rootTool.getToolCommand(), toolCmd); newConfig.setToolCommand(rootTool, newCmd); assertEquals(rootTool.getToolCommand(), newCmd); - + // Override options in the new configuration IOptionCategory topCategory = rootTool.getTopOptionCategory(); assertEquals("Root Tool", topCategory.getName()); @@ -437,20 +438,20 @@ public class ManagedBuildCoreTests20 extends TestCase { // Test the values in the new configuration checkOptionReferences(project); - + // Now delete the new configuration and test the managed project info = ManagedBuildManager.getBuildInfo(project); managedProj = info.getManagedProject(); - definedConfigs = managedProj.getConfigurations(); + definedConfigs = managedProj.getConfigurations(); assertEquals(4, definedConfigs.length); managedProj.removeConfiguration(testConfigId); - definedConfigs = managedProj.getConfigurations(); + definedConfigs = managedProj.getConfigurations(); assertEquals(3, definedConfigs.length); assertEquals(definedConfigs[0].getName(), rootName); assertEquals(definedConfigs[1].getName(), overrideName); ManagedBuildManager.saveBuildInfo(project, false); } - + public void testConfigurationReset() { // Open the test project IProject project = null; @@ -472,14 +473,14 @@ public class ManagedBuildCoreTests20 extends TestCase { assertNotNull(managedProj); IConfiguration defaultConfig = info.getDefaultConfiguration(); assertNotNull(defaultConfig); - + // See if it still contains the overridden values (see testProjectCreation()) try { checkRootManagedProject(managedProj, "z"); } catch (BuildException e1) { fail("Overridden root managed project check failed: " + e1.getLocalizedMessage()); } - + // Reset the config and retest ManagedBuildManager.resetConfiguration(project, defaultConfig); ManagedBuildManager.saveBuildInfo(project, false); @@ -489,7 +490,7 @@ public class ManagedBuildCoreTests20 extends TestCase { fail("Reset root managed project check failed: " + e2.getLocalizedMessage()); } } - + /** * @throws BuildException */ @@ -509,11 +510,11 @@ public class ManagedBuildCoreTests20 extends TestCase { } catch (CoreException e) { fail("Test failed on project creation: " + e.getLocalizedMessage()); } - + // Find the base project type definition IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.root"); assertNotNull(projType); - + // Create the managed-project (.cdtbuild) for our project that builds a dummy executable IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType); assertEquals(newProject.getName(), projType.getName()); @@ -524,7 +525,7 @@ public class ManagedBuildCoreTests20 extends TestCase { IConfiguration defaultConfig = null; IConfiguration[] configs = projType.getConfigurations(); for (int i = 0; i < configs.length; ++i) { - // Make the first configuration the default + // Make the first configuration the default if (i == 0) { defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i); } else { @@ -536,18 +537,18 @@ public class ManagedBuildCoreTests20 extends TestCase { String buildArtifactName = projectName; defaultConfig.setArtifactName(buildArtifactName); defaultConfig.setArtifactExtension(newExt); - + ManagedBuildManager.getBuildInfo(project).setValid(true); - + // Initialize the path entry container IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project); if (initResult.getCode() != IStatus.OK) { fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage()); } - + // Now test the results out checkRootManagedProject(newProject, "x"); - + // Override the "String Option in Category" option value configs = newProject.getConfigurations(); ITool[] tools = configs[0].getTools(); @@ -565,7 +566,7 @@ public class ManagedBuildCoreTests20 extends TestCase { tool = (ITool)options[0][0]; option = (IOption)options[0][1]; assertEquals("z", option.getStringValue()); - + // Save, close, reopen and test again ManagedBuildManager.saveBuildInfo(project, true); ManagedBuildManager.removeBuildInfo(project); @@ -579,24 +580,24 @@ public class ManagedBuildCoreTests20 extends TestCase { } catch (CoreException e) { fail("Failed on project open: " + e.getLocalizedMessage()); } - + // Test that the default config was remembered IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); assertEquals(defaultConfig.getId(), info.getDefaultConfiguration().getId()); // Check the rest of the default information checkRootManagedProject(newProject, "z"); - + // Now test the information the makefile builder needs checkBuildTestSettings(info); ManagedBuildManager.removeBuildInfo(project); } /** - * Tests that bugzilla 44159 has been addressed. After a project was renamed, the + * Tests that bugzilla 44159 has been addressed. After a project was renamed, the * build information mistakenly referred to the old project as its owner. This - * caused a number of searches on the information to fail. In this bug, it was the - * list of tools that could not be determined. In other cases, the information + * caused a number of searches on the information to fail. In this bug, it was the + * list of tools that could not be determined. In other cases, the information * retrieval caused NPEs because the old owner no longer existed. */ public void testProjectRename() { @@ -612,16 +613,16 @@ public class ManagedBuildCoreTests20 extends TestCase { } catch (CoreException e) { fail("Failed to open project: " + e.getLocalizedMessage()); } - + // Rename the project - IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); + IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IResource newResource = workspaceRoot.findMember(projectRename); if (newResource != null) { try { newResource.delete(IResource.KEEP_HISTORY, new NullProgressMonitor()); } catch (CoreException e) { fail("Failed to delete old project " + projectRename + ": " + e.getLocalizedMessage()); - } + } } IProjectDescription description = null; try { @@ -649,15 +650,15 @@ public class ManagedBuildCoreTests20 extends TestCase { // By now the project should have 3 configs IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject managedProj = info.getManagedProject(); - IConfiguration[] definedConfigs = managedProj.getConfigurations(); + IConfiguration[] definedConfigs = managedProj.getConfigurations(); assertEquals(4, definedConfigs.length); IConfiguration baseConfig = definedConfigs[1]; - + // There is only one tool ITool[] definedTools = baseConfig.getTools(); assertEquals(1, definedTools.length); ITool rootTool = definedTools[0]; - + // Get the options (2) in top category and (4) in its child IOptionCategory topCategory = rootTool.getTopOptionCategory(); assertEquals("Root Tool", topCategory.getName()); @@ -672,7 +673,7 @@ public class ManagedBuildCoreTests20 extends TestCase { for (i=0; iname or return the project in + * Create a new project named name or return the project in * the workspace of the same name if it exists. - * + * * @param name The name of the project to create or retrieve. - * @return + * @return * @throws CoreException */ private IProject createProject(String name) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IProject newProjectHandle = root.getProject(name); IProject project = null; - + if (!newProjectHandle.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription workspaceDesc = workspace.getDescription(); @@ -1699,6 +1700,7 @@ public class ManagedBuildCoreTests20 extends TestCase { } else { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -1707,19 +1709,19 @@ public class ManagedBuildCoreTests20 extends TestCase { workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor); project = newProjectHandle; } - + // Open the project if we have to if (!project.isOpen()) { project.open(new NullProgressMonitor()); } - - return project; + + return project; } - + /** - * Remove the IProject with the name specified in the argument from the + * Remove the IProject with the name specified in the argument from the * receiver's workspace. - * + * * @param name */ private void removeProject(String name) { @@ -1758,11 +1760,11 @@ public class ManagedBuildCoreTests20 extends TestCase { } catch (CoreException e) { fail("Test failed on error parser project creation: " + e.getLocalizedMessage()); } - + // Find the base project Type definition IProjectType projType = ManagedBuildManager.getProjectType("test.error.parsers"); assertNotNull(projType); - + // Create the target for our project that builds a dummy executable IManagedProject newProj = ManagedBuildManager.createManagedProject(project, projType); assertEquals(newProj.getName(), projType.getName()); @@ -1774,16 +1776,16 @@ public class ManagedBuildCoreTests20 extends TestCase { if (initResult.getCode() != IStatus.OK) { fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage()); } - + // Copy over the configs IConfiguration[] baseConfigs = projType.getConfigurations(); for (int i = 0; i < baseConfigs.length; ++i) { newProj.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i); } - + // Test this out checkErrorParsersProject(newProj); - + // Save, close, reopen and test again ManagedBuildManager.saveBuildInfo(project, true); ManagedBuildManager.removeBuildInfo(project); @@ -1797,7 +1799,7 @@ public class ManagedBuildCoreTests20 extends TestCase { } catch (CoreException e) { fail("Failed on error parser project open: " + e.getLocalizedMessage()); } - + // Test that the default config was remembered IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); @@ -1805,7 +1807,7 @@ public class ManagedBuildCoreTests20 extends TestCase { checkErrorParsersProject(info.getManagedProject()); ManagedBuildManager.removeBuildInfo(project); } - + /* * Do a sanity check on the error parsers target. */ @@ -1819,7 +1821,7 @@ public class ManagedBuildCoreTests20 extends TestCase { // This target defines errors parsers. Check that the error parsers // have been assigned. assertEquals("org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser", configs[0].getErrorParserIds()); - + // Tool ITool[] tools = configs[0].getTools(); ITool rootTool = tools[0]; @@ -1835,7 +1837,7 @@ public class ManagedBuildCoreTests20 extends TestCase { // There should be one defined configs assertEquals(1, configs.length); } - + /** * Test that the build artifact of a ITarget can be modified * programmatically. @@ -1849,12 +1851,12 @@ public class ManagedBuildCoreTests20 extends TestCase { assertNotNull(managedProj); IConfiguration defaultConfig = info.getDefaultConfiguration(); assertNotNull(defaultConfig); - + // Set the build artifact of the configuration String ext = defaultConfig.getArtifactExtension(); String name = project.getName() + "." + ext; defaultConfig.setArtifactName(name); - + // Save, close, reopen and test again ManagedBuildManager.saveBuildInfo(project, false); ManagedBuildManager.removeBuildInfo(project); @@ -1874,6 +1876,6 @@ public class ManagedBuildCoreTests20 extends TestCase { public void testThatAlwaysFails() { assertTrue(false); } - + } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests_SharedToolOptions.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests_SharedToolOptions.java index 70ffea4853f..2d242928f73 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests_SharedToolOptions.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests_SharedToolOptions.java @@ -50,7 +50,7 @@ import org.eclipse.core.runtime.Platform; // TODO LK - do not deprecate IOption.getParent() as suggested by Leo /* - * These tests exercise CDT 3.0 shared tool options extensions + * These tests exercise CDT 3.0 shared tool options extensions */ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { @@ -61,31 +61,31 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { // The following uses a numbering scheme defined for // testCategory and testOption - + // Co-ordinates of option groups 2nd level that have icon 1 int One_i[] = { 3, 2, 4, 7 }; int One_j[] = { 1, 2, 1, 1 }; // Co-ordinates of option groups 2nd level that have icon 1 int Two_i[] = { 2, 6 }; int Two_j[] = { 1, 1 }; - + IconComparator() { assertEquals(One_i.length, One_j.length); - assertEquals(Two_i.length, Two_j.length); + assertEquals(Two_i.length, Two_j.length); } - + int Compare(int i, int j) { int k; - + // Check for icon 1 for (k=0; k < One_i.length; k++) { if ( (i == One_i[k]) && (j == One_j[k]) ) { return One; - } + } } // Check for icon 2 for (k=0; k < Two_i.length; k++) @@ -93,12 +93,12 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { if ( (i == Two_i[k]) && (j == Two_j[k]) ) { return Two; - } + } } // None of them return None; } - } + } class ValueHandlerComparator { static final int MBS = 0; @@ -106,40 +106,40 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { // The following uses a numbering scheme defined for // testCategory and testOption - + // Co-ordinates of option groups 2nd level that have a test value handler int Test_i[] = { 2, 2, 3, 5, 7 }; int Test_j[] = { 1, 4, 2, 1, 1 }; String Test_arg[] = { "Option2.1.1", "Option2.2.2", "Option3.1.2", "Option5.1", "Option7.1" }; String last_arg; - + ValueHandlerComparator() { assertEquals(Test_i.length, Test_j.length); assertEquals(Test_i.length, Test_arg.length); last_arg = ""; } - + int Compare(int i, int j) { int k; - + // Check for Test handler for (k=0; k < Test_i.length; k++) { if ( (i == Test_i[k]) && (j == Test_j[k]) ) { last_arg = Test_arg[k]; return TEST; - } + } } // None of them last_arg = ""; - return MBS; + return MBS; } - + String getArg() { return last_arg; } - } - + } + // Constants private final String projectName = "test30_sto"; private final String projectID = "test30_sto.dummy"; @@ -149,48 +149,48 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { // Control variables private boolean testExtensionElements = true; private boolean testIsSetup = false; - - // Chain leading to tool, etc + + // Chain leading to tool, etc private IProjectType testProject; - private IConfiguration testConfig; + private IConfiguration testConfig; private IToolChain testToolChain; - + // Direct children of toolChain private ITool testTools[]; private IOptionCategory testCategoryTop[]; private IOption testOptionTop[]; - + // 2nd level children (of toolChain and tool) mapped in the following pattern // onto the arrays: // tool_1: cat_1.1 cat_1.2 cat_1.3 ... // ... - // tool_n: cat_n.1 catn.2 + // tool_n: cat_n.1 catn.2 // The same 2d-array is used to store top-level categories // n+1: topcat_1 // ... // n+m: topcat_m private Object testCategory[][]; - private Object testOption[][]; - + private Object testOption[][]; + // Helper classes private IconComparator iconComparator; private ValueHandlerComparator valueHandlerComparator; - + public ManagedBuildCoreTests_SharedToolOptions(String name) { super(name); - + iconComparator = new IconComparator(); valueHandlerComparator = new ValueHandlerComparator(); } - + public static Test suite() { TestSuite suite = new TestSuite(ManagedBuildCoreTests_SharedToolOptions.class.getName()); - + suite.addTest(new ManagedBuildCoreTests_SharedToolOptions("testIcons")); suite.addTest(new ManagedBuildCoreTests_SharedToolOptions("testValueHandlers")); suite.addTest(new ManagedBuildCoreTests_SharedToolOptions("testOptions")); suite.addTest(new ManagedBuildCoreTests_SharedToolOptions("testConfiguration")); - + return suite; } @@ -200,15 +200,15 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { assertTrue(s1.equals(s2)); } else { // Compare for non-extension element Id's - assertTrue(s1.startsWith(s2+".")); + assertTrue(s1.startsWith(s2+".")); } } - + private IProject createProject(String name) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IProject newProjectHandle = root.getProject(name); IProject project = null; - + if (!newProjectHandle.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription workspaceDesc = workspace.getDescription(); @@ -220,6 +220,7 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { } else { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -228,56 +229,56 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor); project = newProjectHandle; } - + // Open the project if we have to if (!project.isOpen()) { project.open(new NullProgressMonitor()); } - - return project; + + return project; } - + /** * Sets up the test environment for the default project */ private void setupDefaultProject() throws Exception { - // The assertCorrectId() call needs to be set up + // The assertCorrectId() call needs to be set up testExtensionElements = true; - // Get all the key structures of our test and do some sanity checking + // Get all the key structures of our test and do some sanity checking // testProject = ManagedBuildManager.getProjectType(projectID); - assertNotNull(testProject); + assertNotNull(testProject); assertTrue(testProject.isTestProjectType()); assertFalse(testProject.isAbstract()); - + // Get and check project configurations - only one // setupConfiguration(); assertTrue(testConfig.isExtensionElement()); } - + /** * Sets up the test configuration from the project set * in the test */ private void setupConfiguration() throws Exception { - + IConfiguration[] configs = testProject.getConfigurations(); assertNotNull(configs); assertEquals(configs.length, 1); - testConfig = configs[0]; - assertEquals(testConfig.getId(), configID); - assertEquals(testConfig.getName(), configName); + testConfig = configs[0]; + assertEquals(testConfig.getId(), configID); + assertEquals(testConfig.getName(), configName); } - + /** * Sets up the test environment for a project created from the * default project */ private void setupProject() throws Exception { - // The assertCorrectId() call needs to be set up + // The assertCorrectId() call needs to be set up testExtensionElements = false; // Create new project IProject project = null; @@ -297,7 +298,7 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { // Find the base project type definition IProjectType projType = ManagedBuildManager.getProjectType(projectID); assertNotNull(projType); - // Create a managed project + // Create a managed project IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType); assertEquals(newProject.getName(), projType.getName()); assertFalse(newProject.equals(projType)); @@ -307,15 +308,15 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { IConfiguration config = testProject.getConfiguration(configID); testConfig = newProject.createConfiguration(config, configID + ".12345678"); } - + /** * Sets up the test environment and does some initial checking. * Do not do this in the constructor, as it is part of the test. */ private void setupTestEnvironment() throws Exception { - + int i; - + // Test ID's // // String configID = "test30_sto.dummy.config"; @@ -326,19 +327,19 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { int numTools = 4; String toolIDs = "test30_sto.dummy.tool."; int firstToolID = 1; - // Top level option categories and groups + // Top level option categories and groups // int numTopCategories = 3; String topCategoryIDs = "test30_sto.dummy.category."; int firstTopCategoryID = 5; - + // Sizes of some arrays int sizeCategoryTop = 0; int sizeOptionTop = 0; - int sizeTools = 0; - + int sizeTools = 0; + // Fetch toolchain // - testToolChain = testConfig.getToolChain(); + testToolChain = testConfig.getToolChain(); assertNotNull(testToolChain); assertEquals(testToolChain.getName(), toolChainName); assertCorrectId(testToolChain.getId(), toolChainID); @@ -354,12 +355,12 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { assertCorrectId(testTools[i].getId(), toolIDs+toolNo); toolNo++; } - + // Fetch and check top level option categories and options // testCategoryTop = testToolChain.getChildCategories(); testOptionTop = testToolChain.getOptions(); - + if (testCategoryTop != null) { int categoryNo = firstTopCategoryID; sizeCategoryTop = testCategoryTop.length; @@ -378,7 +379,7 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { // Fetch and check 2nd level level option categories and options // testCategory = new Object[testTools.length+sizeCategoryTop][]; - testOption = new Object[testTools.length+sizeOptionTop][]; + testOption = new Object[testTools.length+sizeOptionTop][]; for (i=0; i < sizeTools; i++) { testCategory[i] = testTools[i].getChildCategories(); testOption[i] = testTools[i].getOptions(); @@ -387,34 +388,34 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { testCategory[i] = new Object[0]; } if ( testOption[i] == null ) { - testOption[i] = new Object[0]; - } + testOption[i] = new Object[0]; + } } // Add top level categories and options to test arrays // for (i=0; i < sizeCategoryTop; i++) { testCategory[sizeTools+i] = new Object[1]; - testCategory[sizeTools+i][0] = testCategoryTop[i]; + testCategory[sizeTools+i][0] = testCategoryTop[i]; } for (i=0; i < sizeOptionTop; i++) { testOption[sizeTools+i] = new Object[1]; - testOption[sizeTools+i][0] = testOptionTop[i]; + testOption[sizeTools+i][0] = testOptionTop[i]; } } - + /** * Check, whether icon paths in tool1 - tool3 have been created. * Check, whether icon paths in category 2.1 - 3.1 have been created */ public void testIcons() throws Exception { - + // Set up the environment if ( testIsSetup == false ) { setupDefaultProject(); setupTestEnvironment(); } - - // Get path's of icons to compare against + + // Get path's of icons to compare against CTestPlugin me = CTestPlugin.getDefault(); URL icon1 = Platform.asLocalURL( me.find(new Path("icons/one.gif"), null)); URL icon2 = Platform.asLocalURL( me.find(new Path("icons/two.gif"), null)); @@ -423,11 +424,11 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { assertToolIcon(testTools[0], icon1); assertToolIcon(testTools[1], null); assertToolIcon(testTools[2], icon2); - + // Check the top level and 2nd level categories int i; for (i=0; i < testCategory.length; i++) { - + int j; for (j=0; j < testCategory[i].length; j++) { URL url = ((IOptionCategory)testCategory[i][j]).getIconPath(); @@ -444,36 +445,36 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { break; } } - } + } } - + private void assertToolIcon(ITool tool, URL url) { - assertTrue(tool instanceof IOptionCategory); + assertTrue(tool instanceof IOptionCategory); IOptionCategory toolCategory = (IOptionCategory)tool; assertEquals(toolCategory.getIconPath(), url); } - + /** * Test whether option objects have value handlers as expected */ public void testValueHandlers() throws Exception { - + // Set up the environment if ( testIsSetup == false ) { setupDefaultProject(); setupTestEnvironment(); } - + int i; for (i=0; i < testOption.length; i++) { - + int j; for (j=0; j < testOption[i].length; j++) { IOption option = (IOption)testOption[i][j]; IManagedOptionValueHandler handler = option.getValueHandler(); String handlerExtraArg = option.getValueHandlerExtraArgument(); - + switch ( valueHandlerComparator.Compare(i+1, j+1) ) { case ValueHandlerComparator.MBS: assertEquals(ManagedOptionValueHandler.getManagedOptionValueHandler(), handler); @@ -484,14 +485,14 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { break; } } - } + } } - + /** * Test whether OptionCatgeory.getOptions(IConfiguration) works as expected */ public void testOptions() throws Exception { - + // Set up the environment if ( testIsSetup == false ) { setupDefaultProject(); @@ -501,10 +502,10 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { int i; int j; Object[][] results; - for (i=0; i < testCategory.length; i++) { + for (i=0; i < testCategory.length; i++) { for (j=0; j < testCategory[i].length; j++) { results = ((IOptionCategory)testCategory[i][j]).getOptions(testConfig); - // Go over results and check the following: + // Go over results and check the following: // A) results[k][0] must be the parent tool or toolChain // B) results[k][1] must be in testOption[i] for (int k=0; k < results[0].length; k++) { @@ -527,7 +528,7 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { assertTrue(results[k][0] instanceof IToolChain); assertEquals(results[k][0], testToolChain); break; - } + } // B) results[k][1] must be in testOption[i] // and its parent must be testCategory[i][j] boolean found = false; @@ -542,22 +543,22 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase { assertEquals(((IOption)results[k][1]).getCategory(), testCategory[i][j]); } } - } + } } - + /** - * Test whether all the other tests work as expected for + * Test whether all the other tests work as expected for * non-extension configurations. */ public void testConfiguration() throws Exception { - + // Set up the environment setupProject(); setupTestEnvironment(); // Rerun the other tests, without setting the test up again - testIsSetup = true; + testIsSetup = true; testIcons(); testValueHandlers(); testOptions(); - } + } } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyCalculatorTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyCalculatorTests.java old mode 100755 new mode 100644 index b796f29ccde..3ee59d21068 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyCalculatorTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyCalculatorTests.java @@ -38,14 +38,14 @@ import org.eclipse.ui.dialogs.IOverwriteQuery; public class ManagedBuildDependencyCalculatorTests extends TestCase { private IPath resourcesLocation = new Path(CTestPlugin.getFileInPlugin(new Path("resources/depCalcProjects/")).getAbsolutePath()); - + public ManagedBuildDependencyCalculatorTests(String name) { super(name); } - + public static Test suite() { TestSuite suite = new TestSuite(ManagedBuildDependencyCalculatorTests.class.getName()); - + suite.addTest(new ManagedBuildDependencyCalculatorTests("test1DepCalc2")); suite.addTest(new ManagedBuildDependencyCalculatorTests("test1DepCalc3")); suite.addTest(new ManagedBuildDependencyCalculatorTests("test1DepCalcPreBuild")); @@ -62,20 +62,21 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase { } File projectZips[] = testDir.listFiles(new FileFilter(){ + @Override public boolean accept(File pathname){ if(pathname.isDirectory()) return false; return true; } }); - + projectList = new ArrayList(projectZips.length); for(int i = 0; i < projectZips.length; i++){ try{ String projectName = projectZips[i].getName(); if(!projectName.endsWith(".zip")) continue; - + projectName = projectName.substring(0,projectName.length()-".zip".length()); if(projectName.length() == 0) continue; @@ -98,41 +99,42 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase { projectList.add(project); } catch(Exception e){} } - + return projectList.toArray(new IProject[projectList.size()]); } - + private IProject[] createProjects(String projName, IPath location, String projectTypeId, boolean containsZip) { - + // In case the projects need to be updated... IOverwriteQuery queryALL = new IOverwriteQuery(){ + @Override public String queryOverwrite(String file) { return ALL; }}; - + UpdateManagedProjectManager.setBackupFileOverwriteQuery(queryALL); UpdateManagedProjectManager.setUpdateProjectQuery(queryALL); - + IProject projects[] = createProject(projName, location, projectTypeId, containsZip); return projects; } - - private void buildProjectsWorker(IProject projects[], IPath[] files, boolean compareBenchmark) { + + private void buildProjectsWorker(IProject projects[], IPath[] files, boolean compareBenchmark) { if(projects == null || projects.length == 0) return; - + boolean succeeded = true; for (int i = 0; i < projects.length; i++){ IProject curProject = projects[i]; - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject); - + //check whether the managed build info is converted boolean isCompatible = UpdateManagedProjectManager.isCompatibleProject(info); assertTrue(isCompatible); - + if (isCompatible){ - // Build the project in order to generate the makefiles + // Build the project in order to generate the makefiles try{ curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,null); } @@ -142,7 +144,7 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase { catch(OperationCanceledException e){ fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + e.getMessage()); } - + //compare the generated makefiles to their benchmarks if (files != null && files.length > 0) { if (i == 0) { @@ -159,7 +161,7 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase { } } } - + if (succeeded) { // Otherwise leave the projects around for comparison for (int i = 0; i < projects.length; i++) ManagedBuildTestHelper.removeProject(projects[i].getName()); @@ -170,16 +172,16 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase { private void buildProjects(IProject projects[], IPath[] files) { buildProjectsWorker(projects, files, true); } - + /* (non-Javadoc) * test for dependency calculation as a side-effect of compilation */ public void test1DepCalc2(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), // This file is different using Cygwin vs GCC //Path.fromOSString("main.d"), @@ -192,16 +194,16 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase { IProject[] projects = createProjects("test1DepCalc2", null, null, true); buildProjects(projects, makefiles); } - + /* (non-Javadoc) * test for dependency calculation using Echo, a 2nd conmpilation step, and post-processing */ public void test1DepCalc3(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), // This file is different using Cygwin vs GCC //Path.fromOSString("main.d"), @@ -214,16 +216,16 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase { IProject[] projects = createProjects("test1DepCalc3", null, null, true); buildProjects(projects, makefiles); } - + /* (non-Javadoc) * test for dependency calculation that uses a separate, pre-build, step to generate dependency files */ public void test1DepCalcPreBuild(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), // This file is different using Cygwin vs GCC //Path.fromOSString("main.d"), @@ -236,5 +238,5 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase { IProject[] projects = createProjects("test1DepCalcPreBuild", null, null, true); buildProjects(projects, makefiles); } - + } \ No newline at end of file diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildEnvironmentTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildEnvironmentTests.java index 83bf5727cbf..d45a4f12724 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildEnvironmentTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildEnvironmentTests.java @@ -25,7 +25,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; /** - * + * * */ public class ManagedBuildEnvironmentTests extends TestCase { // final private String REQUIRED_TYPE = "cdt.managedbuild.target.testgnu.exe"; //$NON-NLS-1$ @@ -45,34 +45,35 @@ public class ManagedBuildEnvironmentTests extends TestCase { // test variable values final private String VAL_CWDPWD = "CWD_&_PWD_should not be changed"; //$NON-NLS-1$ // final private String VAL_DUMMY1 = "/a/b/c"; //$NON-NLS-1$ -// final private String VAL_DUMMY2 = "/d/e/f"; //$NON-NLS-1$ +// final private String VAL_DUMMY2 = "/d/e/f"; //$NON-NLS-1$ final private String VAL_PRO_INC = "/project/inc"; //$NON-NLS-1$ final private String VAL_PRO_LIB = "/project/lib"; //$NON-NLS-1$ - + // final private String LISTENER_DATA = "O1T1O1O2T2T1O1T1O2T2"; //$NON-NLS-1$ - + // delimiters final private String DEL_WIN = ";"; //$NON-NLS-1$ final private String DEL_UNIX = ":"; //$NON-NLS-1$ - + IEnvironmentVariableProvider envProvider = null; IWorkspace worksp = null; IProject proj = null; IManagedProject mproj = null; String listenerResult = ""; //$NON-NLS-1$ - + IEnvironmentBuildPathsChangeListener listener = new IEnvironmentBuildPathsChangeListener(){ + @Override public void buildPathsChanged(IConfiguration configuration, int buildPathType){ listenerResult = listenerResult + configuration.getName().charAt(0) + buildPathType; } }; - + public ManagedBuildEnvironmentTests() { super(); } public ManagedBuildEnvironmentTests(String name) { super(name); } - + public static Test suite() { TestSuite suite = new TestSuite(ManagedBuildEnvironmentTests.class/*.getName()*/); -// suite.addTest(new ManagedBuildEnvironmentTests("testEnvNotDef")); //$NON-NLS-1$ +// suite.addTest(new ManagedBuildEnvironmentTests("testEnvNotDef")); //$NON-NLS-1$ // suite.addTest(new ManagedBuildEnvironmentTests("testEnvUpper")); //$NON-NLS-1$ // suite.addTest(new ManagedBuildEnvironmentTests("testEnvAppend")); //$NON-NLS-1$ // suite.addTest(new ManagedBuildEnvironmentTests("testEnvCWDPWD")); //$NON-NLS-1$ @@ -84,8 +85,8 @@ public class ManagedBuildEnvironmentTests extends TestCase { // suite.addTest(new ManagedBuildEnvironmentTests("testEnvProvider")); //$NON-NLS-1$ return suite; } - - // Checking behaviour when vars are not defined (except system) + + // Checking behaviour when vars are not defined (except system) public void testEnvNotDef(){ doInit(); assertNotNull("System vars", envProvider.getVariables(null, true, false)); //$NON-NLS-1$ @@ -94,13 +95,13 @@ public class ManagedBuildEnvironmentTests extends TestCase { IConfiguration[] cfgs = mproj.getConfigurations(); for (int k=0; k - ... + ... @@ -218,11 +219,11 @@ public class ManagedBuildEnvironmentTests extends TestCase { pathType="buildpathLibrary" variableList="CFGL,PRJL"> - ... + ... @@ -235,7 +236,7 @@ public class ManagedBuildEnvironmentTests extends TestCase { public void rm_testEnvGetPath(){ doInit(); IConfiguration[] configs = mproj.getConfigurations(); - + for (int i=0; i<2; i++) { // only 2 first configs are affected String[] val_inc = {"/config/include/"+i, "/config"+i+"/include", VAL_PRO_INC}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ String[] val_lib = {"/config/lib/"+i, VAL_PRO_LIB}; //$NON-NLS-1$ @@ -255,16 +256,16 @@ public class ManagedBuildEnvironmentTests extends TestCase { compareStringLists(configs[i].getName()+"-library", s2, val_lib); //$NON-NLS-1$ } } - + // public void testEnvSubscribe(){ // doInit(); // IConfiguration[] configs = mproj.getConfigurations(); -// +// // IConfiguration cfg = configs[0]; // UserDefinedEnvironmentSupplier usup = getSupplier(cfg, cfg.getName()); -// assertNotNull(usup); +// assertNotNull(usup); // try { -// +// // usup.deleteVariable(NAME_CFGI,configs[0]); // usup.deleteVariable(NAME_CFGI,configs[1]); // usup.deleteVariable(NAME_CFG+"0",configs[0]); @@ -277,7 +278,7 @@ public class ManagedBuildEnvironmentTests extends TestCase { // usup.deleteVariable(NAME_PRJL,mproj); // usup.deleteVariable(NAME_CFGX,mproj); // listenerResult = ""; //$NON-NLS-1$ -// +// // envProvider.subscribe(listener); // // should affect config Deb // usup.createVariable(NAME_CFGI,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[0]); @@ -285,11 +286,11 @@ public class ManagedBuildEnvironmentTests extends TestCase { // // should affect config Rel // usup.createVariable(NAME_CFGI,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); // assertEquals("Step 2", listenerResult, LISTENER_DATA.substring(0,4)); //$NON-NLS-1$ -// +// // // should affect config Deb // usup.createVariable(NAME_CFG+"0",VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[0]); //$NON-NLS-1$ // assertEquals("Step 3", listenerResult, LISTENER_DATA.substring(0,6)); //$NON-NLS-1$ -// // should not affect anything - variable not in path of cfg 0 +// // should not affect anything - variable not in path of cfg 0 // usup.createVariable(NAME_CFG+"1",VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[0]); //$NON-NLS-1$ // assertEquals("Step 4", listenerResult, LISTENER_DATA.substring(0,6)); //$NON-NLS-1$ // @@ -299,14 +300,14 @@ public class ManagedBuildEnvironmentTests extends TestCase { // // should affect config Rel // usup.createVariable(NAME_CFGL,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); // assertEquals("Step 6", listenerResult, LISTENER_DATA.substring(0,10)); //$NON-NLS-1$ -// -// // should not affect anything - variable not in path of cfg 1 +// +// // should not affect anything - variable not in path of cfg 1 // usup.createVariable(NAME_CFG+"0",VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); //$NON-NLS-1$ // assertEquals("Step 7", listenerResult, LISTENER_DATA.substring(0,10)); //$NON-NLS-1$ -// // should affect config Rel +// // should affect config Rel // usup.createVariable(NAME_CFG+"1",VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); //$NON-NLS-1$ // assertEquals("Step 8", listenerResult, LISTENER_DATA.substring(0,12)); //$NON-NLS-1$ -// +// // // should affect both configurations // usup.createVariable(NAME_PRJI,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, mproj); // assertEquals("Step 9", listenerResult, LISTENER_DATA.substring(0,16)); //$NON-NLS-1$ @@ -314,11 +315,11 @@ public class ManagedBuildEnvironmentTests extends TestCase { // usup.createVariable(NAME_PRJL,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, mproj); // assertEquals("Step 10", listenerResult, LISTENER_DATA); //$NON-NLS-1$ // -// +// // // should not affect anything - no changes // usup.createVariable(NAME_PRJL,VAL_DUMMY2,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, mproj); // assertEquals("Step 11", listenerResult, LISTENER_DATA); //$NON-NLS-1$ -// // should not affect anything - variable not in path +// // should not affect anything - variable not in path // usup.createVariable(NAME_CFGX,VAL_DUMMY2, IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, mproj); // assertEquals("Step 12", listenerResult, LISTENER_DATA); //$NON-NLS-1$ // @@ -329,14 +330,14 @@ public class ManagedBuildEnvironmentTests extends TestCase { // usup.createVariable(NAME_CFGI,VAL_DUMMY1,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[0]); // usup.createVariable(NAME_CFGI,VAL_DUMMY1,IBuildEnvironmentVariable.ENVVAR_REPLACE, DEL_UNIX, configs[1]); // assertEquals("Step 13", listenerResult, LISTENER_DATA); //$NON-NLS-1$ -// +// // } catch (Exception e) { // fail("Failed to create configuration vars !"); //$NON-NLS-1$ // } // } - + /** - * + * * */ public void testEnvGetParams(){ @@ -347,7 +348,7 @@ public class ManagedBuildEnvironmentTests extends TestCase { if (System.getProperty("os.name").toLowerCase().startsWith("windows")) { //$NON-NLS-1$ //$NON-NLS-2$ assertEquals(envProvider.getDefaultDelimiter(), DEL_WIN); assertFalse(envProvider.isVariableCaseSensitive()); - // these var instances are different although contents is equal. + // these var instances are different although contents is equal. x = envProvider.getVariable("PATH", mproj.getConfigurations()[0], true, false); assertNotNull(x); y = envProvider.getVariable("path", mproj.getConfigurations()[0], true, false); @@ -357,24 +358,24 @@ public class ManagedBuildEnvironmentTests extends TestCase { } else { assertEquals(envProvider.getDefaultDelimiter(), DEL_UNIX); assertTrue(envProvider.isVariableCaseSensitive()); - // "path" is different var (may absent); + // "path" is different var (may absent); x = envProvider.getVariable("PATH", mproj.getConfigurations()[0], true, false); assertNotNull(x); y = envProvider.getVariable("path", mproj.getConfigurations()[0], true, false); if (y != null) { assertFalse(x.getName().equals(y.getName())); } - } + } } /** - * + * * */ // public void testEnvRemove(){ // doInit(); // IEnvironmentVariableProvider env = ManagedBuildManager.getEnvironmentVariableProvider(); // UserDefinedEnvironmentSupplier usup = null; -// +// // // create vars for removal tests // assertNotNull(usup = getSupplier(worksp, "Workspace")); //$NON-NLS-1$ // try { @@ -394,8 +395,8 @@ public class ManagedBuildEnvironmentTests extends TestCase { // assertNotNull(usup.createVariable(NAME_REM1, VAL_CWDPWD, IBuildEnvironmentVariable.ENVVAR_REMOVE, DEL_UNIX, cfg)); // assertNotNull(usup.createVariable(NAME_REM2, VAL_CWDPWD, IBuildEnvironmentVariable.ENVVAR_REMOVE, DEL_UNIX, cfg)); // } catch (Exception e) { fail(e.getLocalizedMessage()); } -// -// // Check vars presence/absence on different levels +// +// // Check vars presence/absence on different levels // IBuildEnvironmentVariable a = env.getVariable(NAME_REM1, worksp, true, false); // IBuildEnvironmentVariable b = env.getVariable(NAME_REM2, worksp, true, false); // assertNotNull(a); @@ -411,23 +412,23 @@ public class ManagedBuildEnvironmentTests extends TestCase { // assertNull(b); // } /** - * testEnvProvider() - + * testEnvProvider() - */ public void testEnvProvider() { doInit(); IBuildEnvironmentVariable a = envProvider.getVariable(TestMacro.PRJ_VAR, mproj.getConfigurations()[0], true, false); assertNotNull(a); assertEquals(TestMacro.PRJ_VAR + mproj.getName(), a.getValue()); - + IConfiguration[] cfgs = mproj.getConfigurations(); a = envProvider.getVariable(TestMacro.CFG_VAR, cfgs[0], true, false); assertNotNull(a); assertEquals(TestMacro.CFG_VAR + cfgs[0].getName(), a.getValue()); - - // no provider for another configurations + + // no provider for another configurations a = envProvider.getVariable(TestMacro.CFG_VAR, cfgs[1], true, false); assertNull(a); - + // combination user-defined and provided variables // UserDefinedEnvironmentSupplier usup = getSupplier(cfgs[0], cfgs[0].getName()); // usup.createVariable(TestMacro.PRJ_VAR, VAL_DUMMY1, IBuildEnvironmentVariable.ENVVAR_PREPEND, DEL_UNIX, cfgs[0]); @@ -437,8 +438,8 @@ public class ManagedBuildEnvironmentTests extends TestCase { } /** - * This test is not used iun suite. It just prints variabes - */ + * This test is not used iun suite. It just prints variabes + */ // public void testEnvPrint(){ // doInit(); // printVar("s-Var", envProvider.getVariables(null, false, false)); //$NON-NLS-1$ @@ -446,14 +447,14 @@ public class ManagedBuildEnvironmentTests extends TestCase { // printVar("p-Var", envProvider.getVariables(mproj, false, false)); //$NON-NLS-1$ // IConfiguration[] cfgs = mproj.getConfigurations(); // for (int k=0; k 0) { // for (int i=0; i < vars.length; i++) { -// System.out.println(head + "[" + i + "] " + //$NON-NLS-1$ //$NON-NLS-2$ +// System.out.println(head + "[" + i + "] " + //$NON-NLS-1$ //$NON-NLS-2$ // vars[i].getName() + " = " + //$NON-NLS-1$ // vars[i].getValue() + " / " + //$NON-NLS-1$ // vars[i].getOperation() + vars[i].getDelimiter()); @@ -548,7 +549,7 @@ public class ManagedBuildEnvironmentTests extends TestCase { // } /* - * check that ALL variables from list "a" have correspondence + * check that ALL variables from list "a" have correspondence * in list "b" * empty list or null are treated as corresponding to anything */ @@ -556,7 +557,7 @@ public class ManagedBuildEnvironmentTests extends TestCase { // if (a == null) return true; // else if (a.length == 0) return true; // else if (b == null) return false; -// +// // for (int i=0; i projectList = null; if (containsZip) { File projectZips[] = testDir.listFiles(new FileFilter(){ + @Override public boolean accept(File pathname){ if(pathname.isDirectory()) return false; return true; } }); - + projectList = new ArrayList(projectZips.length); for(int i = 0; i < projectZips.length; i++){ try{ String projectName = projectZips[i].getName(); if(!projectName.endsWith(".zip")) continue; - + projectName = projectName.substring(0,projectName.length()-".zip".length()); if(projectName.length() == 0) continue; @@ -109,41 +116,42 @@ public class ManagedProject21MakefileTests extends TestCase { projectList.add(project); } catch(Exception e){} } - + return projectList.toArray(new IProject[projectList.size()]); } - + private IProject[] createProjects(String projName, IPath location, String projectTypeId, boolean containsZip) { - + // In case the projects need to be updated... IOverwriteQuery queryALL = new IOverwriteQuery(){ + @Override public String queryOverwrite(String file) { return ALL; }}; - + UpdateManagedProjectManager.setBackupFileOverwriteQuery(queryALL); UpdateManagedProjectManager.setUpdateProjectQuery(queryALL); - + IProject projects[] = createProject(projName, location, projectTypeId, containsZip); return projects; } - - private boolean buildProjects(String benchmarkDir, IProject projects[], IPath[] files) { + + private boolean buildProjects(String benchmarkDir, IProject projects[], IPath[] files) { if(projects == null || projects.length == 0) return false; - + boolean succeeded = true; for(int i = 0; i < projects.length; i++){ IProject curProject = projects[i]; - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject); - + //check whether the managed build info is converted boolean isCompatible = UpdateManagedProjectManager.isCompatibleProject(info); assertTrue(isCompatible); - + if(isCompatible){ - // Build the project in order to generate the maekfiles + // Build the project in order to generate the maekfiles try{ curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,null); } @@ -153,7 +161,7 @@ public class ManagedProject21MakefileTests extends TestCase { catch(OperationCanceledException e){ fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + e.getMessage()); } - + //compare the generated makefiles to their benchmarks if (files != null && files.length > 0) { if (i == 0) { @@ -167,7 +175,7 @@ public class ManagedProject21MakefileTests extends TestCase { } } } - + if (succeeded) { // Otherwise leave the projects around for comparison for(int i = 0; i < projects.length; i++) ManagedBuildTestHelper.removeProject(projects[i].getName()); @@ -189,7 +197,7 @@ public class ManagedProject21MakefileTests extends TestCase { } } catch (Exception e) {fail("could not create the path variable " + name);} } - + private void createFileLink(IProject project, IPath tmpDir, String linkName, String fileName) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); String name = MBS_TEMP_DIR; @@ -197,9 +205,9 @@ public class ManagedProject21MakefileTests extends TestCase { createPathVariable(tmpDir); pathVariableCreated = true; } - - try { - // Now we can create a linked resource relative to the defined path variable: + + try { + // Now we can create a linked resource relative to the defined path variable: IFile linkF1 = project.getFile(linkName); IPath location = new Path("MBSTemp/" + fileName); if (workspace.validateLinkLocation(linkF1, location).isOK()) { @@ -209,30 +217,30 @@ public class ManagedProject21MakefileTests extends TestCase { } } catch (Exception e) { fail("could not create the link to " + name + ": " + e); - } + } } - + /* (non-Javadoc) * tests 2.1 style tool integration for a single file executable */ public void testSingleFileExe(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("singleFileExe", null, null, true); buildProjects("singleFileExe", projects, makefiles); } - + /* (non-Javadoc) * tests 2.1 style tool integration for a two file SO */ public void testTwoFileSO(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("twoFileSO", null, null, true); buildProjects("twoFileSO", projects, makefiles); @@ -243,9 +251,9 @@ public class ManagedProject21MakefileTests extends TestCase { */ public void testMultiResConfig(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), Path.fromOSString("source1/subdir.mk"), Path.fromOSString("source2/subdir.mk"), @@ -253,20 +261,20 @@ public class ManagedProject21MakefileTests extends TestCase { IProject[] projects = createProjects("multiResConfig", null, null, true); buildProjects("multiResConfig", projects, makefiles); } - + /* (non-Javadoc) * tests 2.1 style tool integration for linked files */ public void testLinkedLib(){ boolean succeeded = false; IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), //Path.fromOSString("subdir.mk") // Can't compare this yet since it contains absolute paths! - Path.fromOSString("sources.mk")}; + Path.fromOSString("sources.mk")}; IPath[] linkedFiles = { - Path.fromOSString("f1.c"), - Path.fromOSString("f2.c"), + Path.fromOSString("f1.c"), + Path.fromOSString("f2.c"), Path.fromOSString("test_ar.h")}; File srcDirFile = CTestPlugin.getFileInPlugin(new Path("resources/test21Projects/linkedLib/")); IPath srcDir = Path.fromOSString(srcDirFile.toString()); @@ -286,25 +294,25 @@ public class ManagedProject21MakefileTests extends TestCase { ManagedBuildTestHelper.deleteTempDir(tmpSubDir, linkedFiles); } } - + /* (non-Javadoc) * tests 2.1 style tool integration for a linked folder */ public void testLinkedFolder(){ boolean succeeded = false; IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), Path.fromOSString("subdir.mk"), - Path.fromOSString("sources.mk")}; + Path.fromOSString("sources.mk")}; IPath[] linkedFiles = { - Path.fromOSString("f1.c"), - Path.fromOSString("f2.c"), + Path.fromOSString("f1.c"), + Path.fromOSString("f2.c"), Path.fromOSString("test_ar.h"), - Path.fromOSString("Benchmarks/makefile"), - Path.fromOSString("Benchmarks/objects.mk"), + Path.fromOSString("Benchmarks/makefile"), + Path.fromOSString("Benchmarks/objects.mk"), Path.fromOSString("Benchmarks/subdir.mk"), - Path.fromOSString("Benchmarks/sources.mk")}; + Path.fromOSString("Benchmarks/sources.mk")}; File srcDirFile = CTestPlugin.getFileInPlugin(new Path("resources/test21Projects/linkedFolder/")); IPath srcDir = Path.fromOSString(srcDirFile.toString()); IPath tmpSubDir = Path.fromOSString("CDTMBSTest"); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java index bcb16887416..2c75891fd87 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java @@ -56,16 +56,16 @@ public class ManagedProject30MakefileTests extends TestCase { public static final String MBS_TEMP_DIR = "MBSTemp"; static boolean pathVariableCreated = false; - + private IPath resourcesLocation = new Path(CTestPlugin.getFileInPlugin(new Path("resources/test30Projects/")).getAbsolutePath()); public ManagedProject30MakefileTests(String name) { super(name); } - + public static Test suite() { TestSuite suite = new TestSuite(ManagedProject30MakefileTests.class.getName()); - + suite.addTest(new ManagedProject30MakefileTests("test30SingleFileExe")); suite.addTest(new ManagedProject30MakefileTests("test30TwoFileSO")); suite.addTest(new ManagedProject30MakefileTests("test30MultiResConfig")); @@ -106,20 +106,21 @@ public class ManagedProject30MakefileTests extends TestCase { } File projectZips[] = testDir.listFiles(new FileFilter(){ + @Override public boolean accept(File pathname){ if(pathname.isDirectory()) return false; return true; } }); - + projectList = new ArrayList(projectZips.length); for(int i = 0; i < projectZips.length; i++){ try{ String projectName = projectZips[i].getName(); if(!projectName.endsWith(".zip")) continue; - + projectName = projectName.substring(0,projectName.length()-".zip".length()); if(projectName.length() == 0) continue; @@ -143,40 +144,41 @@ public class ManagedProject30MakefileTests extends TestCase { } catch(Exception e){ } } - + return projectList.toArray(new IProject[projectList.size()]); } - + private IProject[] createProjects(String projName, IPath location, String projectTypeId, boolean containsZip) { - + // In case the projects need to be updated... IOverwriteQuery queryALL = new IOverwriteQuery(){ + @Override public String queryOverwrite(String file) { return ALL; }}; UpdateManagedProjectManager.setBackupFileOverwriteQuery(queryALL); UpdateManagedProjectManager.setUpdateProjectQuery(queryALL); - + IProject projects[] = createProject(projName, location, projectTypeId, containsZip); return projects; } - - private void buildProjectsWorker(IProject projects[], IPath[] files, boolean compareBenchmark) { + + private void buildProjectsWorker(IProject projects[], IPath[] files, boolean compareBenchmark) { if(projects == null || projects.length == 0) return; - + boolean succeeded = true; for (int i = 0; i < projects.length; i++){ IProject curProject = projects[i]; - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject); - + //check whether the managed build info is converted boolean isCompatible = UpdateManagedProjectManager.isCompatibleProject(info); assertTrue(isCompatible); - + if (isCompatible){ - // Build the project in order to generate the makefiles + // Build the project in order to generate the makefiles try{ curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,null); } @@ -186,7 +188,7 @@ public class ManagedProject30MakefileTests extends TestCase { catch(OperationCanceledException e){ fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + e.getMessage()); } - + //compare the generated makefiles to their benchmarks if (files != null && files.length > 0) { if (i == 0) { @@ -203,7 +205,7 @@ public class ManagedProject30MakefileTests extends TestCase { } } } - + if (succeeded) { // Otherwise leave the projects around for comparison for (int i = 0; i < projects.length; i++) ManagedBuildTestHelper.removeProject(projects[i].getName()); @@ -214,12 +216,12 @@ public class ManagedProject30MakefileTests extends TestCase { private void buildProjects(IProject projects[], IPath[] files) { buildProjectsWorker(projects, files, true); } - + // Build projects but don't compare benchmarks because there should be not build files generated - private void buildDegenerativeProjects(IProject projects[], IPath[] files) { + private void buildDegenerativeProjects(IProject projects[], IPath[] files) { buildProjectsWorker(projects, files, false); } - + private void createPathVariable(IPath tmpDir) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace = ResourcesPlugin.getWorkspace(); @@ -234,7 +236,7 @@ public class ManagedProject30MakefileTests extends TestCase { } } catch (Exception e) {fail("could not create the path variable " + name);} } - + private void createFileLink(IProject project, IPath tmpDir, String linkName, String fileName) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); String name = MBS_TEMP_DIR; @@ -242,9 +244,9 @@ public class ManagedProject30MakefileTests extends TestCase { createPathVariable(tmpDir); pathVariableCreated = true; } - - try { - // Now we can create a linked resource relative to the defined path variable: + + try { + // Now we can create a linked resource relative to the defined path variable: IFile linkF1 = project.getFile(linkName); IPath location = new Path("MBSTemp/" + fileName); if (workspace.validateLinkLocation(linkF1, location).isOK()) { @@ -254,30 +256,30 @@ public class ManagedProject30MakefileTests extends TestCase { } } catch (Exception e) { fail("could not create the link to " + name + ": " + e); - } + } } - + /* (non-Javadoc) * tests 3.0 style tool integration for a single file executable */ public void test30SingleFileExe(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("singleFileExe", null, null, true); buildProjects(projects, makefiles); } - + /* (non-Javadoc) * tests 3.0 style tool integration for a two file SO */ public void test30TwoFileSO(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("twoFileSO", null, null, true); buildProjects(projects, makefiles); @@ -288,9 +290,9 @@ public class ManagedProject30MakefileTests extends TestCase { */ public void test30MultiResConfig(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), Path.fromOSString("main.d"), Path.fromOSString("source1/subdir.mk"), @@ -302,19 +304,19 @@ public class ManagedProject30MakefileTests extends TestCase { IProject[] projects = createProjects("multiResConfig", null, null, true); buildProjects(projects, makefiles); } - + /* (non-Javadoc) * tests 3.0 style tool integration for linked files */ public void test30LinkedLib(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), //Path.fromOSString("subdir.mk") // Can't compare this yet since it contains absolute paths! - Path.fromOSString("sources.mk")}; + Path.fromOSString("sources.mk")}; IPath[] linkedFiles = { - Path.fromOSString("f1_30.c"), - Path.fromOSString("f2_30.c"), + Path.fromOSString("f1_30.c"), + Path.fromOSString("f2_30.c"), Path.fromOSString("test_ar_30.h")}; File srcDirFile = CTestPlugin.getFileInPlugin(new Path("resources/test30Projects/linkedLib30/")); IPath srcDir = Path.fromOSString(srcDirFile.toString()); @@ -331,24 +333,24 @@ public class ManagedProject30MakefileTests extends TestCase { buildProjects(projects, makefiles); } finally {ManagedBuildTestHelper.deleteTempDir(tmpSubDir, linkedFiles);} } - + /* (non-Javadoc) * tests 3.0 style tool integration for a linked folder */ public void test30LinkedFolder(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), Path.fromOSString("subdir.mk"), - Path.fromOSString("sources.mk")}; + Path.fromOSString("sources.mk")}; IPath[] linkedFiles = { - Path.fromOSString("f1.c"), - Path.fromOSString("f2.c"), + Path.fromOSString("f1.c"), + Path.fromOSString("f2.c"), Path.fromOSString("test_ar.h"), - Path.fromOSString("Benchmarks/makefile"), - Path.fromOSString("Benchmarks/objects.mk"), + Path.fromOSString("Benchmarks/makefile"), + Path.fromOSString("Benchmarks/objects.mk"), Path.fromOSString("Benchmarks/subdir.mk"), - Path.fromOSString("Benchmarks/sources.mk")}; + Path.fromOSString("Benchmarks/sources.mk")}; File srcDirFile = CTestPlugin.getFileInPlugin(new Path("resources/test30Projects/linkedFolder/")); IPath srcDir = Path.fromOSString(srcDirFile.toString()); IPath tmpSubDir = Path.fromOSString("CDTMBSTest"); @@ -370,27 +372,27 @@ public class ManagedProject30MakefileTests extends TestCase { */ public void test30CopyandDeploy(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), - Path.fromOSString("subdir.mk"), - Path.fromOSString("main.d"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), + Path.fromOSString("subdir.mk"), + Path.fromOSString("main.d"), Path.fromOSString("Functions/subdir.mk"), Path.fromOSString("Functions/Func1.d")}; IProject[] projects = createProjects("copyandDeploy", null, null, true); buildProjects(projects, makefiles); } - + /* (non-Javadoc) * tests 3.0 style tool integration in the context of deleting a file, to see if the proper behavior * occurs in the managedbuild system */ public void test30DeleteFile(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), Path.fromOSString("subdir.mk"), - Path.fromOSString("sources.mk")}; + Path.fromOSString("sources.mk")}; IProject[] projects = createProjects("deleteFile", null, null, true); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); @@ -400,6 +402,7 @@ public class ManagedProject30MakefileTests extends TestCase { resourceList.add(projfile); final IResource[] fileResource = resourceList.toArray(new IResource[resourceList.size()]); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { workspace.delete(fileResource, false, null); } @@ -407,22 +410,22 @@ public class ManagedProject30MakefileTests extends TestCase { try { NullProgressMonitor monitor = new NullProgressMonitor(); workspace.run(runnable, workspace.getRoot(), IWorkspace.AVOID_UPDATE, monitor); - } catch (Exception e) { + } catch (Exception e) { fail("could not delete file in project " + project.getName()); } buildProjects(projects, makefiles); } /* (non-Javadoc) - * tests 3.0 managed build system with a project which has only a single source file that is marked as + * tests 3.0 managed build system with a project which has only a single source file that is marked as * "excluded from build" to see that this degenerative case is handled gracefully */ public void test30NoFilesToBuild(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), Path.fromOSString("subdir.mk"), - Path.fromOSString("sources.mk")}; + Path.fromOSString("sources.mk")}; IProject[] projects = createProjects("noFilesToBuild", null, null, true); IProject project = projects[0]; @@ -431,7 +434,7 @@ public class ManagedProject30MakefileTests extends TestCase { IConfiguration config = info.getDefaultConfiguration(); IResourceConfiguration rconfig = config.createResourceConfiguration(projfile); rconfig.setExclude(true); - buildDegenerativeProjects(projects, makefiles); + buildDegenerativeProjects(projects, makefiles); } /** @@ -441,27 +444,27 @@ public class ManagedProject30MakefileTests extends TestCase { public void testFileWithNoExtension() { IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("testFileWithNoExtension", null, null, true); buildProjects(projects, makefiles); } - - + + /* (non-Javadoc) - * tests 3.0 style tool integration: create pre-build and post-build steps and verify that + * tests 3.0 style tool integration: create pre-build and post-build steps and verify that * the proper commands are generated in the makefile which is created by the managedbuild system */ public void testPreAndPostProcessBuildSteps(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), Path.fromOSString("subdir.mk"), - Path.fromOSString("sources.mk")}; + Path.fromOSString("sources.mk")}; - IProject[] projects = createProjects("preAndPostBuildSteps", null, null, true); + IProject[] projects = createProjects("preAndPostBuildSteps", null, null, true); IProject project = projects[0]; IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IConfiguration config = info.getDefaultConfiguration(); @@ -474,21 +477,21 @@ public class ManagedProject30MakefileTests extends TestCase { /* (non-Javadoc) - * tests 3.0 style tool integration: create resource custom build step and verify that + * tests 3.0 style tool integration: create resource custom build step and verify that * the proper commands are generated in the makefile which is created by the managedbuild system */ public void testResourceCustomBuildStep(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), Path.fromOSString("subdir.mk"), - Path.fromOSString("sources.mk")}; + Path.fromOSString("sources.mk")}; ITool rcbsTool; IInputType rcbsToolInputType; IAdditionalInput rcbsToolInputTypeAdditionalInput; IOutputType rcbsToolOutputType; - IProject[] projects = createProjects("rcbsBasicTest", null, null, true); + IProject[] projects = createProjects("rcbsBasicTest", null, null, true); IProject project = projects[0]; IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IConfiguration config = info.getDefaultConfiguration(); @@ -507,15 +510,15 @@ public class ManagedProject30MakefileTests extends TestCase { buildProjects(projects, makefiles); } - + /* (non-Javadoc) * tests 3.0 style tool integration with pre and post process steps added to typical compile & link */ public void test30_1(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("test30_1", null, null, true); buildProjects(projects, makefiles); @@ -526,14 +529,14 @@ public class ManagedProject30MakefileTests extends TestCase { */ public void test30_2(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("test30_2", null, null, true); buildProjects(projects, makefiles); } - + /* (non-Javadoc) * tests 3.0 top-level tool-chain definition */ @@ -565,9 +568,9 @@ public class ManagedProject30MakefileTests extends TestCase { */ public void CDTFortranTest1(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("CDTFortranTest1", null, null, true); buildProjects(projects, makefiles); @@ -578,9 +581,9 @@ public class ManagedProject30MakefileTests extends TestCase { */ public void CDTFortranTest2(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("module/subdir.mk"), Path.fromOSString("Sources/subdir.mk")}; IProject[] projects = createProjects("CDTFortranTest2", null, null, true); @@ -592,24 +595,24 @@ public class ManagedProject30MakefileTests extends TestCase { */ public void TestATO(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("TestATO", null, null, true); buildProjects(projects, makefiles); } - + public void testMacroSupportInBuildDefinitions() { IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; IProject[] projects = createProjects("testMacroSupportInBuildDefinitions", null, null, true); buildProjects(projects, makefiles); } - + /** * (non-Javadoc) * tests managed build system with a project which has resources with spaces in their paths @@ -617,9 +620,9 @@ public class ManagedProject30MakefileTests extends TestCase { public void testSpaces() { IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), Path.fromOSString("main with spaces.d"), Path.fromOSString("sub folder with spaces/subdir.mk"), @@ -627,7 +630,7 @@ public class ManagedProject30MakefileTests extends TestCase { IProject[] projects = createProjects("test with spaces", null, null, true); buildProjects(projects, makefiles); } - + /** * (non-Javadoc) * tests managed build system with a project which has resources with spaces in their paths @@ -635,9 +638,9 @@ public class ManagedProject30MakefileTests extends TestCase { public void testInputTypeOption() { IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), }; IProject[] projects = createProjects("inputTypeOption", null, null, true); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProjectUpdateTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProjectUpdateTests.java index f1119a2a64d..cb189fa83b5 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProjectUpdateTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProjectUpdateTests.java @@ -44,10 +44,10 @@ public class ManagedProjectUpdateTests extends TestCase { public ManagedProjectUpdateTests(String name) { super(name); } - + public static Test suite() { TestSuite suite = new TestSuite(ManagedProjectUpdateTests.class.getName()); - + suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate12_Update")); suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate20_Update")); suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate21_Update")); @@ -56,10 +56,10 @@ public class ManagedProjectUpdateTests extends TestCase { // suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate21_NoUpdate")); // TODO: This is affected by the TODO in UpdateManagedProjectManager suite.addTest(new ManagedProjectUpdateTests("testProjectUpdate21CPP_Update")); - + return suite; } - + private File getVersionProjectsDir(String version){ return CTestPlugin.getFileInPlugin(new Path("resources/oldTypeProjects/"+version)); } @@ -70,22 +70,23 @@ public class ManagedProjectUpdateTests extends TestCase { fail("Test project directory is missing."); return null; } - + File projectZips[] = file.listFiles(new FileFilter(){ + @Override public boolean accept(File pathname){ if(pathname.isDirectory()) return false; return true; } }); - + ArrayList projectList = new ArrayList(projectZips.length); for(int i = 0; i < projectZips.length; i++){ try{ String projectName = projectZips[i].getName(); if(!projectName.endsWith(".zip")) continue; - + projectName = projectName.substring(0,projectName.length()-".zip".length()); if(projectName.length() == 0) continue; @@ -102,35 +103,37 @@ public class ManagedProjectUpdateTests extends TestCase { } return projectList.toArray(new IProject[projectList.size()]); } - - private void doTestProjectUpdate(String version, boolean updateProject, boolean overwriteBackupFiles, + + private void doTestProjectUpdate(String version, boolean updateProject, boolean overwriteBackupFiles, IPath[] files){ IOverwriteQuery queryALL = new IOverwriteQuery(){ + @Override public String queryOverwrite(String file) { return ALL; }}; IOverwriteQuery queryNOALL = new IOverwriteQuery(){ + @Override public String queryOverwrite(String file) { return NO_ALL; }}; - + UpdateManagedProjectManager.setBackupFileOverwriteQuery(overwriteBackupFiles ? queryALL : queryNOALL); UpdateManagedProjectManager.setUpdateProjectQuery(updateProject ? queryALL : queryNOALL); - + IProject projects[] = createVersionProjects(version); if(projects == null || projects.length == 0) return; for(int i = 0; i < projects.length; i++){ final IProject curProject = projects[i]; - - //the project conversion occures the first time + + //the project conversion occures the first time //ManagedBuildManager.getBuildInfo gets called IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject); - + //check whether the managed build info is converted boolean isCompatible = UpdateManagedProjectManager.isCompatibleProject(info); assertTrue(isCompatible); - + if(isCompatible){ //check for correct update if (!updateProject) { @@ -167,15 +170,15 @@ public class ManagedProjectUpdateTests extends TestCase { } }; buildJob.setRule(rule); - + buildJob.schedule(); - + try { buildJob.join(); } catch (InterruptedException e) { fail("the build job for the project \"" + curProject.getName() + "\" was interrupted, exception message: " + e.getMessage()); } - + IStatus status = buildJob.getResult(); if(status.getCode() != IStatus.OK){ fail("the build job for the project \"" + curProject.getName() + "\" failed, status message: " + status.getMessage()); @@ -192,83 +195,83 @@ public class ManagedProjectUpdateTests extends TestCase { } } } - + for(int i = 0; i < projects.length; i++) ManagedBuildTestHelper.removeProject(projects[i].getName()); } - + /* (non-Javadoc) - * tests project v1.2 update - * in case when user chooses to update the project + * tests project v1.2 update + * in case when user chooses to update the project */ public void testProjectUpdate12_Update(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; doTestProjectUpdate("1.2", true, true, makefiles); } /* (non-Javadoc) - * tests project v2.0 update - * in case when user chooses to update the project + * tests project v2.0 update + * in case when user chooses to update the project */ public void testProjectUpdate20_Update(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk")}; doTestProjectUpdate("2.0", true, true, makefiles); } /* (non-Javadoc) - * tests project v2.1 update - * in case when user chooses to update the project + * tests project v2.1 update + * in case when user chooses to update the project */ public void testProjectUpdate21_Update(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), - Path.fromOSString("subdir.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), + Path.fromOSString("subdir.mk"), Path.fromOSString("Functions/subdir.mk")}; doTestProjectUpdate("2.1", true, true, makefiles); } /* (non-Javadoc) - * tests project v2.1 update of a C++ project with C source files + * tests project v2.1 update of a C++ project with C source files */ public void testProjectUpdate21CPP_Update(){ IPath[] makefiles = { - Path.fromOSString("makefile"), - Path.fromOSString("objects.mk"), - Path.fromOSString("sources.mk"), - Path.fromOSString("subdir.mk"), + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), + Path.fromOSString("subdir.mk"), Path.fromOSString("Functions/subdir.mk")}; doTestProjectUpdate("2.1CPP", true, true, makefiles); } /* (non-Javadoc) - * tests project v1.2 update - * in case when user chooses not to update the project + * tests project v1.2 update + * in case when user chooses not to update the project */ public void testProjectUpdate12_NoUpdate(){ doTestProjectUpdate("1.2", false, true, null); } /* (non-Javadoc) - * tests project v2.0 update - * in case when user chooses not to update the project + * tests project v2.0 update + * in case when user chooses not to update the project */ public void testProjectUpdate20_NoUpdate(){ doTestProjectUpdate("2.0", false, true, null); } /* (non-Javadoc) - * tests project v2.1 update - * in case when user chooses not to update the project + * tests project v2.1 update + * in case when user chooses not to update the project */ public void testProjectUpdate21_NoUpdate(){ doTestProjectUpdate("2.1", false, true, null); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/MultiVersionSupportTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/MultiVersionSupportTests.java index da385680af3..6b9fda2d3d7 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/MultiVersionSupportTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/MultiVersionSupportTests.java @@ -55,10 +55,10 @@ import org.eclipse.ui.dialogs.IOverwriteQuery; public class MultiVersionSupportTests extends TestCase { static IProject proj = null; static IManagedProject mproj = null; - - IConfiguration[] cfgs = null; - private IWorkspace worksp; - + + IConfiguration[] cfgs = null; + private IWorkspace worksp; + public MultiVersionSupportTests() { super(); } public MultiVersionSupportTests(String name) { super(name); } @@ -78,52 +78,52 @@ public class MultiVersionSupportTests extends TestCase { return suite; } - + /* * This function tests the functionality of Project converter convenience routines * defined in ManagedBuildManager class. These convenience routines are generic routines - * anyone can use them + * anyone can use them * i) To find out whether any converters are available for a given Build Object, * ii) To get a list of converters * iii) To convert a Build Object */ - + public void testProjectConverterConvenienceRoutines() throws Exception { String projectName = "TestProjectConverterConvenienceRoutines"; //$NON-NLS-1$ String projectTypeId = "testProjectConverterConvenienceRoutines.exe"; //$NON-NLS-1$ doInit(projectName, projectTypeId); - + // It should contain only one configuration. assertEquals(cfgs.length, 1); - + IToolChain toolChain = cfgs[0].getToolChain(); - + // Check whether this tool chain has converters using generic convenience routine. boolean hasConverters = ManagedBuildManager.hasTargetConversionElements(toolChain); - + // Expected value is 'true' assertEquals(hasConverters, true); - + // Get the list of available converters for ths tool chain using generic convenience routine Map converters = ManagedBuildManager.getConversionElements(toolChain); - + // Expected value for the number of converters available is '1' assertEquals(converters.size(), 1); return; } - + /* * This function tests the functionality of configuration name provider. * Using this functionality, Tool Integrator can provide configuration names dynamically * based on the OS, architecture. - * + * * In plugin manifest file, there are 4 configurations defined for the project type * "cdt.managedbuild.target.testMultipleVersions.exe". Two configurations are defined with "Debug" - * as their name and other two are defined with "Release" as their name. But user will see the + * as their name and other two are defined with "Release" as their name. But user will see the * configuration names as "Debug", "Release", "Debug_ia64" and "Release_ia64" while creating a project. - * + * */ public void testConfigurationNameProvider()throws Exception { String [] expectedConfigNames = { "Debug","Release","Debug_ia64","Release_ia64" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ @@ -132,29 +132,29 @@ public class MultiVersionSupportTests extends TestCase { String projectName = "TestConfigurationNameProvider"; //$NON-NLS-1$ String projectTypeId = "cdt.managedbuild.target.testMultipleVersions.exe"; //$NON-NLS-1$ doInit(projectName, projectTypeId); - + // Check the configuration names cfgs = mproj.getConfigurations(); - + // Get the actual configuration names for (int i = 0; i < cfgs.length; i++) { - actualConfigNames[i] = cfgs[i].getName(); + actualConfigNames[i] = cfgs[i].getName(); } - + // Compare the expected and actual, for (int i = 0; i < expectedConfigNames.length; i++) { - assertTrue( isArrayContains(actualConfigNames, expectedConfigNames[i]) ); + assertTrue( isArrayContains(actualConfigNames, expectedConfigNames[i]) ); } return; } - + /* * This function tests whether the newly added attribute 'description' is retrived from plugin * manifest file correctly or not. There are 4 configurations defined with different description * each configuration. This function checks the description of each configuration against * expected description after creating a project. */ - + public void testConfigurationDescription()throws Exception { String [] expectedConfigDescriptions = { "debug configuration for IA32 windows","release configuration for IA32 windows","debug configuration for IA64 windows","release configuration for IA64 windows" }; //$NON-NLS-1$ String [] actualConfigDescriptions = new String[4]; @@ -163,28 +163,28 @@ public class MultiVersionSupportTests extends TestCase { String projectTypeId = "cdt.managedbuild.target.testMultipleVersions.exe"; //$NON-NLS-1$ doInit(projectName, projectTypeId); - + // Check the configuration descriptions cfgs = mproj.getConfigurations(); - + // Get the actual configuration names for (int i = 0; i < cfgs.length; i++) { - actualConfigDescriptions[i] = cfgs[i].getDescription(); + actualConfigDescriptions[i] = cfgs[i].getDescription(); } - + // Compare the expected and actual, for (int i = 0; i < expectedConfigDescriptions.length; i++) { - assertTrue( isArrayContains(actualConfigDescriptions, expectedConfigDescriptions[i]) ); + assertTrue( isArrayContains(actualConfigDescriptions, expectedConfigDescriptions[i]) ); } return; } - + /* * This function tests whether the version information stored with in the 'id' of ToolChain/Tool/Builder - * is retrived from plugin manifest file correctly or not. + * is retrived from plugin manifest file correctly or not. */ - + public void testVersionInfo()throws Exception { String projectName = "TestVersionInfo"; //$NON-NLS-1$ @@ -192,21 +192,21 @@ public class MultiVersionSupportTests extends TestCase { // create managed project doInit(projectName, projectTypeId); - + // Check the configuration descriptions cfgs = mproj.getConfigurations(); - + // Check the version information of ToolChain/Tool/Builder defined under 'Release' Configuration. - + // It should return the version as '0.0.4' as there is no version information defined // for ToolChain/Tool/Builder. The version '0.0.4' is the default version for CDT3.0 - - // Release configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.release.1" + + // Release configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.release.1" IConfiguration releaseConfig = mproj.getConfiguration("cdt.managedbuild.config.testMultipleVersions.exe.release.1"); //$NON-NLS-1$ // the toolchain version should be '0.0.4' as this is default value assertEquals(releaseConfig.getToolChain().getVersion().toString(), "0.0.4"); //$NON-NLS-1$ - + // Get the tools of this toolChain and verify the version of each tool // Each tool version in release configuration should be "0.0.4" ITool [] tools = releaseConfig.getToolChain().getTools(); @@ -214,21 +214,21 @@ public class MultiVersionSupportTests extends TestCase { ITool tool = tools[i]; assertEquals(tool.getVersion().toString(),"0.0.4"); //$NON-NLS-1$ } - + // check the builder version IBuilder builder = releaseConfig.getToolChain().getBuilder(); assertEquals(builder.getVersion().toString(),"0.0.4"); //$NON-NLS-1$ - + // Check the versions of ToolChain/Tool/Builder in Debug Configuration // Expected version: "1.1.0" for all ToolChain/Tool(s)/Builder. - + // Get the 'Debug' Configuration - // Debug configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.debug.0" + // Debug configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.debug.0" IConfiguration debugConfig = mproj.getConfiguration("cdt.managedbuild.config.testMultipleVersions.exe.debug.0"); //$NON-NLS-1$ // the toolchain version should be '1.1.0' as that's what defined in plugin manifest file assertEquals(debugConfig.getToolChain().getVersion().toString(), "1.1.0"); //$NON-NLS-1$ - + // Get the tools of this toolChain and verify the version of each tool // Each tool version in debug configuration should be "1.1.0" tools = debugConfig.getToolChain().getTools(); @@ -236,18 +236,18 @@ public class MultiVersionSupportTests extends TestCase { ITool tool = tools[i]; assertEquals(tool.getVersion().toString(),"1.1.0"); //$NON-NLS-1$ } - + // check the builder version builder = debugConfig.getToolChain().getBuilder(); assertEquals(builder.getVersion().toString(),"1.1.0"); //$NON-NLS-1$ // Get the 'Debug64' Configuration - // Debug configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.debug.0" + // Debug configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.debug.0" IConfiguration debug64Config = mproj.getConfiguration("cdt.managedbuild.config.testMultipleVersions.exe.debug64.2"); //$NON-NLS-1$ // the toolchain version should be '2.2.0' as that's what defined in plugin manifest file assertEquals(debug64Config.getToolChain().getVersion().toString(), "2.2.0"); //$NON-NLS-1$ - + // Get the tools of this toolChain and verify the version of each tool // Each tool version in debug64 configuration should be "5.0.9" (defined in plugin manifest file) tools = debug64Config.getToolChain().getTools(); @@ -255,7 +255,7 @@ public class MultiVersionSupportTests extends TestCase { ITool tool = tools[i]; assertEquals(tool.getVersion().toString(),"5.0.9"); //$NON-NLS-1$ } - + // check the builder version , expected value : "3.2.1" defined in plugin manifest file builder = debug64Config.getToolChain().getBuilder(); assertEquals(builder.getVersion().toString(),"3.2.1"); //$NON-NLS-1$ @@ -267,7 +267,7 @@ public class MultiVersionSupportTests extends TestCase { * This function tests whether the attribute 'versionsSupported' of * ToolChain/Tool/Builder elements is retrived from plugin manifest file correctly or not. */ - + public void testVersionsSupportedAttribute() throws Exception { // create managed project String projectName = "TestVersionSupportAttribute"; //$NON-NLS-1$ @@ -277,13 +277,13 @@ public class MultiVersionSupportTests extends TestCase { // Check the configuration descriptions cfgs = mproj.getConfigurations(); - + // Check the version information of ToolChain/Tool/Builder defined under 'Release' Configuration. - + // It should return the version as '0.0.4' as there is no version information defined // for ToolChain/Tool/Builder. The version '0.0.4' is the default version for CDT3.0 - - // Release configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.release64.3" + + // Release configuration 'id' : "cdt.managedbuild.config.testMultipleVersions.exe.release64.3" IConfiguration releaseConfig = mproj.getConfiguration("cdt.managedbuild.config.testMultipleVersions.exe.release64.3"); //$NON-NLS-1$ // Get the tool chain @@ -291,25 +291,25 @@ public class MultiVersionSupportTests extends TestCase { //Get the 'versionsSupported' attribute of toolChain String toolChainVersionsSupported = toolChain.getVersionsSupported(); - + // Compare with the expected value "1.2.0,2.0.0,2.1.3" assertEquals(toolChainVersionsSupported,"1.2.0,2.0.0,2.1.3"); //$NON-NLS-1$ - - // Get the builder + + // Get the builder IBuilder builder = releaseConfig.getToolChain().getBuilder(); - + // Get the 'versionsSupported' attribute of builder String versionsSupported = builder.getVersionsSupported(); - + // Compare with expected value "2.0.0,2.1.1,3.0.3" assertEquals(versionsSupported,"2.0.0,2.1.1,3.0.3"); //$NON-NLS-1$ } - + static void createManagedProject(String name, String projectTypeId) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - proj = root.getProject(name); - + proj = root.getProject(name); + if (proj.exists()) { mproj = ManagedBuildManager.getBuildInfo(proj).getManagedProject(); } else { @@ -318,9 +318,9 @@ public class MultiVersionSupportTests extends TestCase { workspaceDesc.setAutoBuilding(false); try { workspace.setDescription(workspaceDesc); - proj = CCorePlugin.getDefault().createCProject(workspace.newProjectDescription(proj.getName()), + proj = CCorePlugin.getDefault().createCProject(workspace.newProjectDescription(proj.getName()), proj, new NullProgressMonitor(), ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID); - + // add ManagedBuildNature IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(proj); info.setValid(true); @@ -333,8 +333,8 @@ public class MultiVersionSupportTests extends TestCase { desc.saveProjectData(); } catch (CoreException e) { fail("Cannot create project: " + e.getLocalizedMessage()); //$NON-NLS-1$ - } - // Call this function just to avoid init problems in getProjectType(); + } + // Call this function just to avoid init problems in getProjectType(); ManagedBuildManager.getDefinedProjectTypes(); IProjectType projType = ManagedBuildManager.getProjectType(projectTypeId); assertNotNull(projType); @@ -343,7 +343,7 @@ public class MultiVersionSupportTests extends TestCase { } catch (BuildException e) {} ManagedBuildManager.setNewProjectVersion(proj); IConfiguration[] cfgs = projType.getConfigurations(); - + for (int i = 0; i < cfgs.length; i++) { // sic ! from 1 mproj.createConfiguration(cfgs[i], cfgs[i].getId() + "." + i); //$NON-NLS-1$ } @@ -355,11 +355,11 @@ public class MultiVersionSupportTests extends TestCase { // open project w/o progress monitor; no action performed if it's opened try { proj.open(null); - } catch (CoreException e) {} + } catch (CoreException e) {} } /* - * isArrayContains() + * isArrayContains() */ private boolean isArrayContains(String[] actualConfigNames, String name) { if (actualConfigNames != null) { @@ -371,7 +371,7 @@ public class MultiVersionSupportTests extends TestCase { } return false; } - + /** * doInit() - call it at the beginning of every test * @@ -383,89 +383,89 @@ public class MultiVersionSupportTests extends TestCase { worksp = proj.getWorkspace(); assertNotNull(worksp); cfgs = mproj.getConfigurations(); - assertNotNull(cfgs); + assertNotNull(cfgs); } - + public void testToolChainConversion_CDT20() throws Exception { // Pass projDirName as 'test20', and 'true' to update Project doTestProjectUpdate("test20", true); //$NON-NLS-1$ - - String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - + + String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ + File inputFile = new File(tmpDir + "/converterOutput20.txt"); //$NON-NLS-1$ try { assertTrue(inputFile.exists()); - + String expectedContent = "Converter for CDT 2.0 Project is invoked"; //$NON-NLS-1$ - + BufferedReader data = new BufferedReader(new FileReader(inputFile)); String actualContent; - + if ((actualContent = data.readLine()) != null) { assertEquals(actualContent,expectedContent); - } - + } + } catch (IOException e) { // TODO Auto-generated catch block - e.printStackTrace(); + e.printStackTrace(); } } - + public void testToolChainConversion_CDT21() throws Exception { // Pass projDirName as 'test21', and 'true' to update Project doTestProjectUpdate("test21", true); //$NON-NLS-1$ - - String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - + + String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ + File inputFile = new File(tmpDir + "/converterOutput21.txt"); //$NON-NLS-1$ try { assertTrue(inputFile.exists()); - + String expectedContent = "Converter for CDT 2.1 Project is invoked"; //$NON-NLS-1$ - + BufferedReader data = new BufferedReader(new FileReader(inputFile)); String actualContent; - + if ((actualContent = data.readLine()) != null) { assertEquals(actualContent,expectedContent); - } - + } + } catch (IOException e) { // TODO Auto-generated catch block - e.printStackTrace(); + e.printStackTrace(); } } - + public void testProjectConversion() throws Exception { // Pass the 'projDirName' as 'testProjectConversion', and 'true' to update Project doTestProjectUpdate("testProjectConversion", true); //$NON-NLS-1$ - - String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - + + String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ + File inputFile = new File(tmpDir + "/testProjectConverterOutput.txt"); //$NON-NLS-1$ try { assertTrue(inputFile.exists()); - + String expectedContent = "The converter for the projectType testProject_1.0.0 is invoked"; //$NON-NLS-1$ - + BufferedReader data = new BufferedReader(new FileReader(inputFile)); String actualContent; - + if ((actualContent = data.readLine()) != null) { assertEquals(actualContent,expectedContent); - } - + } + } catch (IOException e) { // TODO Auto-generated catch block - e.printStackTrace(); + e.printStackTrace(); } } - + private IProject getCDT_TestProject(String projDirName) { IProject project = null; File file = null; - + if (projDirName.equalsIgnoreCase("test20")) { //$NON-NLS-1$ file = CTestPlugin.getFileInPlugin(new Path( "resources/toolChainConversionProjects/test20")); //$NON-NLS-1$ @@ -475,7 +475,7 @@ public class MultiVersionSupportTests extends TestCase { } else if (projDirName.equals("testProjectConversion")) { //$NON-NLS-1$ file = CTestPlugin.getFileInPlugin(new Path( "resources/toolChainConversionProjects/testProjectConversion")); //$NON-NLS-1$ - } + } if (file == null) { fail("Test project directory " //$NON-NLS-1$ @@ -484,6 +484,7 @@ public class MultiVersionSupportTests extends TestCase { } File projectZips[] = file.listFiles(new FileFilter() { + @Override public boolean accept(File pathname) { if (pathname.isDirectory()) return false; @@ -526,17 +527,19 @@ public class MultiVersionSupportTests extends TestCase { } return project; } - + private void doTestProjectUpdate(String projDirName, boolean updateProject) { IOverwriteQuery queryALL = new IOverwriteQuery(){ + @Override public String queryOverwrite(String file) { return ALL; }}; IOverwriteQuery queryNOALL = new IOverwriteQuery(){ + @Override public String queryOverwrite(String file) { return NO_ALL; }}; - + UpdateManagedProjectManager.setUpdateProjectQuery(updateProject ? queryALL : queryNOALL); final IProject project = getCDT_TestProject(projDirName); @@ -570,5 +573,5 @@ public class MultiVersionSupportTests extends TestCase { } ManagedBuildTestHelper.removeProject(project.getName()); } - + } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/OneDirectionalPathConverter.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/OneDirectionalPathConverter.java index 49e89304ca2..09a4f0034c4 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/OneDirectionalPathConverter.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/OneDirectionalPathConverter.java @@ -18,7 +18,8 @@ import org.eclipse.core.runtime.Path; public class OneDirectionalPathConverter implements IOptionPathConverter { public static Path PREFIX = new Path("/test"); - + + @Override public IPath convertToPlatformLocation(String toolSpecificPath, IOption option, ITool tool) { IPath path = new Path(toolSpecificPath); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/OptionEnablementTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/OptionEnablementTests.java index 33508545a64..d9d697509a3 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/OptionEnablementTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/OptionEnablementTests.java @@ -44,56 +44,62 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal private static final String OPTION_VALUE_ROOT = "test.value.root"; private static final String OPTION_VALUE_FOLDER = "test.value.folder"; private static final String OPTION_VALUE_FILE = "test.value.file"; - + private static boolean fEnUiVisible; private static boolean fEnUiEnabled; private static boolean fEnCmdUsed; - + private static boolean fHandleValueCalled; - + private static final String thisEnumIds[] = new String[]{"testgnu.enablement.c.optimization.level.optimize", "testgnu.enablement.c.optimization.level.more"}; private static final String thisStrings[] = new String[]{ -// "", -// "test a b c", -// "some buggy string", +// "", +// "test a b c", +// "some buggy string", "start 1.2.3 stop"}; + @Override public boolean handleValue(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument, int event) { // TODO Auto-generated method stub return false; } + @Override public boolean isDefaultValue(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument) { // TODO Auto-generated method stub return false; } + @Override public boolean isEnumValueAppropriate(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument, String enumValue) { // TODO Auto-generated method stub return false; } + @Override public boolean isOptionUsedInCommandLine(IBuildObject configuration, IHoldsOptions holder, IOption option) { return fEnCmdUsed; } + @Override public boolean isOptionVisible(IBuildObject configuration, IHoldsOptions holder, IOption option) { return fEnUiVisible; } + @Override public boolean isOptionEnabled(IBuildObject configuration, IHoldsOptions holder, IOption option) { return fEnUiEnabled; } - + public static Test suite() { return new TestSuite(OptionEnablementTests.class); } - + private void resetValueHandler(){ fHandleValueCalled = false; } - + private void setEnablement(boolean cmdUs, boolean uiVis, boolean uiEn){ fEnUiVisible = uiVis; fEnUiEnabled = uiEn; @@ -111,21 +117,21 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IConfiguration cfg = info.getManagedProject().getConfigurations()[0]; assertFalse(fHandleValueCalled); - + doTestEnablement(cfg); - + doEnumAllValues(cfg); - + ManagedBuildTestHelper.removeProject("en"); } - + private void doEnumAllValues(IBuildObject cfgBo){ ITool thisTool = getTool(cfgBo,"enablement.this.child_1.2.3"); ITool otherTool = getTool(cfgBo,"enablement.other"); - - IBuildObject thisCfg = thisTool.getParent(); + + IBuildObject thisCfg = thisTool.getParent(); IBuildObject otherCfg = otherTool.getParent(); - + for(int i = 0; i < thisStrings.length; i++){ String strVal = thisStrings[i]; setOption(cfgBo, thisTool, "this.string", strVal); @@ -137,14 +143,14 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal setOption(cfgBo, thisTool, "this.enum", strVal); doTestEnablement(cfgBo); } -*/ +*/ setOption(cfgBo, thisTool, "this.boolean", false); doTestEnablement(cfgBo); setOption(cfgBo, thisTool, "this.boolean", true); doTestEnablement(cfgBo); } - + private ITool getTool(IBuildObject cfgBo, String id){ IResourceConfiguration rcCfg = null; IConfiguration cfg = null; @@ -168,7 +174,7 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal fail("wrong argument"); return tool; } - + private IOption setOption(IBuildObject cfg, IHoldsOptions holder, String id, boolean value){ return setOption(cfg, holder, holder.getOptionBySuperClassId(id), value); } @@ -224,23 +230,23 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal ITool tool = getTool(cfg, "enablement.this.child_1.2.3"); ITool otherTool = getTool(cfg, "enablement.other"); ITool tool2 = getTool(cfg, "enablement.this.child.2_1.2.3"); - + // IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); - + IOption thisBoolean = tool.getOptionBySuperClassId("this.boolean"); IOption thisString = tool.getOptionBySuperClassId("this.string"); IOption thisEnum = tool.getOptionBySuperClassId("this.enum"); - + IOption otherString = otherTool.getOptionBySuperClassId("other.string"); IOption otherBoolean = otherTool.getOptionBySuperClassId("other.boolean"); - - - + + + try{ - + IOption option = tool.getOptionBySuperClassId("enablement.command.c1"); - + assertEquals(option.getCommand(), "c1"); assertEquals(option.getCommandFalse(), "cmdF"); assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option)); @@ -351,12 +357,12 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); assertTrue(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option)); - + setEnablement(false, false, true); assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); assertTrue(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option)); - + setEnablement(true, false, false); assertTrue(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); @@ -397,7 +403,7 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.boolean.True"); assertEquals(option.getCommand(), "cmd"); assertEquals(option.getCommandFalse(), "cmdF"); - assertEquals(thisBoolean.getBooleanValue() == true, + assertEquals(thisBoolean.getBooleanValue() == true, option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); assertEquals(thisBoolean.getBooleanValue() == true, option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); @@ -407,7 +413,7 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.boolean.False"); assertEquals(option.getCommand(), "cmd"); assertEquals(option.getCommandFalse(), "cmdF"); - assertEquals(thisBoolean.getBooleanValue() == false, + assertEquals(thisBoolean.getBooleanValue() == false, option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); assertEquals(thisBoolean.getBooleanValue() == false, option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); @@ -417,7 +423,7 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.empty"); assertEquals(option.getCommand(), "cmd"); assertEquals(option.getCommandFalse(), "cmdF"); - assertEquals(thisString.getStringValue().equals(""), + assertEquals(thisString.getStringValue().equals(""), option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); assertEquals(thisString.getStringValue().equals(""), option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); @@ -427,7 +433,7 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.test a b c"); assertEquals(option.getCommand(), "cmd"); assertEquals(option.getCommandFalse(), "cmdF"); - assertEquals(thisString.getStringValue().equals("test a b c"), + assertEquals(thisString.getStringValue().equals("test a b c"), option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); assertEquals(thisString.getStringValue().equals("test a b c"), option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); @@ -440,7 +446,7 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal String id = thisEnum.getEnumeratedId(thisEnum.getStringValue()); if(id == null) id = ""; - assertEquals(id.equals("testgnu.enablement.c.optimization.level.optimize"), + assertEquals(id.equals("testgnu.enablement.c.optimization.level.optimize"), option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); assertEquals(id.equals("testgnu.enablement.c.optimization.level.optimize"), option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); @@ -450,41 +456,41 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.Q.true"); assertEquals(option.getCommand(), "cmd"); assertEquals(option.getCommandFalse(), "cmdF"); - assertEquals(option.getBooleanValue() == true, + assertEquals(option.getBooleanValue() == true, option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); - assertEquals(option.getBooleanValue()== true, + assertEquals(option.getBooleanValue()== true, option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); - assertEquals(option.getBooleanValue() == true, + assertEquals(option.getBooleanValue() == true, option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option)); option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.start ${ParentVersion} stop"); assertEquals(option.getCommand(), "cmd"); assertEquals(option.getCommandFalse(), "cmdF"); - assertEquals(thisString.getStringValue().equals("start 1.2.3 stop"), + assertEquals(thisString.getStringValue().equals("start 1.2.3 stop"), option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); - assertEquals(thisString.getStringValue().equals("start 1.2.3 stop"), + assertEquals(thisString.getStringValue().equals("start 1.2.3 stop"), option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); - assertEquals(thisString.getStringValue().equals("start 1.2.3 stop"), - option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option)); - - option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.other.string"); - assertEquals(option.getCommand(), "cmd"); - assertEquals(option.getCommandFalse(), "cmdF"); - assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), - option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); - assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), - option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); - assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), + assertEquals(thisString.getStringValue().equals("start 1.2.3 stop"), option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option)); option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.other.string"); assertEquals(option.getCommand(), "cmd"); assertEquals(option.getCommandFalse(), "cmdF"); - assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), + assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); - assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), + assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); - assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), + assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), + option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option)); + + option = tool.getOptionBySuperClassId("enablement.checkOpt.all.Q.this.string.Q.other.string"); + assertEquals(option.getCommand(), "cmd"); + assertEquals(option.getCommandFalse(), "cmdF"); + assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), + option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); + assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), + option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); + assertEquals(thisString.getStringValue().equals(otherString.getStringValue()), option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option)); option = tool.getOptionBySuperClassId("enablement.checkString"); @@ -535,7 +541,7 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal assertFalse(option.getApplicabilityCalculator().isOptionUsedInCommandLine(cfg, tool, option)); assertFalse(option.getApplicabilityCalculator().isOptionVisible(cfg, tool, option)); assertFalse(option.getApplicabilityCalculator().isOptionEnabled(cfg, tool, option)); - + option = tool.getOptionBySuperClassId("enablement.checkHolder.true.1.false.2"); assertEquals(option.getCommand(), "cmd"); assertEquals(option.getCommandFalse(), "cmdF"); @@ -554,7 +560,7 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal fail(e.getLocalizedMessage()); } } - + /** * This method assumes that folder has only one qualified tool. */ @@ -580,66 +586,66 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal assertEquals(1, tools.length); ITool tool = tools[0]; assertNotNull(tool); - + IOption option = tool.getOptionBySuperClassId(optionId); return option; } - + public void testEnablement_Bug250686() throws Exception { final String testName = getName(); IProject project = ManagedBuildTestHelper.createProject(testName, PROJECT_TYPE); assertNotNull(project); - + IFolder folder = ManagedBuildTestHelper.createFolder(project, "Folder"); assertNotNull(folder); IFile file = ManagedBuildTestHelper.createFile(project, "Folder/file.c"); assertNotNull(file); - + ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project); prjDescription.getConfigurationByName(CFG_NAME); - + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IConfiguration cfg = info.getManagedProject().getConfigurations()[0]; assertNotNull(cfg); assertEquals(CFG_NAME, cfg.getName()); - + { // Round 1. Test root folder option IFolderInfo rootFolderInfo = cfg.getRootFolderInfo(); assertNotNull(rootFolderInfo); - + IOption option = getOptionForFolder(rootFolderInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_ENABLEMENT, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 1. Test subfolder option IResourceInfo folderInfo = cfg.getResourceInfo(folder.getFullPath(), false); assertNotNull(folderInfo); assertTrue(folderInfo instanceof IFolderInfo); - + IOption option = getOptionForFolder((IFolderInfo) folderInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_ENABLEMENT, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 1. Test file option IResourceInfo fileInfo = cfg.getResourceInfo(file.getFullPath(), false); assertNotNull(fileInfo); assertTrue(fileInfo instanceof IFolderInfo); - + // Option is taken from root folder here IOption option = getOptionForFolder((IFolderInfo) fileInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_ENABLEMENT, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 2. Override the value of the option for the root folder IFolderInfo rootFolderInfo = cfg.getRootFolderInfo(); @@ -648,48 +654,48 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal IOption option = getOptionForFolder(rootFolderInfo, TOOL_ID, OPTION_ID); rootFolderInfo.setOption(tools[0], option, OPTION_VALUE_ROOT); } - + { // Round 2. Test root folder option IFolderInfo rootFolderInfo = cfg.getRootFolderInfo(); assertNotNull(rootFolderInfo); - + IOption option = getOptionForFolder(rootFolderInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_ROOT, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 2. Test subfolder option IResourceInfo folderInfo = cfg.getResourceInfo(folder.getFullPath(), false); assertNotNull(folderInfo); assertTrue(folderInfo instanceof IFolderInfo); - + IOption option = getOptionForFolder((IFolderInfo) folderInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_ROOT, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 2. Test file option IResourceInfo fileInfo = cfg.getResourceInfo(file.getFullPath(), false); assertNotNull(fileInfo); assertTrue(fileInfo instanceof IFolderInfo); - + // Option is taken from root folder here IOption option = getOptionForFolder((IFolderInfo) fileInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_ROOT, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 3. Override the value of the option for the subfolder IFolderInfo folderInfo = cfg.createFolderInfo(folder.getFullPath()); assertNotNull(folderInfo); - + ITool[] tools = folderInfo.getToolsBySuperClassId(TOOL_ID); assertEquals(1, tools.length); @@ -697,99 +703,99 @@ public class OptionEnablementTests extends TestCase implements IManagedOptionVal assertNotNull(option); assertEquals(OPTION_VALUE_ROOT, option.getValue()); assertFalse(option.isExtensionElement()); - + folderInfo.setOption(tools[0], option, OPTION_VALUE_FOLDER); } - + { // Round 3. Test root folder option IFolderInfo rootFolderInfo = cfg.getRootFolderInfo(); assertNotNull(rootFolderInfo); - + IOption option = getOptionForFolder(rootFolderInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_ROOT, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 3. Test subfolder option IResourceInfo folderInfo = cfg.getResourceInfo(folder.getFullPath(), false); assertNotNull(folderInfo); assertTrue(folderInfo instanceof IFolderInfo); - + IOption option = getOptionForFolder((IFolderInfo) folderInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_FOLDER, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 3. Test file option IResourceInfo fileInfo = cfg.getResourceInfo(file.getFullPath(), false); assertNotNull(fileInfo); assertTrue(fileInfo instanceof IFolderInfo); - + // Option is taken from parent folder here IOption option = getOptionForFolder((IFolderInfo) fileInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_FOLDER, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 4. Override the value of the option for the file IFileInfo fileInfo = cfg.createFileInfo(file.getFullPath()); assertNotNull(fileInfo); - + ITool[] tools = fileInfo.getTools(); assertEquals(1, tools.length); ITool tool = tools[0]; assertNotNull(tool); - + IOption option = getOptionForFile(fileInfo, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_FOLDER, option.getValue()); assertFalse(option.isExtensionElement()); - + fileInfo.setOption(tool, option, OPTION_VALUE_FILE); } - + { // Round 4. Test root folder option IFolderInfo rootFolderInfo = cfg.getRootFolderInfo(); assertNotNull(rootFolderInfo); - + IOption option = getOptionForFolder(rootFolderInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_ROOT, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 4. Test subfolder option IResourceInfo folderInfo = cfg.getResourceInfo(folder.getFullPath(), false); assertNotNull(folderInfo); assertTrue(folderInfo instanceof IFolderInfo); - + IOption option = getOptionForFolder((IFolderInfo) folderInfo, TOOL_ID, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_FOLDER, option.getValue()); assertFalse(option.isExtensionElement()); } - + { // Round 4. Test file option IResourceInfo fileInfo = cfg.getResourceInfo(file.getFullPath(), false); assertNotNull(fileInfo); assertTrue(fileInfo instanceof IFileInfo); - + IOption option = getOptionForFile((IFileInfo) fileInfo, OPTION_ID); assertNotNull(option); assertEquals(OPTION_VALUE_FILE, option.getValue()); assertFalse(option.isExtensionElement()); } - + ManagedBuildTestHelper.removeProject(testName); } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter.java index 482830e5b67..8b722df0c00 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter.java @@ -19,11 +19,12 @@ import org.eclipse.cdt.managedbuilder.core.IConvertManagedBuildObject; public class ProjectConverter implements IConvertManagedBuildObject { + @Override public IBuildObject convert(IBuildObject buildObj, String fromId, String toId, boolean isConfirmed) { String tmpDir = System.getProperty("java.io.tmpdir"); - + File outputFile = new File(tmpDir + "/converterOutput.txt"); try { FileWriter out = new FileWriter(outputFile); @@ -37,8 +38,8 @@ public class ProjectConverter implements IConvertManagedBuildObject { // e.printStackTrace(); System.out.println("Exception raised."); } - - + + return buildObj; } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter20.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter20.java index 55efd1428f0..c88b2188ff2 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter20.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter20.java @@ -20,14 +20,15 @@ import org.eclipse.cdt.managedbuilder.core.IConvertManagedBuildObject; public class ProjectConverter20 implements IConvertManagedBuildObject { + @Override public IBuildObject convert(IBuildObject buildObj, String fromId, String toId, boolean isConfirmed) { - + String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - + File outputFile = new File(tmpDir + "/converterOutput20.txt"); //$NON-NLS-1$ try { - FileWriter out = new FileWriter(outputFile); + FileWriter out = new FileWriter(outputFile); out.write("Converter for CDT 2.0 Project is invoked"); //$NON-NLS-1$ out.close(); } catch (IOException e) { diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter21.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter21.java index 7215e04c286..78b85e8bd75 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter21.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ProjectConverter21.java @@ -19,14 +19,15 @@ import org.eclipse.cdt.managedbuilder.core.IConvertManagedBuildObject; public class ProjectConverter21 implements IConvertManagedBuildObject { + @Override public IBuildObject convert(IBuildObject buildObj, String fromId, String toId, boolean isConfirmed) { - String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - + String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ + File outputFile = new File(tmpDir + "/converterOutput21.txt"); //$NON-NLS-1$ try { - FileWriter out = new FileWriter(outputFile); + FileWriter out = new FileWriter(outputFile); out.write("Converter for CDT 2.1 Project is invoked"); //$NON-NLS-1$ out.close(); } catch (IOException e) { diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ResourceBuildCoreTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ResourceBuildCoreTests.java index e5e1a42ccc0..5526f033d51 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ResourceBuildCoreTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ResourceBuildCoreTests.java @@ -49,21 +49,21 @@ import org.eclipse.core.runtime.NullProgressMonitor; public class ResourceBuildCoreTests extends TestCase { private static final boolean boolVal = true; - private static IProjectType exeType; + private static IProjectType exeType; private static IProjectType libType; private static IProjectType dllType; - - + + private static final String projectName = "T1"; private static final String renamedProjectName1 = "T1_1"; private static final String renamedProjectName2 = "T1_2"; - + public ResourceBuildCoreTests(String name) { super(name); } - + public static Test suite() { - TestSuite suite = new TestSuite(ResourceBuildCoreTests.class.getName()); + TestSuite suite = new TestSuite(ResourceBuildCoreTests.class.getName()); suite.addTest(new ResourceBuildCoreTests("testResourceConfigurations")); suite.addTest(new ResourceBuildCoreTests("testResourceConfigurationReset")); // suite.addTest(new ResourceBuildCoreTests("testResourceConfigurationBuildInfo")); @@ -73,20 +73,20 @@ public class ResourceBuildCoreTests extends TestCase { /** * Creates a couple of resource configurations. - * Checks whether the resource & project default build properties are same or not. + * Checks whether the resource & project default build properties are same or not. * Overrides project build properties and checks whether they are reflecting at resource level. * Overrides resource build properties and checks whether they are reflecting at project level. - * + * */ - + public void testResourceConfigurations() throws Exception { - + // Create a new project IProject project = null; - + try { project = createProject(projectName); - + // Now associate the builder with the project ManagedBuildTestHelper.addManagedBuildNature(project); IProjectDescription description = project.getDescription(); @@ -98,34 +98,34 @@ public class ResourceBuildCoreTests extends TestCase { } catch (CoreException e) { fail("Test failed on project creation: " + e.getLocalizedMessage()); } - + // Find the base project type definition IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes(); IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe"); assertNotNull(projType); - + // Create the managed-project (.cdtbuild) for our project that builds an executable. IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType); assertEquals(newProject.getName(), projType.getName()); assertFalse(newProject.equals(projType)); ManagedBuildManager.setNewProjectVersion(project); - + // Create a couple of resources ( 'main.c' & 'bar.c') IFile mainFile = project.getProject().getFile( "main.c" ); if( !mainFile.exists() ){ mainFile.create( new ByteArrayInputStream( "#include \n extern void bar(); \n int main() { \nprintf(\"Hello, World!!\"); \n bar();\n return 0; }".getBytes() ), false, null ); } - + IFile barFile = project.getProject().getFile( "bar.c" ); if( !barFile.exists() ){ barFile.create( new ByteArrayInputStream( "#include \n void bar() { \nprintf(\"Hello, bar()!!\");\n return; }".getBytes() ), false, null ); } - + // Get the configurations and make one of them as default configuration. IConfiguration defaultConfig = null; IConfiguration[] configs = projType.getConfigurations(); for (int i = 0; i < configs.length; ++i) { - // Make the first configuration the default + // Make the first configuration the default if (i == 0) { defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i); } else { @@ -137,16 +137,16 @@ public class ResourceBuildCoreTests extends TestCase { // Create Resource Configurations for files main.c and bar.c IResourceConfiguration resMainConfig = defaultConfig.createResourceConfiguration(mainFile); IResourceConfiguration resBarConfig = defaultConfig.createResourceConfiguration(barFile); - + // Check whether defaultConfig has two resource configurations or not. IResourceConfiguration resConfigs[] = defaultConfig.getResourceConfigurations(); assertEquals(2,resConfigs.length); - + // Get the tools associated with the resource 'main.c'. ITool resMainTools[] = resMainConfig.getTools(); assertNotNull(resMainTools); assertEquals(1,resMainTools.length); - + // Get the tools associated with the resource 'bar.c'. ITool resBarTools[] = resBarConfig.getTools(); assertNotNull(resBarTools); @@ -154,16 +154,16 @@ public class ResourceBuildCoreTests extends TestCase { // Get the build properties for the resource main.c ITool resMainTool = resMainTools[0]; - + String resMainBuildProps = resMainTool.getToolFlags(); - + // Get the build properties for the resource bar.c ITool resBarTool = resBarTools[0]; String resBarBuildProps = resBarTool.getToolFlags(); - + // Get file extension. String extString = mainFile.getFileExtension(); - + // Get the project build properties. ITool tools[] = defaultConfig.getFilteredTools(); Tool projTool = null; @@ -176,35 +176,35 @@ public class ResourceBuildCoreTests extends TestCase { break; } } - + // Initially, Project build properties and resource build properties are same. assertEquals(resMainBuildProps,projBuildProps); - + // Initially, build properties of files with same extension ( example , .c files) are equal. assertEquals(resMainBuildProps,resBarBuildProps); - + // Now modify project build properties and it should reflect in resource build properties also. - + IOption projDebugOption = projTool.getOptionById("testgnu.c.compiler.exe.debug.option.debugging.level"); - + assertNotNull(projDebugOption); - + // Override options in the default configuration. // Set the debug option value to '-g2' at Project level IOption newProjDebugOption = ManagedBuildManager.setOption(defaultConfig,projTool,projDebugOption,"testgnu.c.debugging.level.default"); - + // Get the option 'id' and 'value'. String newProjDebugOptionId = newProjDebugOption.getId(); String newProjDebugOptionValue = newProjDebugOption.getStringValue(); - + // Assert old & new(overridden) debug option values of project are different. assertNotSame(projDebugOption.getStringValue(),newProjDebugOptionValue); - - // Check whether the overridden option at project level is reflecting at resource level or not. + + // Check whether the overridden option at project level is reflecting at resource level or not. IOption resMainDebugOption = null; - + IOption resMainOptions[] = resMainTool.getOptions(); - + for(int i=0; i< resMainOptions.length; i++){ IOption opt = resMainOptions[i]; if( opt != null ) { @@ -217,27 +217,27 @@ public class ResourceBuildCoreTests extends TestCase { if(opt.getSuperClass().getId().equals(newProjDebugOptionId)){ // Resource Configuration does have overridden value for this option. resMainDebugOption = opt; - break; - } + break; + } } } } - + String resMainDebugOptionValue = resMainDebugOption.getStringValue(); - + // Assert Debug option values of project and resource are same. assertEquals(newProjDebugOptionValue, resMainDebugOptionValue); - + // Now, Modify the Debug option at resource level - // and verify whether the modified option is reflected at project level. + // and verify whether the modified option is reflected at project level. // It should not reflect at project level. - - IOption newResMainDebugOption = ManagedBuildManager.setOption(resMainConfig,resMainTool,resMainDebugOption,"gnu.c.debugging.level.minimal"); - + + IOption newResMainDebugOption = ManagedBuildManager.setOption(resMainConfig,resMainTool,resMainDebugOption,"gnu.c.debugging.level.minimal"); + //Get the latest project Debug option. tools = defaultConfig.getFilteredTools(); projTool = null; - + for (int i = 0; i < tools.length; i++) { if( tools[i].buildsFileType(extString) ) { // Get the build properties of a project in default configuration @@ -245,35 +245,35 @@ public class ResourceBuildCoreTests extends TestCase { break; } } - + projDebugOption = projTool.getOptionById(newProjDebugOptionId); String projDebugOptionValue = projDebugOption.getStringValue(); - + String newResMainDebugOptionValue = newResMainDebugOption.getStringValue(); - - // Assert the debug option values of project and resource are different. + + // Assert the debug option values of project and resource are different. assertNotSame(projDebugOptionValue, newResMainDebugOptionValue); - + // Close and remove project. project.close(null); removeProject(projectName); } - + /* * Creates a project and a resource(hello.c). * Overrides the build properties in resource configuration, and * resets the resource configuration, verifies whether the overridden * values still exist or not. */ - + public void testResourceConfigurationReset() throws Exception { - + // Create a new project IProject project = null; - + try { project = createProject(projectName); - + // Now associate the builder with the project ManagedBuildTestHelper.addManagedBuildNature(project); IProjectDescription description = project.getDescription(); @@ -285,29 +285,29 @@ public class ResourceBuildCoreTests extends TestCase { } catch (CoreException e) { fail("Test failed on project creation: " + e.getLocalizedMessage()); } - + // Find the base project type definition IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes(); IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe"); assertNotNull(projType); - + // Create the managed-project (.cdtbuild) for our project that builds an executable. IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType); assertEquals(newProject.getName(), projType.getName()); assertFalse(newProject.equals(projType)); ManagedBuildManager.setNewProjectVersion(project); - + // Create a resource ( 'hello.c') IFile helloFile = project.getProject().getFile( "hello.c" ); if( !helloFile.exists() ){ helloFile.create( new ByteArrayInputStream( "#include \n\n int main() { \nprintf(\"Hello, World!!\"); \n bar();\n return 0; }".getBytes() ), false, null ); } - + // Get the configurations and make one of them as default configuration. IConfiguration defaultConfig = null; IConfiguration[] configs = projType.getConfigurations(); for (int i = 0; i < configs.length; ++i) { - // Make the first configuration the default + // Make the first configuration the default if (i == 0) { defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i); } else { @@ -318,63 +318,63 @@ public class ResourceBuildCoreTests extends TestCase { // Create Resource Configurations for hello.c IResourceConfiguration resConfig = defaultConfig.createResourceConfiguration(helloFile); - + // Check whether defaultConfig has the correct number of resource configurations or not. IResourceConfiguration resConfigs[] = defaultConfig.getResourceConfigurations(); assertEquals(1,resConfigs.length); - + // Get the tools associated with the resource 'hello.c'. ITool resTools[] = resConfig.getTools(); assertNotNull(resTools); assertEquals(1,resTools.length); - + // Get the build properties for the resource hello.c ITool resTool = resTools[0]; String defaultResToolFlags = resTool.getToolFlags(); - + // Get the Debug Option. IOption resDebugOption = resTool.getOptionById("testgnu.c.compiler.exe.debug.option.debugging.level"); - + // Get the default value of debug option for resource. String defaultResDebugOptVal = resDebugOption.getStringValue(); - + // Now, override the value with "gnu.c.debugging.level.minimal" IOption newResDebugOption = ManagedBuildManager.setOption(resConfig,resTool,resDebugOption,"gnu.c.debugging.level.minimal"); - + // Get the overridden value of debug option. String newResDebugOptVal = newResDebugOption.getStringValue(); String newResToolFlags = resTool.getToolFlags(); - + // Make sure, default and overridden values are different. assertNotSame(defaultResDebugOptVal,newResDebugOptVal); - + // Reset the resource configuration. ManagedBuildManager.resetResourceConfiguration(project,resConfig); String resetResToolFlags = resTool.getToolFlags(); - + assertNotSame(resetResToolFlags,newResToolFlags); assertEquals(defaultResToolFlags,resetResToolFlags); - + // Close and remove project. project.close(null); removeProject(projectName); } - + /* * Creates a project and a couple of resources. - * Overrides the build properties of resources. Saves, closes, and reopens + * Overrides the build properties of resources. Saves, closes, and reopens * the project. Then, checks the overridden options. Basically, this function * tests persisting overridden resource build properties between project sessions. */ - + public void testResourceConfigurationBuildInfo() throws Exception { - + // Create a new project IProject project = null; - + try { project = createProject(projectName); - + // Now associate the builder with the project ManagedBuildTestHelper.addManagedBuildNature(project); IProjectDescription description = project.getDescription(); @@ -386,34 +386,34 @@ public class ResourceBuildCoreTests extends TestCase { } catch (CoreException e) { fail("Test failed on project creation: " + e.getLocalizedMessage()); } - + // Find the base project type definition IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes(); IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe"); assertNotNull(projType); - + // Create the managed-project (.cdtbuild) for our project that builds an executable. IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType); assertEquals(newProject.getName(), projType.getName()); assertFalse(newProject.equals(projType)); ManagedBuildManager.setNewProjectVersion(project); - + // Create a couple of resources ( 'main.c' & 'bar.c') IFile mainFile = project.getProject().getFile( "main.c" ); if( !mainFile.exists() ){ mainFile.create( new ByteArrayInputStream( "#include \n extern void bar(); \n int main() { \nprintf(\"Hello, World!!\"); \n bar();\n return 0; }".getBytes() ), false, null ); } - + IFile barFile = project.getProject().getFile( "bar.c" ); if( !barFile.exists() ){ barFile.create( new ByteArrayInputStream( "#include \n void bar() { \nprintf(\"Hello, bar()!!\");\n return; }".getBytes() ), false, null ); } - + // Get the configurations and make one of them as default configuration. IConfiguration defaultConfig = null; IConfiguration[] configs = projType.getConfigurations(); for (int i = 0; i < configs.length; ++i) { - // Make the first configuration the default + // Make the first configuration the default if (i == 0) { defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i); } else { @@ -421,14 +421,14 @@ public class ResourceBuildCoreTests extends TestCase { } } ManagedBuildManager.setDefaultConfiguration(project, defaultConfig); - + // Get the default configuration id. String defaultConfigId = defaultConfig.getId(); // Create Resource Configurations for files main.c and bar.c IResourceConfiguration resMainConfig = defaultConfig.createResourceConfiguration(mainFile); IResourceConfiguration resBarConfig = defaultConfig.createResourceConfiguration(barFile); - + // Check whether defaultConfig has two resource configurations or not. IResourceConfiguration resConfigs[] = defaultConfig.getResourceConfigurations(); assertEquals(2,resConfigs.length); @@ -436,12 +436,12 @@ public class ResourceBuildCoreTests extends TestCase { // Get the paths of resource configurations. String resMainPath = resMainConfig.getResourcePath(); String resBarPath = resBarConfig.getResourcePath(); - + // Get the tools associated with the resource 'main.c'. ITool resMainTools[] = resMainConfig.getTools(); assertNotNull(resMainTools); assertEquals(1,resMainTools.length); - + // Get the tools associated with the resource 'bar.c'. ITool resBarTools[] = resBarConfig.getTools(); assertNotNull(resBarTools); @@ -449,133 +449,133 @@ public class ResourceBuildCoreTests extends TestCase { // Get the build properties for the resource main.c ITool resMainTool = resMainTools[0]; - + String defaultMainBuildProps = resMainTool.getToolFlags(); - + // Get the build properties for the resource bar.c ITool resBarTool = resBarTools[0]; String defaultBarBuildProps = resBarTool.getToolFlags(); - - + + // Now, override debug and optimization options. // In Debug Configuration, Currently default values in resource configurations are // optimization : -O0, debug : -g3 // Override the options in the following way. // main.c : optimization : '-O1' debug : '-g1' // bar.c : optimization : '-O2' debug : '-g2' - + IOption defaultResMainOptOption = resMainTool.getOptionById("testgnu.c.compiler.exe.debug.option.optimization.level"); String defaultResMainOptVal = defaultResMainOptOption.getStringValue(); - + IOption resMainOptOption = ManagedBuildManager.setOption(resMainConfig,resMainTool,defaultResMainOptOption,"gnu.c.optimization.level.optimize"); String resMainOptVal = resMainOptOption.getStringValue(); - + IOption defaultResMainDebugOption = resMainTool.getOptionById("testgnu.c.compiler.exe.debug.option.debugging.level"); String defaultResMainDebugVal = defaultResMainDebugOption.getStringValue(); - + IOption resMainDebugOption = ManagedBuildManager.setOption(resMainConfig,resMainTool,defaultResMainDebugOption,"gnu.c.debugging.level.minimal"); String resMainDebugVal = resMainDebugOption.getStringValue(); - + IOption defaultResBarOptOption = resBarTool.getOptionById("testgnu.c.compiler.exe.debug.option.optimization.level"); String defaultResBarOptVal = defaultResBarOptOption.getStringValue(); - + IOption resBarOptOption = ManagedBuildManager.setOption(resBarConfig,resBarTool,defaultResBarOptOption,"gnu.c.optimization.level.more"); String resBarOptVal = resBarOptOption.getStringValue(); - + IOption defaultResBarDebugOption = resBarTool.getOptionById("testgnu.c.compiler.exe.debug.option.debugging.level"); String defaultResBarDebugVal = defaultResBarDebugOption.getStringValue(); - + IOption resBarDebugOption = ManagedBuildManager.setOption(resBarConfig,resBarTool,defaultResBarDebugOption,"gnu.c.debugging.level.default"); String resBarDebugVal = resBarDebugOption.getStringValue(); - + assertNotSame(defaultResMainOptVal, resMainOptVal); assertNotSame(defaultResMainDebugVal, resMainDebugVal); - + assertNotSame(defaultResBarOptVal, resBarOptVal); assertNotSame(defaultResBarDebugVal, resBarDebugVal); - + // Save and Close the project. ManagedBuildManager.saveBuildInfo(project,false); ManagedBuildManager.removeBuildInfo(project); - + project.close(null); - + // Now reopen the project. project.open(null); - + // Get the build info. IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); IManagedProject newManagedProj = info.getManagedProject(); - + // Verify that there are only two configurations. - IConfiguration[] definedConfigs = newManagedProj.getConfigurations(); + IConfiguration[] definedConfigs = newManagedProj.getConfigurations(); assertEquals(2, definedConfigs.length); - + // Get the default configuration and verify whether it is same as before. IConfiguration newDefaultConfig = info.getDefaultConfiguration(); - + assertEquals(defaultConfigId, newDefaultConfig.getId()); - + // Get the resource configurations in defaultConfig IResourceConfiguration newResConfigs[] = newDefaultConfig.getResourceConfigurations(); - + assertEquals(2, newResConfigs.length); - - // Get the resource configuration for main.c using the path '/T1/main.c' + + // Get the resource configuration for main.c using the path '/T1/main.c' IResourceConfiguration newResMainConfig = newDefaultConfig.getResourceConfiguration(resMainPath); assertNotNull(newResMainConfig); - + ITool newResMainTools[] = newResMainConfig.getTools(); assertEquals(1,newResMainTools.length); - + // Get the Optimization and Debug option values for the resource 'main.c'. ITool newResMainTool = newResMainTools[0]; - + IOption newResMainOptOption = newResMainTool.getOptionById(resMainOptOption.getId()); assertNotNull(newResMainOptOption); String newResMainOptVal = newResMainOptOption.getStringValue(); - + IOption newResMainDebugOption = newResMainTool.getOptionById(resMainDebugOption.getId()); assertNotNull(newResMainDebugOption); String newResMainDebugVal = newResMainDebugOption.getStringValue(); - + // Assert that optimization & debug option values for the resource main.c are same between the sessions. assertEquals(resMainOptVal, newResMainOptVal); assertEquals(resMainDebugVal,newResMainDebugVal); - + // Get the resource configuration for bar.c IResourceConfiguration newResBarConfig = newDefaultConfig.getResourceConfiguration(resBarPath); assertNotNull(newResBarConfig); - + ITool newResBarTools[] = newResBarConfig.getTools(); assertEquals(1,newResBarTools.length); - + //Get the Optimization and Debug option values for the resource 'bar.c' ITool newResBarTool = newResBarTools[0]; - + IOption newResBarOptOption = newResBarTool.getOptionById(resBarOptOption.getId()); assertNotNull(newResBarOptOption); String newResBarOptVal = newResBarOptOption.getStringValue(); - + IOption newResBarDebugOption = newResBarTool.getOptionById(resBarDebugOption.getId()); assertNotNull(newResBarDebugOption); String newResBarDebugVal = newResBarDebugOption.getStringValue(); - + // Assert that optimization & debug option values for the resource main.c are same between the sessions. assertEquals(resBarOptVal, newResBarOptVal); assertEquals(resBarDebugVal,newResBarDebugVal); - + // Close and remove project. project.close(null); removeProject(projectName); - + } - + private IProject createProject(String name) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IProject newProjectHandle = root.getProject(name); IProject project = null; - + if (!newProjectHandle.exists()) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription workspaceDesc = workspace.getDescription(); @@ -587,6 +587,7 @@ public class ResourceBuildCoreTests extends TestCase { } else { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -595,19 +596,19 @@ public class ResourceBuildCoreTests extends TestCase { workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor); project = newProjectHandle; } - + // Open the project if we have to if (!project.isOpen()) { project.open(new NullProgressMonitor()); } - - return project; + + return project; } - + /** - * Remove the IProject with the name specified in the argument from the + * Remove the IProject with the name specified in the argument from the * receiver's workspace. - * + * * @param name */ private void removeProject(String name) { @@ -628,7 +629,7 @@ public class ResourceBuildCoreTests extends TestCase { } } } - + public void testProjectCreation() throws BuildException { // Create new project IProject project = null; @@ -645,23 +646,23 @@ public class ResourceBuildCoreTests extends TestCase { } catch (CoreException e) { fail("Test failed on project creation: " + e.getLocalizedMessage()); } - + // Find the base project type definition IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes(); IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe"); assertNotNull(projType); - + // Create the managed-project (.cdtbuild) for our project that builds a dummy executable IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType); assertEquals(newProject.getName(), projType.getName()); assertFalse(newProject.equals(projType)); ManagedBuildManager.setNewProjectVersion(project); - + // Copy over the configs IConfiguration defaultConfig = null; IConfiguration[] configs = projType.getConfigurations(); for (int i = 0; i < configs.length; ++i) { - // Make the first configuration the default + // Make the first configuration the default if (i == 0) { defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i); } else { @@ -675,10 +676,10 @@ public class ResourceBuildCoreTests extends TestCase { if (initResult.getCode() != IStatus.OK) { fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage()); } - + // Now test the results out // checkRootManagedProject(newProject, "x"); - + // Override the "String Option in Category" option value configs = newProject.getConfigurations(); ITool[] tools = configs[0].getTools(); @@ -696,7 +697,7 @@ public class ResourceBuildCoreTests extends TestCase { tool = (ITool)options[0][0]; option = (IOption)options[0][1]; assertEquals("z", option.getStringValue()); - + // Save, close, reopen and test again ManagedBuildManager.saveBuildInfo(project, true); ManagedBuildManager.removeBuildInfo(project); @@ -710,27 +711,27 @@ public class ResourceBuildCoreTests extends TestCase { } catch (CoreException e) { fail("Failed on project open: " + e.getLocalizedMessage()); } - + // Test that the default config was remembered IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); assertEquals(defaultConfig.getId(), info.getDefaultConfiguration().getId()); // Check the rest of the default information // checkRootManagedProject(newProject, "z"); - + // Now test the information the makefile builder needs // checkBuildTestSettings(info); ManagedBuildManager.removeBuildInfo(project); } - + public void testResourceRename() throws Exception { // Create a new project IProject project = null; IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - + try { project = createProject(projectName); - + // Now associate the builder with the project ManagedBuildTestHelper.addManagedBuildNature(project); IProjectDescription description = project.getDescription(); @@ -742,24 +743,24 @@ public class ResourceBuildCoreTests extends TestCase { } catch (CoreException e) { fail("Test failed on project creation: " + e.getLocalizedMessage()); } - + // Find the base project type definition IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes(); IProjectType projType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu21.exe"); assertNotNull(projType); - + // Create the managed-project (.cdtbuild) for our project that builds an executable. IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType); assertEquals(newProject.getName(), projType.getName()); assertFalse(newProject.equals(projType)); ManagedBuildManager.setNewProjectVersion(project); - + // Create a couple of resources ( 'main.c' & 'bar.c') IFile mainFile = project.getProject().getFile( "main.c" ); if( !mainFile.exists() ){ mainFile.create( new ByteArrayInputStream( "#include \n extern void bar(); \n int main() { \nprintf(\"Hello, World!!\"); \n bar();\n return 0; }".getBytes() ), false, null ); } - + IFile aFile = project.getProject().getFile( "a.c" ); if( !aFile.exists() ){ aFile.create( new ByteArrayInputStream( "#include \n void bar() { \nprintf(\"Hello, bar()!!\");\n return; }".getBytes() ), false, null ); @@ -777,7 +778,7 @@ public class ResourceBuildCoreTests extends TestCase { IConfiguration defaultConfig = null; IConfiguration[] configs = projType.getConfigurations(); for (int i = 0; i < configs.length; ++i) { - // Make the first configuration the default + // Make the first configuration the default if (i == 0) { defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i); } else { @@ -790,7 +791,7 @@ public class ResourceBuildCoreTests extends TestCase { IResourceConfiguration resMainConfig = defaultConfig.createResourceConfiguration(mainFile); IResourceConfiguration resAConfig = defaultConfig.createResourceConfiguration(aFile); IResourceConfiguration resBConfig = defaultConfig.createResourceConfiguration(bFile); - + // Check whether defaultConfig has three resource configurations or not. IResourceConfiguration resConfigs[] = defaultConfig.getResourceConfigurations(); assertEquals(resMainConfig,defaultConfig.getResourceConfiguration(mainFile.getFullPath().toString())); @@ -798,7 +799,7 @@ public class ResourceBuildCoreTests extends TestCase { assertEquals(resBConfig,defaultConfig.getResourceConfiguration(bFile.getFullPath().toString())); assertEquals(3,resConfigs.length); - + mainFile.move(mainFile.getFullPath().removeLastSegments(1).append("main1.c"),true,false,null); mainFile = (IFile)project.findMember("main1.c"); assertEquals(resMainConfig,defaultConfig.getResourceConfiguration(mainFile.getFullPath().toString())); @@ -837,8 +838,8 @@ public class ResourceBuildCoreTests extends TestCase { assertEquals(resBConfig,defaultConfig.getResourceConfiguration(bFile.getFullPath().toString())); resConfigs = defaultConfig.getResourceConfigurations(); assertEquals(3,resConfigs.length); - - final IResource rcBuf[] = new IResource[5]; + + final IResource rcBuf[] = new IResource[5]; rcBuf[0] = project; rcBuf[1] = mainFile; rcBuf[2] = aFile; @@ -847,6 +848,7 @@ public class ResourceBuildCoreTests extends TestCase { ResourcesPlugin.getWorkspace().run( new IWorkspaceRunnable(){ + @Override public void run(IProgressMonitor monitor) throws CoreException { IProject project = (IProject)rcBuf[0]; IFile mainFile = (IFile)rcBuf[1]; @@ -874,19 +876,19 @@ public class ResourceBuildCoreTests extends TestCase { aFile = (IFile)project.findMember("a.c"); dirFolder = (IFolder)project.findMember("dir2"); bFile = (IFile)dirFolder.findMember("b2.c"); - + rcBuf[0] = project; rcBuf[1] = mainFile; rcBuf[2] = aFile; rcBuf[3] = dirFolder; rcBuf[4] = bFile; } - - }, + + }, root, IWorkspace.AVOID_UPDATE, null); - + project = (IProject)rcBuf[0]; mainFile = (IFile)rcBuf[1]; aFile = (IFile)rcBuf[2]; @@ -898,7 +900,7 @@ public class ResourceBuildCoreTests extends TestCase { assertEquals(resBConfig,defaultConfig.getResourceConfiguration(bFile.getFullPath().toString())); resConfigs = defaultConfig.getResourceConfigurations(); assertEquals(3,resConfigs.length); - + aFile.delete(true,null); // Check whether defaultConfig has two resource configurations or not. assertEquals(resMainConfig,defaultConfig.getResourceConfiguration(mainFile.getFullPath().toString())); @@ -906,7 +908,7 @@ public class ResourceBuildCoreTests extends TestCase { assertEquals(resBConfig,defaultConfig.getResourceConfiguration(bFile.getFullPath().toString())); resConfigs = defaultConfig.getResourceConfigurations(); assertEquals(2,resConfigs.length); - + dirFolder.delete(true, null); // Check whether defaultConfig has one resource configuration or not. assertEquals(resMainConfig,defaultConfig.getResourceConfiguration(mainFile.getFullPath().toString())); @@ -919,5 +921,5 @@ public class ResourceBuildCoreTests extends TestCase { project.close(null); removeProject(renamedProjectName2); } - -} + +} diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/Test30_2_CommandLineGenerator.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/Test30_2_CommandLineGenerator.java index cfea1dc9968..8a636b307b6 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/Test30_2_CommandLineGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/Test30_2_CommandLineGenerator.java @@ -12,8 +12,8 @@ package org.eclipse.cdt.managedbuilder.core.tests; import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator; import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo; -import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.IOption; +import org.eclipse.cdt.managedbuilder.core.ITool; /** * Test command line generator @@ -35,12 +35,12 @@ public class Test30_2_CommandLineGenerator implements public final String WHITESPACE = " "; //$NON-NLS-1$ public final String WILDCARD = "%"; //$NON-NLS-1$ public final String UNDERLINE = "_"; //$NON-NLS-1$ - + public final String VAR_FIRST_CHAR = "$"; //$NON-NLS-1$ - public final char VAR_SECOND_CHAR = '{'; //$NON-NLS-1$ + public final char VAR_SECOND_CHAR = '{'; public final String VAR_FINAL_CHAR = "}"; //$NON-NLS-1$ public final String CLASS_PROPERTY_PREFIX = "get"; //$NON-NLS-1$ - + public final String CMD_LINE_PRM_NAME = "COMMAND"; //$NON-NLS-1$ public final String FLAGS_PRM_NAME = "FLAGS"; //$NON-NLS-1$ public final String OUTPUT_FLAG_PRM_NAME = "OUTPUT_FLAG"; //$NON-NLS-1$ @@ -51,6 +51,7 @@ public class Test30_2_CommandLineGenerator implements /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator#generateCommandLineInfo(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String[], java.lang.String) */ + @Override public IManagedCommandLineInfo generateCommandLineInfo(ITool tool, String commandName, String[] flags, String outputFlag, String outputPrefix, String outputName, String[] inputResources, diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestConfigElement.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestConfigElement.java index 78095911b7c..697dd541dd0 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestConfigElement.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestConfigElement.java @@ -19,12 +19,12 @@ import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement; import org.eclipse.core.runtime.IExtension; public class TestConfigElement implements IManagedConfigElement { - + private String name; private Map attributeMap; private IManagedConfigElement[] children; - - public TestConfigElement(String name, String[][] attributes, + + public TestConfigElement(String name, String[][] attributes, IManagedConfigElement[] children) { this.name = name; this.children = children; @@ -33,10 +33,11 @@ public class TestConfigElement implements IManagedConfigElement { attributeMap.put(attributes[i][0], attributes[i][1]); } } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getName() */ + @Override public String getName() { return name; } @@ -44,6 +45,7 @@ public class TestConfigElement implements IManagedConfigElement { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getAttribute(java.lang.String) */ + @Override public String getAttribute(String name) { return attributeMap.get(name); } @@ -51,6 +53,7 @@ public class TestConfigElement implements IManagedConfigElement { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren() */ + @Override public IManagedConfigElement[] getChildren() { return children; } @@ -58,6 +61,7 @@ public class TestConfigElement implements IManagedConfigElement { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren(java.lang.String) */ + @Override public IManagedConfigElement[] getChildren(String elementName) { List ret = new ArrayList(children.length); for (int i = 0; i < children.length; i++) { @@ -73,5 +77,5 @@ public class TestConfigElement implements IManagedConfigElement { */ public IExtension getExtension() { return null; - } + } } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestConfigurationNameProvider.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestConfigurationNameProvider.java index a8ad690f5bc..bd7d54cb664 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestConfigurationNameProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestConfigurationNameProvider.java @@ -20,15 +20,16 @@ public class TestConfigurationNameProvider implements /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider#getNewConfigurationName(org.eclipse.cdt.managedbuilder.core.IConfiguration, * java.lang.String[]) This function will generate a unique * configuration name based on used names, current OS and current * Architecture. - * + * */ private static int configNumber = 0; + @Override public String getNewConfigurationName(IConfiguration configuration, String[] usedConfigurationNames) { diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestLinkerNameProvider.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestLinkerNameProvider.java index 584e1ff80f7..830690f55ef 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestLinkerNameProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestLinkerNameProvider.java @@ -12,14 +12,15 @@ package org.eclipse.cdt.managedbuilder.core.tests; import org.eclipse.cdt.managedbuilder.core.IManagedOutputNameProvider; -import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.IOption; +import org.eclipse.cdt.managedbuilder.core.ITool; +import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator; public class TestLinkerNameProvider implements IManagedOutputNameProvider { + @Override public IPath[] getOutputNames(ITool tool, IPath[] primaryInputNames) { IPath[] name = new IPath[1]; boolean isSO = false; @@ -43,7 +44,7 @@ public class TestLinkerNameProvider implements IManagedOutputNameProvider { name[0] = Path.fromOSString(primaryInputNames[0].removeFileExtension().addFileExtension("so").lastSegment()); //$NON-NLS-1$ } return name; - } + } String fileName = "default"; //$NON-NLS-1$ if (primaryInputNames != null && primaryInputNames.length > 0) { fileName = primaryInputNames[0].removeFileExtension().toString(); diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestMacro.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestMacro.java index 9df2e7ab869..aaafd5e7807 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestMacro.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestMacro.java @@ -37,11 +37,11 @@ import org.eclipse.core.runtime.MultiStatus; import org.osgi.framework.Version; /** - * + * * */ -public class TestMacro implements - IConfigurationBuildMacroSupplier, +public class TestMacro implements + IConfigurationBuildMacroSupplier, IProjectBuildMacroSupplier, IReservedMacroNameSupplier, IConfigurationEnvironmentVariableSupplier, @@ -52,35 +52,37 @@ public class TestMacro implements public static boolean supported[] = {false, false, false, false, false}; public static IPath topBuildDir = null; - + public static String CFG_VAR = "CFG_PROVIDER_VAR"; //$NON-NLS-1$ public static String PRJ_VAR = "PRJ_PROVIDER_VAR"; //$NON-NLS-1$ - + // IConfigurationBuildMacroSupplier - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier#getMacro(java.lang.String, org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider) */ + @Override public IBuildMacro getMacro(String macroName, IConfiguration configuration, IBuildMacroProvider provider) { ManagedBuildMacrosTests.functionCalled |= ManagedBuildMacrosTests.GET_ONE_CONFIG; - + IBuildMacro ms = null; if (!(provider instanceof TestMacro)) { - ms = provider.getMacro(macroName, + ms = provider.getMacro(macroName, IBuildMacroProvider.CONTEXT_CONFIGURATION, configuration, false); } return ms; } + @Override public IBuildMacro getMacro(String macroName, IManagedProject mproj, IBuildMacroProvider provider) { ManagedBuildMacrosTests.functionCalled |= ManagedBuildMacrosTests.GET_ONE_PROJECT; IBuildMacro ms = null; if (!(provider instanceof TestMacro)) { - ms = provider.getMacro(macroName, + ms = provider.getMacro(macroName, IBuildMacroProvider.CONTEXT_PROJECT, mproj, false); } @@ -88,10 +90,11 @@ public class TestMacro implements } // IProjectBuildMacroSupplier - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier#getMacros(org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider) */ + @Override public IBuildMacro[] getMacros(IConfiguration configuration, IBuildMacroProvider provider) { ManagedBuildMacrosTests.functionCalled |= ManagedBuildMacrosTests.GET_MANY_CONFIG; @@ -112,8 +115,9 @@ public class TestMacro implements } /** - * + * */ + @Override public IBuildMacro[] getMacros(IManagedProject mproj, IBuildMacroProvider provider) { ManagedBuildMacrosTests.functionCalled |= ManagedBuildMacrosTests.GET_MANY_PROJECT; @@ -134,22 +138,24 @@ public class TestMacro implements } // IReservedMacroNameSupplier - + /** - * + * */ + @Override public boolean isReservedName(String macroName, IConfiguration configuration) { ManagedBuildMacrosTests.functionCalled |= ManagedBuildMacrosTests.RESERVED_NAME; if (macroName.equalsIgnoreCase("USERNAME")) return true; //$NON-NLS-1$ return false; } - + // IConfigurationEnvironmentVariableSupplier - + /** - * + * */ - public IBuildEnvironmentVariable getVariable(String variableName, + @Override + public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) { if (CFG_VAR.equals(variableName)) { @@ -159,8 +165,9 @@ public class TestMacro implements } /** - * + * */ + @Override public IBuildEnvironmentVariable[] getVariables (IConfiguration configuration, IEnvironmentVariableProvider provider) { IBuildEnvironmentVariable v = getVariable(CFG_VAR, configuration, provider); @@ -168,16 +175,17 @@ public class TestMacro implements IBuildEnvironmentVariable[] vs = new IBuildEnvironmentVariable[1]; vs[0] = v; return(vs); - } else + } else return null; } - + // IProjectEnvironmentVariableSupplier - + /** - * + * */ - public IBuildEnvironmentVariable getVariable(String variableName, + @Override + public IBuildEnvironmentVariable getVariable(String variableName, IManagedProject project, IEnvironmentVariableProvider provider) { if (PRJ_VAR.equals(variableName)) { @@ -185,10 +193,11 @@ public class TestMacro implements } else return null; } - + /** - * + * */ + @Override public IBuildEnvironmentVariable[] getVariables (IManagedProject project, IEnvironmentVariableProvider provider) { IBuildEnvironmentVariable v = getVariable(PRJ_VAR, project, provider); @@ -196,16 +205,17 @@ public class TestMacro implements IBuildEnvironmentVariable[] vs = new IBuildEnvironmentVariable[1]; vs[0] = v; return(vs); - } else + } else return null; } - + // IManagedIsToolChainSupported - + /** - * + * */ + @Override public boolean isSupported(IToolChain toolChain, Version version, String instance) { if ("One".equals(toolChain.getParent().getName())) return supported[0]; //$NON-NLS-1$ if ("Two".equals(toolChain.getParent().getName())) return supported[1]; //$NON-NLS-1$ @@ -214,22 +224,30 @@ public class TestMacro implements return false; } - + // IManagedBuilderMakefileGenerator - + /** */ + @Override public IPath getBuildWorkingDir() { -// System.out.println("---- getBuildWorkingDir: " + topBuildDir); - return topBuildDir; +// System.out.println("---- getBuildWorkingDir: " + topBuildDir); + return topBuildDir; } + @Override public void generateDependencies() {} + @Override public MultiStatus generateMakefiles(IResourceDelta delta) { return null; } + @Override public String getMakefileName() {return "test_instead_make"; } //$NON-NLS-1$ + @Override public void initialize(IProject project, IManagedBuildInfo info, IProgressMonitor monitor) { -// System.out.println("---- init: " + topBuildDir); +// System.out.println("---- init: " + topBuildDir); } + @Override public boolean isGeneratedResource(IResource resource) { return false; } + @Override public void regenerateDependencies(boolean force) {} + @Override public MultiStatus regenerateMakefiles() { return null; } } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestManagedConfigProvider.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestManagedConfigProvider.java index d40a5877b30..342229bc916 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestManagedConfigProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestManagedConfigProvider.java @@ -24,6 +24,7 @@ public class TestManagedConfigProvider implements IManagedConfigElementProvider /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigProvider#getConfigElements() */ + @Override public IManagedConfigElement[] getConfigElements() { try { Properties props = new Properties(); @@ -45,19 +46,19 @@ public class TestManagedConfigProvider implements IManagedConfigElementProvider private IManagedConfigElement createTarget(String targetId, String command) { IManagedConfigElement toolRef = new TestConfigElement( - IConfigurationV2.TOOLREF_ELEMENT_NAME, + IConfigurationV2.TOOLREF_ELEMENT_NAME, new String[][] { {ITool.ID, "test.forward.tool"}, {ITool.COMMAND, command}}, new IManagedConfigElement[0]); IManagedConfigElement config = new TestConfigElement( - IConfigurationV2.CONFIGURATION_ELEMENT_NAME, + IConfigurationV2.CONFIGURATION_ELEMENT_NAME, new String[][] { {IConfigurationV2.ID, targetId + ".config"}, {IConfigurationV2.NAME, "test.forward.config"}}, new IManagedConfigElement[] {toolRef}); - + IManagedConfigElement target = new TestConfigElement( ITarget.TARGET_ELEMENT_NAME, new String[][] { @@ -68,7 +69,7 @@ public class TestManagedConfigProvider implements IManagedConfigElementProvider {ITarget.IS_TEST, "true"}, {ITarget.OS_LIST, "win32,linux,solaris"}}, new IManagedConfigElement[] {config}); - + return target; } } diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestPathConverter1.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestPathConverter1.java index e0887e540ae..c26832efe2d 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestPathConverter1.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestPathConverter1.java @@ -24,6 +24,7 @@ public class TestPathConverter1 implements IOptionPathConverter { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IOptionPathConverter#convertToPlatformLocation(java.lang.String) */ + @Override public IPath convertToPlatformLocation(String toolSpecificPath, IOption option, ITool tool) { Path path = new Path(toolSpecificPath); return path ; diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestProjectConverter.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestProjectConverter.java index 1f3a06a26df..3fa5298d40d 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestProjectConverter.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/TestProjectConverter.java @@ -24,14 +24,15 @@ public class TestProjectConverter implements IConvertManagedBuildObject { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConvertManagedBuildObject#convert(org.eclipse.cdt.managedbuilder.core.IBuildObject, java.lang.String, java.lang.String, boolean) */ + @Override public IBuildObject convert(IBuildObject buildObj, String fromId, String toId, boolean isConfirmed) { - + String tmpDir = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - + File outputFile = new File(tmpDir + "/testProjectConverterOutput.txt"); //$NON-NLS-1$ try { - FileWriter out = new FileWriter(outputFile); + FileWriter out = new FileWriter(outputFile); out.write("The converter for the projectType testProject_1.0.0 is invoked"); //$NON-NLS-1$ out.close(); } catch (IOException e) { diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/projectmodel/tests/ProjectModelTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/projectmodel/tests/ProjectModelTests.java index bcaac093963..d0ba05072c4 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/projectmodel/tests/ProjectModelTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/projectmodel/tests/ProjectModelTests.java @@ -66,30 +66,31 @@ import org.eclipse.core.runtime.Path; public class ProjectModelTests extends TestCase implements IElementChangedListener{ private boolean isPrint = false; private CDefaultModelEventChecker fEventChecker; - + + @Override public void elementChanged(ElementChangedEvent event) { if(fEventChecker != null) fEventChecker.checkEvent(event); } - + private class CDefaultModelEventChecker { void checkEvent(ElementChangedEvent event) { assertEquals(ElementChangedEvent.POST_CHANGE, event.getType()); - + ICElementDelta delta = event.getDelta(); if (isPrint) System.out.println(delta.toString()); } - + } - - + + public static Test suite() { return new TestSuite(ProjectModelTests.class); } - + @Override protected void setUp() throws Exception { super.setUp(); @@ -108,12 +109,12 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen ICLanguageSetting ls = fiDes.getLanguageSetting(); modify(ls); } - + private void modify(ICFolderDescription foDes){ ICLanguageSetting ls = foDes.getLanguageSettingForFile("a.c"); modify(ls); } - + private void modify(ICLanguageSetting ls){ List list = ls.getSettingEntriesList(ICSourceEntry.INCLUDE_PATH); list.add(new CIncludePathEntry("_modify_", 0)); @@ -124,7 +125,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen CLanguageData lData = fiInfo.getCLanguageDatas()[0]; modify(lData); } - + private void modify(CLanguageData lData){ ICLanguageSettingEntry[] entries = lData.getEntries(ICSourceEntry.INCLUDE_PATH); ICLanguageSettingEntry[] updatedEntries = new ICLanguageSettingEntry[entries.length + 1]; @@ -139,25 +140,25 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen CoreModel coreModel = CoreModel.getDefault(); ICProjectDescription des = coreModel.getProjectDescription(project); assertNull("detDescription1 returned not null!", des); - + des = coreModel.createProjectDescription(project, true); assertNotNull("createDescription returned null!", des); - + assertNull("detDescription2 returned not null!", coreModel.getProjectDescription(project)); - + assertFalse("new des should be not valid", des.isValid()); - + assertEquals(0, des.getConfigurations().length); - + ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); IProjectType type = ManagedBuildManager.getProjectType("cdt.managedbuild.target.gnu30.exe"); assertNotNull("project type not found", type); ManagedProject mProj = new ManagedProject(project, type); info.setManagedProject(mProj); - + IConfiguration cfgs[] = type.getConfigurations(); - + for(int i = 0; i < cfgs.length; i++){ String id = ManagedBuildManager.calculateChildId(cfgs[i].getId(), null); @@ -167,24 +168,24 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen des.createConfiguration("org.eclipse.cdt.managedbuilder.core.configurationDataProvider", data); } coreModel.setProjectDescription(project, des); - + IWorkspace wsp = ResourcesPlugin.getWorkspace(); - IWorkspaceRoot root = wsp.getRoot(); + IWorkspaceRoot root = wsp.getRoot(); project.delete(false, true, new NullProgressMonitor()); - + project = root.getProject(projectName); des = coreModel.getProjectDescription(project); assertNull("project description is not null for removed project", des); - + project = createProject(projectName); des = coreModel.getProjectDescription(project); assertNotNull("project description is null for re-created project", des); assertTrue("des should be valid for re-created project", des.isValid()); - + ICConfigurationDescription cfgDess[] = des.getConfigurations(); - + assertEquals(2, cfgDess.length); - + ICConfigurationDescription cfgDes = cfgDess[0]; ICResourceDescription rcDess[] = cfgDes.getResourceDescriptions(); assertEquals(1, rcDess.length); @@ -196,27 +197,27 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen assertEquals(cfgDes.getRootFolderDescription(), cfgDes.getResourceDescription(new Path("ds/sd/sdf/"), false)); assertEquals(cfgDes.getRootFolderDescription(), cfgDes.getResourceDescription(new Path(""), true)); assertEquals(null, cfgDes.getResourceDescription(new Path("ds/sd/sdf/"), true)); - + ICFileDescription fd_abc = cfgDes.createFileDescription(new Path("a/b/c.c"), rcDess[0]); - + assertTrue(cfgDes.isModified()); modify(fd_abc); - + ICProjectDescription anotherDes = coreModel.getProjectDescription(project); assertNotNull("project description is null for re-created project", des); assertTrue("des should be valid for re-created project", des.isValid()); - + ICConfigurationDescription anotherCfgDess[] = anotherDes.getConfigurations(); - + assertEquals(2, anotherCfgDess.length); - + ICConfigurationDescription anotherCfgDes = anotherCfgDess[0]; ICResourceDescription anotherRcDess[] = anotherCfgDes.getResourceDescriptions(); assertEquals(1, anotherRcDess.length); assertEquals(anotherCfgDes.getRootFolderDescription(), anotherRcDess[0]); assertFalse(anotherCfgDes.isModified()); - + CConfigurationData cfgData = cfgDes.getConfigurationData(); assertEquals(cfgData, cfgDes.getConfigurationData()); IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDes); @@ -229,7 +230,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen assertEquals(2, cfgDes.getResourceDescriptions().length); assertEquals(0, nestedFos.length); assertEquals(1, nestedFis.length); - + ICFileDescription fd_asd = cfgDes.createFileDescription(new Path("a/s/d.c"), cfgDes.getRootFolderDescription()); modify(fd_asd); assertEquals(3, cfgDes.getResourceDescriptions().length); @@ -237,7 +238,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen nestedFos = rf.getNestedResourceDescriptions(ICSettingBase.SETTING_FOLDER); assertEquals(0, nestedFos.length); assertEquals(2, nestedFis.length); - + IFileInfo fi = cfg.createFileInfo(new Path("z/x/c.c")); modify(fi); nestedFis = rf.getNestedResourceDescriptions(ICSettingBase.SETTING_FILE); @@ -255,7 +256,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen nestedFos = rf.getNestedResourceDescriptions(ICSettingBase.SETTING_FOLDER); assertEquals(0, nestedFos.length); assertEquals(4, nestedFis.length); - + cfgDes.removeResourceDescription(fd_abc); nestedFis = rf.getNestedResourceDescriptions(ICSettingBase.SETTING_FILE); nestedFos = rf.getNestedResourceDescriptions(ICSettingBase.SETTING_FOLDER); @@ -269,10 +270,10 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen nestedFos = rf.getNestedResourceDescriptions(ICSettingBase.SETTING_FOLDER); assertEquals(0, nestedFos.length); assertEquals(2, nestedFis.length); - + IFileInfo fi_qwe = (IFileInfo)cfg.getResourceInfo(new Path("q/w/e.c"), true); assertNotNull(fi_qwe); - + ICFileDescription fid_qwe = (ICFileDescription)cfgDes.getResourceDescription(new Path("q/w/e.c"), true); assertNotNull(fid_qwe); fi_qwe.setPath(new Path("r/t/y.c")); @@ -280,12 +281,12 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen assertNull(cfgDes.getResourceDescription(new Path("q/w/e.c"), true)); ICFileDescription fid_rty = (ICFileDescription)cfgDes.getResourceDescription(new Path("r/t/y.c"), true); assertEquals(fid_qwe, fid_rty); - + fid_rty.setPath(new Path("f/g/h.c")); assertNull(cfg.getResourceInfo(new Path("r/t/y.c"), true)); IFileInfo fi_fgh = (IFileInfo)cfg.getResourceInfo(new Path("f/g/h.c"), true); assertEquals(fi_qwe, fi_fgh); - + ICFolderDescription fod_fg1 = cfgDes.createFolderDescription(new Path("f/g/1"), cfgDes.getRootFolderDescription()); modify(fod_fg1); ICFolderDescription fod_fg12 = cfgDes.createFolderDescription(new Path("f/g/1/2"), fod_fg1); @@ -295,20 +296,20 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen ICFileDescription fid_fg13 = cfgDes.createFileDescription(new Path("f/g/1/3.c"), fod_fg1); modify(fid_fg13); assertEquals(fid_fg13, fod_fg1.getNestedResourceDescription(new Path("3.c"), true)); - + assertEquals(2, fod_fg1.getNestedResourceDescriptions().length); assertEquals(1, fod_fg1.getNestedResourceDescriptions(ICSettingBase.SETTING_FILE).length); assertEquals(1, fod_fg1.getNestedResourceDescriptions(ICSettingBase.SETTING_FOLDER).length); IFolderInfo fo_fg1 = (IFolderInfo)cfg.getResourceInfo(new Path("f/g/1"), true); assertNotNull(fo_fg1); - + fo_fg1.setPath(new Path("t/y/u")); assertEquals(2, fod_fg1.getNestedResourceDescriptions().length); assertEquals(1, fod_fg1.getNestedResourceDescriptions(ICSettingBase.SETTING_FILE).length); assertEquals(1, fod_fg1.getNestedResourceDescriptions(ICSettingBase.SETTING_FOLDER).length); - + assertEquals(fod_fg12, cfgDes.getResourceDescription(new Path("t/y/u/2"), true)); assertEquals(fid_fg13, cfgDes.getResourceDescription(new Path("t/y/u/3.c"), true)); @@ -326,9 +327,9 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen } } coreModel.setProjectDescription(project, des); - + project.delete(false, true, new NullProgressMonitor()); - + project = root.getProject(projectName); assertFalse(project.exists()); assertFalse(project.isOpen()); @@ -336,17 +337,17 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen assertFalse(project.exists()); assertFalse(project.isOpen()); assertNull("project description is not null for removed project", des); - + project = createProject(projectName); long time = System.currentTimeMillis(); des = coreModel.getProjectDescription(project); time = System.currentTimeMillis() - time; if (isPrint) System.out.println("time to load = " + time); - + assertNotNull("project description is null for re-created project", des); assertTrue("des should be valid for re-created project", des.isValid()); - + cfgDess = des.getConfigurations(); cfgDes = cfgDess[0]; rf = cfgDes.getRootFolderDescription(); @@ -367,29 +368,29 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen } } } - + fEventChecker = new CDefaultModelEventChecker(); coreModel.setProjectDescription(project, des); fEventChecker = null; - + project.delete(false, true, new NullProgressMonitor()); - + project = root.getProject(projectName); assertFalse(project.exists()); assertFalse(project.isOpen()); des = coreModel.getProjectDescription(project); assertNull("project description is not null for removed project", des); - + project = createProject(projectName); time = System.currentTimeMillis(); des = coreModel.getProjectDescription(project); time = System.currentTimeMillis() - time; if (isPrint) System.out.println("time to load = " + time); - + assertNotNull("project description is null for re-created project", des); assertTrue("des should be valid for re-created project", des.isValid()); - + cfgDess = des.getConfigurations(); cfgDes = cfgDess[0]; rf = cfgDes.getRootFolderDescription(); @@ -412,9 +413,9 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen nestedFos = rf.getNestedResourceDescriptions(ICSettingBase.SETTING_FOLDER); assertEquals(2, nestedFos.length); assertEquals(3, nestedFis.length); - + assertEquals(6, cfgDes.getResourceDescriptions().length); - + ManagedBuildTestHelper.createFolder(project, "a/b"); ICFolderDescription base = (ICFolderDescription)cfgDes.getResourceDescription(new Path("a/b"), false); ICFolderDescription abFoDes = cfgDes.createFolderDescription(new Path("a/b"), base); @@ -429,20 +430,20 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen fEventChecker = new CDefaultModelEventChecker(); coreModel.setProjectDescription(project, des); fEventChecker = null; - + time = System.currentTimeMillis(); des = coreModel.getProjectDescription(project); time = System.currentTimeMillis() - time; if (isPrint) System.out.println("time to load = " + time); - + assertNotNull("project description is null for re-created project", des); assertTrue("des should be valid for re-created project", des.isValid()); - + cfgDess = des.getConfigurations(); cfgDes = cfgDess[0]; rf = cfgDes.getRootFolderDescription(); - + ManagedBuildTestHelper.createFolder(project, "b/c"); base = (ICFolderDescription)cfgDes.getResourceDescription(new Path("b/c"), false); ICFolderDescription bcFoDes = cfgDes.createFolderDescription(new Path("b/c"), base); @@ -452,7 +453,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen assertNotNull(rLS); ls.getSettingEntriesList(ICLanguageSettingEntry.INCLUDE_PATH); rLS.getSettingEntriesList(ICLanguageSettingEntry.INCLUDE_PATH); - + if (isPrint) System.out.println("default entries for non-root folder..\n"); fEventChecker = new CDefaultModelEventChecker(); @@ -461,32 +462,32 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen project.delete(true, true, new NullProgressMonitor()); } - + public void testSourceEntries() throws Exception { final String projectName = "test2"; IProject project = createProject(projectName); CoreModel coreModel = CoreModel.getDefault(); ICProjectDescription des = coreModel.getProjectDescription(project); assertNull("detDescription1 returned not null!", des); - + des = coreModel.createProjectDescription(project, true); assertNotNull("createDescription returned null!", des); - + assertNull("detDescription2 returned not null!", coreModel.getProjectDescription(project)); - + assertFalse("new des should be not valid", des.isValid()); - + assertEquals(0, des.getConfigurations().length); - + ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); IProjectType type = ManagedBuildManager.getProjectType("cdt.managedbuild.target.gnu30.exe"); assertNotNull("project type not found", type); ManagedProject mProj = new ManagedProject(project, type); info.setManagedProject(mProj); - + IConfiguration cfgs[] = type.getConfigurations(); - + for(int i = 0; i < cfgs.length; i++){ String id = ManagedBuildManager.calculateChildId(cfgs[i].getId(), null); @@ -496,24 +497,24 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen des.createConfiguration("org.eclipse.cdt.managedbuilder.core.configurationDataProvider", data); } coreModel.setProjectDescription(project, des); - + IWorkspace wsp = ResourcesPlugin.getWorkspace(); - IWorkspaceRoot root = wsp.getRoot(); + IWorkspaceRoot root = wsp.getRoot(); project.delete(false, true, new NullProgressMonitor()); - + project = root.getProject(projectName); des = coreModel.getProjectDescription(project); assertNull("project description is not null for removed project", des); - + project = createProject(projectName); des = coreModel.getProjectDescription(project); assertNotNull("project description is null for re-created project", des); assertTrue("des should be valid for re-created project", des.isValid()); - + ICConfigurationDescription cfgDess[] = des.getConfigurations(); - + assertEquals(2, cfgDess.length); - + ICConfigurationDescription cfgDes = cfgDess[0]; ICResourceDescription rcDess[] = cfgDes.getResourceDescriptions(); assertEquals(1, rcDess.length); @@ -531,15 +532,15 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen assertEquals(1, s.length); assertEquals(projPath, s[0].getFullPath()); assertEquals(0, s[0].getExclusionPatterns().length); - + ManagedBuildTestHelper.createFolder(project, "a/b"); ICSourceEntry updatetSEs[] = new ICSourceEntry[2]; updatetSEs[0] = new CSourceEntry(projPath.append("a"), new Path[]{new Path("b")}, ICSourceEntry.VALUE_WORKSPACE_PATH); updatetSEs[1] = s[0]; - + cfgDes.setSourceEntries(updatetSEs); - + s = cfgDes.getSourceEntries(); updatetSEs[1] = new CSourceEntry(projPath, new Path[]{new Path("a")}, ICSourceEntry.VALUE_WORKSPACE_PATH | ICSourceEntry.RESOLVED); checkArrays(updatetSEs, s); @@ -550,11 +551,11 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen fEventChecker = new CDefaultModelEventChecker(); coreModel.setProjectDescription(project, des); fEventChecker = null; - + des = coreModel.getProjectDescription(project); cfgDes = des.getConfigurations()[0]; checkArrays(cfgDes.getSourceEntries(), s); - + project.delete(true, true, new NullProgressMonitor()); } @@ -564,25 +565,25 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen CoreModel coreModel = CoreModel.getDefault(); ICProjectDescription des = coreModel.getProjectDescription(project); assertNull("detDescription1 returned not null!", des); - + des = coreModel.createProjectDescription(project, true); assertNotNull("createDescription returned null!", des); - + assertNull("detDescription2 returned not null!", coreModel.getProjectDescription(project)); - + assertFalse("new des should be not valid", des.isValid()); - + assertEquals(0, des.getConfigurations().length); - + ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); IProjectType type = ManagedBuildManager.getProjectType("cdt.managedbuild.target.gnu30.exe"); assertNotNull("project type not found", type); ManagedProject mProj = new ManagedProject(project, type); info.setManagedProject(mProj); - + IConfiguration cfgs[] = type.getConfigurations(); - + for(int i = 0; i < cfgs.length; i++){ String id = ManagedBuildManager.calculateChildId(cfgs[i].getId(), null); Configuration config = new Configuration(mProj, (Configuration)cfgs[i], id, false, true); @@ -595,11 +596,11 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen des = coreModel.getProjectDescription(project); assertNotNull("project description is null ", des); assertTrue("des should be valid ", des.isValid()); - + ICConfigurationDescription cfgDess[] = des.getConfigurations(); - + assertEquals(2, cfgDess.length); - + ICConfigurationDescription cfgDes = cfgDess[0]; ICResourceDescription rcDess[] = cfgDes.getResourceDescriptions(); assertEquals(1, rcDess.length); @@ -615,55 +616,55 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen ICFolderDescription rf = cfgDes.getRootFolderDescription(); ICLanguageSetting setting = rf.getLanguageSettingForFile("a.c"); ICLanguageSettingEntry entries[] = setting.getSettingEntries(ICLanguageSettingEntry.MACRO); - + if (isPrint) { for(int i = 0; i < entries.length; i++){ System.out.println("name = \"" + entries[i].getName() + "\", value = \"" + entries[i].getValue() + "\""); } } - + CMacroEntry entry = new CMacroEntry("a", "b", 0); List list = new ArrayList(); list.add(entry); list.addAll(Arrays.asList(entries)); - + setting.setSettingEntries(ICLanguageSettingEntry.MACRO, list); - + ICLanguageSettingEntry updatedEntries[] = setting.getSettingEntries(ICLanguageSettingEntry.MACRO); assertEquals(entries.length + 1, updatedEntries.length); - + boolean found = false; for(int i = 0; i < updatedEntries.length; i++){ - if(updatedEntries[i].getName().equals("a") + if(updatedEntries[i].getName().equals("a") && updatedEntries[i].getValue().equals("b")){ found = true; break; } } - + assertTrue(found); } - + public void testActiveCfg() throws Exception{ final String projectName = "test8"; - + IProject project = createProject(projectName, "cdt.managedbuild.target.gnu30.exe"); CoreModel coreModel = CoreModel.getDefault(); - + ICProjectDescription des = coreModel.getProjectDescription(project); ICConfigurationDescription cfgs[] = des.getConfigurations(); String id1 = cfgs[0].getId(); cfgs[1].getId(); - + cfgs[0].setActive(); assertEquals(cfgs[0], des.getActiveConfiguration()); - + coreModel.setProjectDescription(project, des); - + des = coreModel.getProjectDescription(project); cfgs = des.getConfigurations(); assertEquals(id1, des.getActiveConfiguration().getId()); - + ICConfigurationDescription newActive = null; for(int i = 0; i < cfgs.length; i++){ if(!cfgs[i].getId().equals(id1)){ @@ -671,17 +672,17 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen break; } } - + String newActiveId = newActive.getId(); newActive.setActive(); assertEquals(newActive, des.getActiveConfiguration()); - + coreModel.setProjectDescription(project, des); - + des = coreModel.getProjectDescription(project); assertEquals(newActiveId, des.getActiveConfiguration().getId()); - - + + } private void checkArrays(Object[] a1, Object[] a2){ @@ -692,7 +693,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen assertTrue(a2 != null); assertEquals(a1.length, a2.length); - + for(int i = 0; i < a1.length; i++){ Object o1 = a1[i]; boolean found = false; @@ -702,38 +703,38 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen break; } } - + if(!found){ fail("a2 array does not contain the \"" + o1 + "\" element"); } } } - + static public IProject createProject(String name, String projTypeId) throws CoreException{ IProject project = createProject(name); - + CoreModel coreModel = CoreModel.getDefault(); ICProjectDescription des = coreModel.getProjectDescription(project); assertNull("detDescription1 returned not null!", des); - + des = coreModel.createProjectDescription(project, true); assertNotNull("createDescription returned null!", des); - + assertNull("detDescription2 returned not null!", coreModel.getProjectDescription(project)); - + assertFalse("new des should be not valid", des.isValid()); - + assertEquals(0, des.getConfigurations().length); - + ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project); IProjectType type = ManagedBuildManager.getProjectType(projTypeId); assertNotNull("project type not found", type); ManagedProject mProj = new ManagedProject(project, type); info.setManagedProject(mProj); - + IConfiguration cfgs[] = type.getConfigurations(); - + for(int i = 0; i < cfgs.length; i++){ String id = ManagedBuildManager.calculateChildId(cfgs[i].getId(), null); @@ -747,19 +748,19 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen return project; } - + static public IProject createProject(String name) throws CoreException{ return createProject(name, (IPath)null); } - + static public IProject createProject( - final String name, + final String name, final IPath location) throws CoreException{ IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); final IProject newProjectHandle = root.getProject(name); IProject project = null; - + if (!newProjectHandle.exists()) { IWorkspaceDescription workspaceDesc = workspace.getDescription(); workspaceDesc.setAutoBuilding(false); @@ -771,6 +772,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen project = CCorePlugin.getDefault().createCDTProject(description, newProjectHandle, new NullProgressMonitor()); } else { IWorkspaceRunnable runnable = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor); } @@ -779,12 +781,12 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor); project = newProjectHandle; } - + // Open the project if we have to if (!project.isOpen()) { project.open(new NullProgressMonitor()); } - - return project; + + return project; } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigNature.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigNature.java index 0129f2bc4d6..b34ee13ccf4 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigNature.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/core/scannerconfig/ScannerConfigNature.java @@ -20,18 +20,19 @@ import org.eclipse.core.runtime.CoreException; /** * @see IProjectNature - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ public class ScannerConfigNature implements IProjectNature { - + public final static String NATURE_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".ScannerConfigNature"; //$NON-NLS-1$ private IProject fProject; /** * @see IProjectNature#configure */ + @Override public void configure() throws CoreException { IProjectDescription description = getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); @@ -52,13 +53,14 @@ public class ScannerConfigNature implements IProjectNature { newCommands[commands.length] = command; description.setBuildSpec(newCommands); getProject().setDescription(description, null); - + // set default project scanner config settings } /** * @see IProjectNature#deconfigure */ + @Override public void deconfigure() throws CoreException { IProjectDescription description = getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); @@ -77,6 +79,7 @@ public class ScannerConfigNature implements IProjectNature { /** * @see IProjectNature#getProject */ + @Override public IProject getProject() { return fProject; } @@ -84,10 +87,11 @@ public class ScannerConfigNature implements IProjectNature { /** * @see IProjectNature#setProject */ + @Override public void setProject(IProject project) { fProject = project; } - + public static void addScannerConfigNature(IProject project) throws CoreException { IProjectDescription description = project.getDescription(); if (description.hasNature(NATURE_ID)) @@ -98,9 +102,9 @@ public class ScannerConfigNature implements IProjectNature { newIds[ids.length] = NATURE_ID; description.setNatureIds(newIds); project.setDescription(description, null); - + } - + public static void removeScannerConfigNature(IProject project) throws CoreException { IProjectDescription description = project.getDescription(); if (!description.hasNature(NATURE_ID)) @@ -144,7 +148,7 @@ public class ScannerConfigNature implements IProjectNature { newCommands = new ICommand[oldCommands.length + 1]; System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length); newCommands[oldCommands.length] = newCommand; - } + } else { for (int i = 0; i < oldCommands.length; i++) { if (oldCommands[i] == oldCommand) { @@ -170,19 +174,19 @@ public class ScannerConfigNature implements IProjectNature { // String selectedProfile = scPrefInfo.getSelectedProfileId(); // IScannerConfigBuilderInfo2 scProjInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2( // project, selectedProfile); -// +// // scProjInfo.setAutoDiscoveryEnabled(scPrefInfo.isAutoDiscoveryEnabled()); // scProjInfo.setProblemReportingEnabled(scPrefInfo.isProblemReportingEnabled()); -// +// // scProjInfo.setBuildOutputParserEnabled(scPrefInfo.isBuildOutputParserEnabled()); // scProjInfo.setBuildOutputFileActionEnabled(scPrefInfo.isBuildOutputFileActionEnabled()); // scProjInfo.setBuildOutputFilePath(scPrefInfo.getBuildOutputFilePath()); -// +// // ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(selectedProfile); // List providerIdList = scPrefInfo.getProviderIdList(); // for (Iterator i = providerIdList.iterator(); i.hasNext();) { // String providerId = (String) i.next(); -// +// // scProjInfo.setProviderOutputParserEnabled(providerId, scPrefInfo.isProviderOutputParserEnabled(providerId)); // if (profile.getScannerInfoProviderElement(providerId).getProviderKind().equals( // ScannerConfigProfile.ScannerInfoProvider.RUN)) { @@ -194,7 +198,7 @@ public class ScannerConfigNature implements IProjectNature { // } // } // scProjInfo.save(); -// +// // // the last step is to add discovered paths container // ICProject cProject = CoreModel.getDefault().create(project); // IPathEntry[] rawPathEntries = CoreModel.getRawPathEntries(cProject); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java index 8c6717b4368..f818f42eb84 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/CfgDiscoveredPathManager.java @@ -69,12 +69,12 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { public static CfgDiscoveredPathManager fInstance; private IDiscoveredPathManager fBaseMngr; - + /** Deadlock-safe mutex lock */ private ILock lock = Job.getJobManager().newLock(); private static class ContextInfo { - + public ContextInfo() { } CfgInfoContext fInitialContext; @@ -84,25 +84,25 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { IScannerConfigBuilderInfo2 fInfo; boolean fIsPerFileCache; } - + public static class PathInfoCache{ private PathInfo fPathInfo; private String fProfileId; - + public PathInfo getPathInfo(){ return fPathInfo; } - + private PathInfoCache(String profileId, PathInfo pathInfo){ this.fProfileId = profileId; this.fPathInfo = pathInfo; } } - + private CfgDiscoveredPathManager() { fBaseMngr = MakeCorePlugin.getDefault().getDiscoveryManager(); } - + public static CfgDiscoveredPathManager getInstance(){ if(fInstance == null){ fInstance = new CfgDiscoveredPathManager(); @@ -110,23 +110,24 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { } return fInstance; } - + public static void stop(){ if(fInstance != null) fInstance.shutdown(); } - + public void startup() { ResourcesPlugin.getWorkspace().addResourceChangeListener(this); } - + public void shutdown() { ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); } - + /* (non-Javadoc) * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) */ + @Override public void resourceChanged(IResourceChangeEvent event) { if (event.getSource() instanceof IWorkspace) { IResource resource = event.getResource(); @@ -148,7 +149,8 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { public void updateCoreSettings(final IProject project, final IConfiguration cfgs[]) { try { IWorkspaceRunnable runnable = new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { + @Override + public void run(IProgressMonitor monitor) throws CoreException { ManagedBuildManager.updateCoreSettings(project, cfgs, true); } }; @@ -181,13 +183,13 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { } return info; } - + // private void adjustPerRcContextInfo(ContextInfo cInfo){ // cInfo.fIsFerFileCache = true; // cInfo.fCacheContext = cInfo.fInitialContext; // cInfo.fLoadContext = new CfgInfoContext(cInfo.fInitialContext.getConfiguration()); // } - + private PathInfo resolveCacheBaseDiscoveredInfo(ContextInfo cInfo, IDiscoveredPathManager.IDiscoveredPathInfo baseInfo){ if(cInfo.fIsPerFileCache){ if(baseInfo instanceof IDiscoveredPathManager.IPerFileDiscoveredPathInfo2){ @@ -195,24 +197,24 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { } return getCachedPathInfo(cInfo); } - + ((FolderInfo)cInfo.fLoadContext.getConfiguration().getRootFolderInfo()).setContainsDiscoveredScannerInfo(true); Map map = baseInfo.getSymbols(); IPath paths[] = baseInfo.getIncludePaths(); - + PathInfo info = new PathInfo(paths, null, map, null, null); setCachedPathInfo(cInfo, info); return info; } - + private void resolveCachePerFileInfo(ContextInfo cInfo, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 info){ CConfigurationData data = cInfo.fLoadContext.getConfiguration().getConfigurationData(); if(data == null) return; - + PerFileSettingsCalculator calculator = new PerFileSettingsCalculator(); IRcSettingInfo[] rcInfos = calculator.getSettingInfos(cInfo.fLoadContext.getConfiguration().getOwner().getProject(), data, info, true); - + CResourceData rcDatas[] = data.getResourceDatas(); Map rcDataMap = new HashMap(); CResourceData rcData; @@ -220,9 +222,9 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { rcData = rcDatas[i]; rcDataMap.put(rcData.getPath(), rcData); } - + IRcSettingInfo rcInfo; - IPath path; + IPath path; boolean rootSettingFound = false; boolean fileSettingFound = false; for(int i = 0; i < rcInfos.length; i++){ @@ -233,14 +235,14 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { fileSettingFound = true; else rootSettingFound = true; - + rcDataMap.remove(path); cache(cInfo, rcInfo); } - + if(rootSettingFound && fileSettingFound) ((BuildFolderData)data.getRootFolderData()).setContainsDiscoveredScannerInfo(false); - + if(!rcDataMap.isEmpty()){ CResourceData tmpRcData; for(Iterator iter = rcDataMap.values().iterator(); iter.hasNext();){ @@ -253,7 +255,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { } } } - + private void cache(ContextInfo cInfo, IRcSettingInfo rcSetting){ CResourceData rcData = rcSetting.getResourceData(); clearCache(rcData); @@ -262,12 +264,12 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { cache(cInfo, lInfos[i]); } } - + private void cache(ContextInfo cInfo, ILangSettingInfo lInfo){ BuildLanguageData bld = (BuildLanguageData)lInfo.getLanguageData(); setCachedPathInfo(cInfo, (Configuration)bld.getConfiguration(), (Tool)bld.getTool(), bld.getInputType(), lInfo.getFilePathInfo()); } - + private void clearCache(CResourceData rcData){ if(rcData.getType() == ICSettingBase.SETTING_FILE){ IFileInfo fiInfo = ((BuildFileData)rcData).getFileInfo(); @@ -279,13 +281,13 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { clearCache(tools); } } - + private void clearCache(ITool[] tools){ for(int i = 0; i < tools.length; i++){ ((Tool)tools[i]).clearAllDiscoveredInfo(); } } - + private IDiscoveredPathManager.IDiscoveredPathInfo loadPathInfo(IProject project, IConfiguration cfg, ContextInfo cInfo) throws CoreException{ IDiscoveredPathManager.IDiscoveredPathInfo info = fBaseMngr.getDiscoveredInfo(cfg.getOwner().getProject(), cInfo.fLoadContext.toInfoContext(), false); if(!DiscoveredScannerInfoStore.getInstance().hasInfo(project, cInfo.fLoadContext.toInfoContext(), info.getSerializable())){ @@ -295,7 +297,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { if(buildInfo != null){ SCProfileInstance instance = ScannerConfigBuilder.build(cInfo.fLoadContext, buildInfo, 0, null, new NullProgressMonitor()); if(instance != null){ - + IScannerInfoCollector newC = instance.getScannerInfoCollector(); if(newC instanceof IScannerInfoCollector2 && !(newC instanceof PerFileSICollector)){ @@ -307,7 +309,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { } return info; } - + private PathInfo getCachedPathInfo(ContextInfo cInfo){ PathInfo info = getCachedPathInfo(cInfo, true, true, false); return info; @@ -318,7 +320,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { if(cInfo.fIsPerFileCache){ Configuration cfg = (Configuration)cInfo.fInitialContext.getConfiguration(); cfg.clearDiscoveredPathInfo(); - + IResourceInfo[] infos = cfg.getResourceInfos(); for(int i = 0; i < infos.length; i++){ IResourceInfo rcInfo = infos[i]; @@ -331,7 +333,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { } else { setCachedPathInfo(cInfo, null); } - + // PathInfo info = getCachedPathInfo(cInfo, true, true, true); } @@ -345,7 +347,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { return infoCache.fPathInfo; return null; } - + private PathInfoCache getPathInfoCache(ContextInfo cInfo, Configuration cfg, Tool tool, IInputType inType, boolean queryParent, boolean clearIfInvalid, boolean clear){ PathInfoCache info = null; // boolean queryCfg = false; @@ -385,14 +387,14 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { // fBaseMngr.removeDiscoveredInfo(cfg.getOwner().getProject(), cInfo.fLoadContext.toInfoContext()); } } - + return info; } - + private boolean isCacheValid(ContextInfo cInfo, PathInfoCache cache){ if(cache == null) return true; - + if(cInfo.fInfo != null){ String id = cInfo.fInfo.getSelectedProfileId(); return id.equals(cache.fProfileId); @@ -423,26 +425,26 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { contextInfo.fIsPerFileCache = CfgScannerConfigProfileManager.isPerFileProfile(contextInfo.fInfo.getSelectedProfileId()); contextInfo.fCacheContext = contextInfo.fIsPerFileCache ? contextInfo.fInitialContext : contextInfo.fLoadContext; } - + return contextInfo; } - + private PathInfo setCachedPathInfo(ContextInfo cInfo, PathInfo info){ CfgInfoContext cacheContext = cInfo.fCacheContext; return setCachedPathInfo(cInfo, (Configuration)cacheContext.getConfiguration(), (Tool)cacheContext.getTool(), cacheContext.getInputType(), info); } - + private PathInfo setCachedPathInfo(ContextInfo cInfo, Configuration cfg, Tool tool, IInputType inType, PathInfo info){ PathInfoCache oldInfo; PathInfoCache cache; if(info != null){ String id = cInfo.fInfo != null ? cInfo.fInfo.getSelectedProfileId() : null; - cache = new PathInfoCache(id, info); + cache = new PathInfoCache(id, info); } else { cache = null; } - + if(tool != null){ if(info != null) oldInfo = tool.setDiscoveredPathInfo(inType, cache); @@ -464,7 +466,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener { public void removeDiscoveredInfo(IProject project, CfgInfoContext context, boolean removeBaseCache) { // if(context == null) // context = ScannerConfigUtil.createContextForProject(project); - + ContextInfo cInfo = getContextInfo(context); removeCachedPathInfo(cInfo); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/PerFileSettingsCalculator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/PerFileSettingsCalculator.java index eded9cf510e..683ea034d2e 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/PerFileSettingsCalculator.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/PerFileSettingsCalculator.java @@ -39,11 +39,11 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; public class PerFileSettingsCalculator { - private static final String[] EMPTY_STRING_ARRAY = new String[0]; + private static final String[] EMPTY_STRING_ARRAY = new String[0]; // private static class ListIndex { // int fIndex; // List fList; -// +// // public ListIndex(int index, List list) { // fIndex = index; // fList = list; @@ -52,13 +52,13 @@ public class PerFileSettingsCalculator { public interface IRcSettingInfo { CResourceData getResourceData(); - + ILangSettingInfo[] getLangInfos(); } - + public interface ILangSettingInfo { CLanguageData getLanguageData(); - + PathInfo getFilePathInfo(); } @@ -70,55 +70,59 @@ public class PerFileSettingsCalculator { fRcData = rcData; } + @Override public ILangSettingInfo[] getLangInfos() { if(fLangInfoList != null && fLangInfoList.size() != 0) return fLangInfoList.toArray(new ILangSettingInfo[fLangInfoList.size()]); return new ILangSettingInfo[0]; } + @Override public CResourceData getResourceData() { return fRcData; } - + void add(ILangSettingInfo info){ if(fLangInfoList == null) fLangInfoList = new ArrayList(); fLangInfoList.add(info); } } - + private static class LangSettingInfo implements ILangSettingInfo { private CLanguageData fLangData; private PathInfo fPathInfo; - + LangSettingInfo(CLanguageData langData, PathInfo info){ fLangData = langData; fPathInfo = info; } + @Override public PathInfo getFilePathInfo() { return fPathInfo; } + @Override public CLanguageData getLanguageData() { return fLangData; } - + } private static class ListIndexStore { private int fMaxIndex; private List[] fStore; - + @SuppressWarnings("unchecked") private List[] emptyStore(int size) { return new List[size]; } - + public ListIndexStore(int size){ if(size < 0) size = 0; - + fStore = emptyStore(size); } @@ -128,13 +132,13 @@ public class PerFileSettingsCalculator { list = new ArrayList(); fStore[index] = list; } - + if(fMaxIndex < index) fMaxIndex = index; - + list.add(value); } - + private boolean checkResize(int index){ if(index >= fStore.length){ int newSize = ++index; @@ -147,7 +151,7 @@ public class PerFileSettingsCalculator { } return false; } - + public List[] getLists(){ int size = fMaxIndex + 1; List> list = new ArrayList>(size); @@ -157,21 +161,21 @@ public class PerFileSettingsCalculator { if(l != null) list.add(l); } - + return list.toArray(emptyStore(list.size())); } } - + private static class PathFilePathInfo { IPath fPath; PathInfo fInfo; - + PathFilePathInfo(IPath path, PathInfo info){ fPath = path; fInfo = info; } } - + private static class ExtsSetSettings { // String[] fExts; // HashSet fExtsSet; @@ -188,7 +192,7 @@ public class PerFileSettingsCalculator { fBaseLangData = baseLangData; fIsDerived = isDerived; } - + void add(ExtsSetSettings setting){ if(setting.fPathFilePathInfoMap != null){ Collection> values = setting.fPathFilePathInfoMap.values(); @@ -199,7 +203,7 @@ public class PerFileSettingsCalculator { } } } - + // void updateLangData(CLanguageData lData, boolean isDerived){ // fBaseLangData = lData; // fIsDerived = lData != null ? isDerived : false; @@ -208,7 +212,7 @@ public class PerFileSettingsCalculator { public void add(PathFilePathInfo pInfo){ if(fPathFilePathInfoMap == null) fPathFilePathInfoMap = new HashMap>(3); - + PathInfo fileInfo = pInfo.fInfo; List list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList : fPathFilePathInfoMap.get(fileInfo); if(list == null){ @@ -217,13 +221,13 @@ public class PerFileSettingsCalculator { if(fMaxMatchInfo == null){ fMaxMatchInfo = fileInfo; fMaxMatchInfoList = emptyList; - } + } // else { // fIsMultiple = true; // } } else if(fMaxMatchInfoList != list){ // fIsMultiple = true; - + if(fMaxMatchInfoList.size() == list.size()){ fMaxMatchInfoList = list; fMaxMatchInfo = fileInfo; @@ -231,36 +235,36 @@ public class PerFileSettingsCalculator { } list.add(pInfo); } - + public boolean isMultiple(){ return fPathFilePathInfoMap != null && fPathFilePathInfoMap.size() > 1; } - + // public PathInfo getMaxMatchPathInfo(){ // return fMaxMatchInfo; // } - + @Override public boolean equals(Object obj) { if(obj == this) return true; - + if(isMultiple()) return false; - + if(!(obj instanceof ExtsSetSettings)) return false; - + ExtsSetSettings other = (ExtsSetSettings)obj; if(other.isMultiple()) return false; - + if(!fExtsSet.equals(other.fExtsSet)) return false; - + if(!CDataUtil.objectsEqual(fMaxMatchInfo, other.fMaxMatchInfo)) return false; - + return true; } @@ -272,18 +276,18 @@ public class PerFileSettingsCalculator { hash = super.hashCode(); else { hash = fExtsSet.hashCode(); - + if(fMaxMatchInfo != null) - hash += fMaxMatchInfo.hashCode(); + hash += fMaxMatchInfo.hashCode(); } - + fHash = hash; } return hash; } - + } - + private static class ExtsSet { private String[] fExts; private HashSet fExtsSet; @@ -292,19 +296,19 @@ public class PerFileSettingsCalculator { public ExtsSet(String[] exts){ fExts = exts == null || exts.length == 0 ? EMPTY_STRING_ARRAY : (String[])exts.clone(); } - + @Override public boolean equals(Object obj) { if(this == obj) return true; - + if(!(obj instanceof ExtsSet)) return false; - + ExtsSet other = (ExtsSet)obj; if(fExts.length != other.fExts.length) return false; - + if(fExts.length != 0){ @SuppressWarnings("unchecked") HashSet set = (HashSet)calcExtsSet().clone(); @@ -314,7 +318,7 @@ public class PerFileSettingsCalculator { } return true; } - + // public String[] getExtensions(){ // return fExts.clone(); // } @@ -331,7 +335,7 @@ public class PerFileSettingsCalculator { } return hash; } - + private HashSet calcExtsSet(){ if(fExtsSet == null) fExtsSet = new HashSet(Arrays.asList(fExts)); @@ -342,9 +346,9 @@ public class PerFileSettingsCalculator { public String toString() { if(fExts.length == 0) return ""; //$NON-NLS-1$ - + StringBuffer buf = new StringBuffer(); - + for(int i = 0; i < fExts.length; i++){ if(i != 0) buf.append(","); //$NON-NLS-1$ @@ -353,7 +357,7 @@ public class PerFileSettingsCalculator { return buf.toString(); } } - + private static class RcSetSettings { private CResourceData fRcData; private HashMap fExtToExtsSetMap; @@ -395,13 +399,13 @@ public class PerFileSettingsCalculator { } return child; } - + void updateRcData(CResourceData data, boolean isDerived){ fRcData = data; fIsDerived = data != null ? isDerived : false; updateLangDatas(); } - + private void updateLangDatas(){ if(fRcData.getType() == ICSettingBase.SETTING_FILE){ CLanguageData lData = ((CFileData)fRcData).getLanguageData(); @@ -410,9 +414,9 @@ public class PerFileSettingsCalculator { extSetting.fBaseLangData = lData; extSetting.fIsDerived = lData != null ? fIsDerived : false; } - - if(extSetting != null ? - fExtsSetToExtsSetSettingsMap.size() > 1 + + if(extSetting != null ? + fExtsSetToExtsSetSettingsMap.size() > 1 : fExtsSetToExtsSetSettingsMap.size() > 0){ Collection values = fExtsSetToExtsSetSettingsMap.values(); for (ExtsSetSettings s : values) { @@ -426,7 +430,7 @@ public class PerFileSettingsCalculator { CLanguageData[] lDatas = ((CFolderData)fRcData).getLanguageDatas(); @SuppressWarnings("unchecked") Map map = (HashMap)fExtsSetToExtsSetSettingsMap.clone(); - + CLanguageData lData; for(int i = 0; i < lDatas.length; i++){ lData = lDatas[i]; @@ -436,7 +440,7 @@ public class PerFileSettingsCalculator { extSetting.fIsDerived = this.fIsDerived; } } - + if(map.size() != 0){ Collection values = map.values(); for (ExtsSetSettings extSetting : values) { @@ -446,28 +450,28 @@ public class PerFileSettingsCalculator { } } } - + public IPath getPath(){ return fContainer.getPath(); } - + public RcSetSettings getParent(){ PathSettingsContainer cr = fContainer.getParentContainer(); if(cr != null) return (RcSetSettings)cr.getValue(); return null; } - + void internalSetSettingsMap(HashMap map){ fExtsSetToExtsSetSettingsMap = map; fExtToExtsSetMap = calcExtToExtSetSettingsMap(map); } - + void internalAdd(ExtsSetSettings setting){ if(fExtsSetToExtsSetSettingsMap == null){ fExtsSetToExtsSetSettingsMap = new HashMap(); } - + ExtsSetSettings cur = fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet); if(cur != null){ cur.add(setting); @@ -476,7 +480,7 @@ public class PerFileSettingsCalculator { fExtToExtsSetMap = addExtsInfoToMap(setting, fExtToExtsSetMap); } } - + void internalAddSettingsMap(HashMap map){ // ExtsSetSettings thisSetting; // ExtsSet extsSet; @@ -493,15 +497,16 @@ public class PerFileSettingsCalculator { // } } } - + // public boolean settingsEqual(RcSetSettings other){ // return fExtsSetToExtsSetSettingsMap.equals(other.fExtsSetToExtsSetSettingsMap); // } - + public RcSetSettings[] getChildren(final boolean includeCurrent){ final List list = new ArrayList(); fContainer.accept(new IPathSettingsContainerVisitor(){ + @Override public boolean visit(PathSettingsContainer container) { if(includeCurrent || container != fContainer){ RcSetSettings value = (RcSetSettings)container.getValue(); @@ -509,44 +514,44 @@ public class PerFileSettingsCalculator { } return true; } - + }); - + return list.toArray(new RcSetSettings[list.size()]); } - + public boolean containsEqualMaxMatches(RcSetSettings other, boolean ignoreGenerated){ if(!ignoreGenerated && fExtsSetToExtsSetSettingsMap.size() < other.fExtsSetToExtsSetSettingsMap.size()) return false; - + Set> entrySet = other.fExtsSetToExtsSetSettingsMap.entrySet(); for (Entry entry : entrySet) { ExtsSetSettings otherSetting = entry.getValue(); if(ignoreGenerated && otherSetting.fBaseLangData == null) continue; - + ExtsSetSettings thisSetting = fExtsSetToExtsSetSettingsMap.get(entry.getKey()); if(thisSetting == null) return false; - + if(otherSetting.fMaxMatchInfo != null && !otherSetting.fMaxMatchInfo.equals(thisSetting.fMaxMatchInfo)) return false; } - + return true; } - + void removeChild(RcSetSettings setting){ IPath path = setting.fContainer.getPath(); IPath thisPath = fContainer.getPath(); if(!thisPath.isPrefixOf(path)) throw new IllegalArgumentException(); - + path = path.removeFirstSegments(thisPath.segmentCount()); fContainer.removeChildContainer(path); } } - + private static HashMap calcExtToExtSetSettingsMap(Map extsSetMap){ HashMap result = null; Collection values = extsSetMap.values(); @@ -555,7 +560,7 @@ public class PerFileSettingsCalculator { } return result; } - + private static HashMap addExtsInfoToMap(ExtsSetSettings setting, HashMap map){ boolean forceAdd = false; String[] exts = setting.fExtsSet.fExts; @@ -573,7 +578,7 @@ public class PerFileSettingsCalculator { } return map; } - + private RcSetSettings createRcSetInfo (CConfigurationData data){ CFolderData rootData = data.getRootFolderData(); PathSettingsContainer container = PathSettingsContainer.createRootContainer(); @@ -581,22 +586,22 @@ public class PerFileSettingsCalculator { rcSet.internalSetSettingsMap(createExtsSetSettingsMap(rootData)); // rcSet.fExtToExtsSetMap = new HashMap(); // rcSet.fExtsSetToExtsSetSettingsMap = new HashMap(); - + CResourceData[] rcDatas = data.getResourceDatas(); CResourceData rcData; RcSetSettings curRcSet; HashMap fileMap; ExtsSetSettings fileSetting; IPath path; - + for(int i = 0; i < rcDatas.length; i++){ rcData = rcDatas[i]; if(rcData == rootData) continue; - + if(!includeRcDataInCalculation(data, rcData)) continue; - + path = rcData.getPath(); curRcSet = rcSet.createChild(path, rcData, false); if(rcData.getType() == ICSettingBase.SETTING_FILE){ @@ -608,14 +613,14 @@ public class PerFileSettingsCalculator { curRcSet.internalSetSettingsMap(createExtsSetSettingsMap((CFolderData)rcData)); } } - + return rcSet; } - + protected boolean includeRcDataInCalculation(CConfigurationData cfgData, CResourceData rcData){ return true; } - + protected CFileData createFileData(CConfigurationData cfgData, IPath path, CFileData base) throws CoreException{ return cfgData.createFileData(path, base); } @@ -636,7 +641,7 @@ public class PerFileSettingsCalculator { checkRemoveDups(rcSet); return rcSet; } - + /* * utility method for creating empty IRcSettingInfo */ @@ -646,7 +651,7 @@ public class PerFileSettingsCalculator { addEmptyLanguageInfos(rcInfo, lDatas); return rcInfo; } - + private static void addEmptyLanguageInfos(RcSettingInfo rcInfo, CLanguageData[] lDatas){ ArrayList list = rcInfo.fLangInfoList; if(list == null){ @@ -655,12 +660,12 @@ public class PerFileSettingsCalculator { } else { list.ensureCapacity(lDatas.length); } - + for(int i = 0; i < lDatas.length; i++){ list.add(new LangSettingInfo(lDatas[i], PathInfo.EMPTY_INFO)); } } - + private IRcSettingInfo[] mapFileDiscoveredInfo(IProject project, CConfigurationData data, RcSetSettings rcSet, PathFilePathInfo[] pfpis){ // IResource rc; PathInfo pInfo; @@ -673,7 +678,7 @@ public class PerFileSettingsCalculator { CLanguageData lData; ArrayList tmpList; PathFilePathInfo pfpi; - + for(int i = 0; i < pfpis.length; i++){ pfpi = pfpis[i]; projRelPath = pfpi.fPath; @@ -699,19 +704,19 @@ public class PerFileSettingsCalculator { kinds |= ICLanguageSettingEntry.MACRO_FILE; if(symbolMap.size() != 0) kinds |= ICLanguageSettingEntry.MACRO; - + rcInfo = null; for(int k = 0; k < lDatas.length; k++){ lData = lDatas[k]; if((lData.getSupportedEntryKinds() & kinds) == 0) continue; - + if(rcInfo == null){ rcInfo = new RcSettingInfo(rootData); tmpList = new ArrayList(lDatas.length - k); rcInfo.fLangInfoList = tmpList; } - + lInfo = new LangSettingInfo(lData, pInfo); rcInfo.add(lInfo); } @@ -724,7 +729,7 @@ public class PerFileSettingsCalculator { // switch(rc.getType()){ // case IResource.FILE: // projRelPath = rc.getProjectRelativePath(); -// dataSetting = rcSet.getChild(projRelPath, false); +// dataSetting = rcSet.getChild(projRelPath, false); // rcData = dataSetting.fRcData; rcData = rcSet.getChild(projRelPath, false).fRcData; if(!rcData.getPath().equals(projRelPath)){ @@ -743,20 +748,20 @@ public class PerFileSettingsCalculator { } catch (CoreException e) { rcData = null; ManagedBuilderCorePlugin.log(e); - } + } } // if(rcData != null) // dataSetting = rcSet.createChild(projRelPath, rcData, false); // else // dataSetting = null; } - + if(rcData != null){ if(rcData.getType() == ICSettingBase.SETTING_FILE){ lData = ((CFileData)rcData).getLanguageData(); } else { lData = CDataUtil.findLanguagDataForFile(projRelPath.lastSegment(), project, (CFolderData)rcData); - + } if(lData != null){ @@ -775,7 +780,7 @@ public class PerFileSettingsCalculator { } return list.toArray(new RcSettingInfo[list.size()]); } - + public IRcSettingInfo[] getSettingInfos(IProject project, CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo, boolean fileDataMode){ if(fileDataMode){ RcSetSettings rcSettings = createRcSetInfo(data); @@ -785,7 +790,7 @@ public class PerFileSettingsCalculator { RcSetSettings settings = createRcSetSettings(data, discoveredInfo); return createInfos(data, settings); } - + private IRcSettingInfo[] createInfos(CConfigurationData data, RcSetSettings rootSetting){ RcSetSettings settings[] = rootSetting.getChildren(true); RcSetSettings setting; @@ -814,7 +819,7 @@ public class PerFileSettingsCalculator { continue; } } - + if(rcData.getType() == ICSettingBase.SETTING_FILE){ ExtsSetSettings extSetting = setting.fExtToExtsSetMap.get(getFileExt(rcData.getPath())); if(extSetting != null){ @@ -837,17 +842,17 @@ public class PerFileSettingsCalculator { for (ExtsSetSettings extSetting : values) { if(extSetting.fMaxMatchInfo == null) continue; - + if(extSetting.fBaseLangData == null) continue; - + if(extSetting.fIsDerived){ throw new IllegalStateException(); } - - + + rcInfo.add(new LangSettingInfo(extSetting.fBaseLangData, extSetting.fMaxMatchInfo)); - + if(extSetting.isMultiple()){ Set>> entrySet = extSetting.fPathFilePathInfoMap.entrySet(); for (Entry> entry : entrySet) { @@ -874,18 +879,18 @@ public class PerFileSettingsCalculator { } } // } - + return resultList.toArray(new RcSettingInfo[resultList.size()]); } - + private CFolderData createFolderData(CConfigurationData cfg, CResourceData base, RcSetSettings setting) throws CoreException{ if(base.getType() == ICSettingBase.SETTING_FOLDER) return createFolderData(cfg, setting.getPath(), (CFolderData)base); - + //should not be here throw new IllegalStateException(); } - + private static void checkRemoveDups(RcSetSettings rcSet){ RcSetSettings settings[] = rcSet.getChildren(true); RcSetSettings setting, parent; @@ -893,21 +898,21 @@ public class PerFileSettingsCalculator { setting = settings[i]; if(!setting.fIsDerived) continue; - + parent = setting.getParent(); if(parent == null) continue; - + if(parent.containsEqualMaxMatches(setting, true)) removeChildAddingChildSettings(parent, setting); } } - + private static void removeChildAddingChildSettings(RcSetSettings parent, RcSetSettings child){ parent.internalAddSettingsMap(child.fExtsSetToExtsSetSettingsMap); parent.removeChild(child); } - + private static void mapDiscoveredInfo(RcSetSettings rcSet, PathFilePathInfo[] pInfos){ PathFilePathInfo pInfo; RcSetSettings child, parent; @@ -929,8 +934,8 @@ public class PerFileSettingsCalculator { child.internalSetSettingsMap(createEmptyExtSetMapCopy(parent.fExtsSetToExtsSetSettingsMap)); } } - } - + } + // isDerived = child.fIsDerived; if(pInfo.fPath.segmentCount() == 0){ @@ -947,21 +952,21 @@ public class PerFileSettingsCalculator { } } } - + private static void processProjectPaths(RcSetSettings rcSet, PathFilePathInfo pfpi){ Collection settings = rcSet.fExtsSetToExtsSetSettingsMap.values(); for (ExtsSetSettings setting : settings) { setting.add(pfpi); } } - + private static String getFileExt(IPath path){ String ext = path.getFileExtension(); if(ext != null) return ext; return ""; //$NON-NLS-1$ } - + private static HashMap createEmptyExtSetMapCopy(HashMap base){ @SuppressWarnings("unchecked") HashMap map = (HashMap)base.clone(); @@ -974,7 +979,7 @@ public class PerFileSettingsCalculator { } return map; } - + private static ExtsSetSettings createExtsSetSettings(IPath path, CFileData data){ CLanguageData lData = data.getLanguageData(); if(lData != null){ @@ -983,7 +988,7 @@ public class PerFileSettingsCalculator { } return new ExtsSetSettings(null, new ExtsSet(EMPTY_STRING_ARRAY), false); } - + private static ExtsSetSettings createExtsSetSettings(CLanguageData lData, String exts[]){ return new ExtsSetSettings(lData, new ExtsSet(exts), false); } @@ -992,7 +997,7 @@ public class PerFileSettingsCalculator { CLanguageData[] lDatas = data.getLanguageDatas(); HashMap map = new HashMap(lDatas.length); ExtsSetSettings settings; - + if(lDatas.length != 0) { CLanguageData lData; for( int i = 0; i < lDatas.length; i++){ @@ -1001,7 +1006,7 @@ public class PerFileSettingsCalculator { map.put(settings.fExtsSet, settings); } } - + return map; } @@ -1012,7 +1017,7 @@ public class PerFileSettingsCalculator { ListIndexStore store = new ListIndexStore(10); HashMap infoMap = new HashMap(); // LinkedHashMap result; - + Set> entrySet = map.entrySet(); for (Entry entry : entrySet) { rc = entry.getKey(); @@ -1023,17 +1028,17 @@ public class PerFileSettingsCalculator { // path = path.removeFirstSegments(1); // segCount--; - + info = entry.getValue(); storedInfo = infoMap.get(info); if(storedInfo == null){ storedInfo = info; infoMap.put(storedInfo, storedInfo); } - + store.add(segCount, new PathFilePathInfo(path, storedInfo)); } - + List lists[] = store.getLists(); // result = new LinkedHashMap(map.size()); // List l; @@ -1054,7 +1059,7 @@ public class PerFileSettingsCalculator { for(int i = 0; i < lists.length; i++){ size += lists[i].size(); } - + infos = new PathFilePathInfo[size]; int num = 0; int listSize; @@ -1066,7 +1071,7 @@ public class PerFileSettingsCalculator { infos[num++] = list.get(k); } } - + return infos; } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/jobs/CfgSCJobsUtil.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/jobs/CfgSCJobsUtil.java index 75189bdab4e..5595066b758 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/jobs/CfgSCJobsUtil.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig/jobs/CfgSCJobsUtil.java @@ -28,7 +28,7 @@ import org.eclipse.core.runtime.Platform; /** * Utility class for build and job related functionality - * + * * @author vhirsl */ public class CfgSCJobsUtil { @@ -48,7 +48,7 @@ public class CfgSCJobsUtil { public void set(boolean rc) { this.rc = rc; } - + @Override public String toString() { return rc ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$ @@ -89,16 +89,18 @@ public class CfgSCJobsUtil { if (esiProvider != null) { ISafeRunnable runnable = new ISafeRunnable() { - public void run() { + @Override + public void run() { esiProvider.invokeProvider(monitor, project, context.toInfoContext(), providerId, buildInfo, collector, env); rc.set(true); } - - public void handleException(Throwable exception) { + + @Override + public void handleException(Throwable exception) { rc.set(false); ManagedBuilderCorePlugin.log(exception); } - + }; Platform.run(runnable); } @@ -127,7 +129,7 @@ public class CfgSCJobsUtil { // get the collector // if(context == null) // context = ScannerConfigUtil.createContextForProject(project); - + if(profileInstance == null){ profileInstance = ScannerConfigProfileManager.getInstance(). getSCProfileInstance(project, context.toInfoContext(), buildInfo.getSelectedProfileId()); @@ -137,12 +139,14 @@ public class CfgSCJobsUtil { final IScannerInfoCollector2 collector2 = (IScannerInfoCollector2) collector; ISafeRunnable runnable = new ISafeRunnable() { - public void run() throws Exception { + @Override + public void run() throws Exception { collector2.updateScannerConfiguration(monitor); rc.set(true); } - - public void handleException(Throwable exception) { + + @Override + public void handleException(Throwable exception) { rc.set(false); ManagedBuilderCorePlugin.log(exception); } @@ -150,7 +154,7 @@ public class CfgSCJobsUtil { }; Platform.run(runnable); } - + return rc.get(); } @@ -169,25 +173,27 @@ public class CfgSCJobsUtil { if (buildInfo.isBuildOutputFileActionEnabled()) { ISafeRunnable runnable = new ISafeRunnable() { - - public void run() { + + @Override + public void run() { esiProvider.invokeProvider(monitor, project, context.toInfoContext(), null, buildInfo, collector, env); rc.set(true); } - - public void handleException(Throwable exception) { + + @Override + public void handleException(Throwable exception) { rc.set(false); ManagedBuilderCorePlugin.log(exception); } - + }; Platform.run(runnable); } - + if(rc.get()) return profileInstance; return null; - + } /** diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java index 9f5b640dfb9..1ef7c4dae84 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigInfoFactory2.java @@ -37,7 +37,6 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; import org.eclipse.cdt.managedbuilder.internal.core.Configuration; import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildConfigurationData; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.QualifiedName; @@ -47,12 +46,12 @@ public class CfgScannerConfigInfoFactory2 { private static class ContainerInfo{ int fCode; IScannerConfigBuilderInfo2Set fContainer; - + ContainerInfo(ICProjectDescription des, IScannerConfigBuilderInfo2Set container){ this.fCode = des.hashCode(); this.fContainer = container; } - + public boolean matches(ICProjectDescription des){ return des.hashCode() == fCode; } @@ -61,17 +60,19 @@ public class CfgScannerConfigInfoFactory2 { private Configuration cfg; private SoftReference fContainer; // private HashMap map; - + CfgInfo(Configuration cfg){ this.cfg = cfg; // init(); } - + + @Override public CfgInfoContext[] getContexts() { Map map = createMap(); return map.keySet().toArray(new CfgInfoContext[map.size()]); } + @Override public IScannerConfigBuilderInfo2 getInfo(CfgInfoContext context) { return createMap().get(context); // IScannerConfigBuilderInfo2 info = null; @@ -83,17 +84,18 @@ public class CfgScannerConfigInfoFactory2 { // } else { // Tool tool = (Tool)context.getTool(); // if(tool != null) -// info = tool.getScannerConfigInfo(context.getInputType()); +// info = tool.getScannerConfigInfo(context.getInputType()); //// else //// info = getDefaultInfo(); // } // return info; } + @Override public boolean isPerRcTypeDiscovery() { return cfg.isPerRcTypeDiscovery(); } - + private IScannerConfigBuilderInfo2Set getContainer() throws CoreException{ IScannerConfigBuilderInfo2Set container = fContainer != null ? fContainer.get() : null; if(container == null){ @@ -121,13 +123,13 @@ public class CfgScannerConfigInfoFactory2 { container = ScannerConfigProfileManager.createScannerConfigBuildInfo2Set(prefs, false); } } - + if(fContainer == null) { fContainer = new SoftReference(container); } return container; } - + private Map createMap(){ HashMap map = new HashMap(); try{ @@ -137,16 +139,16 @@ public class CfgScannerConfigInfoFactory2 { Map baseMap = container.getInfoMap(); if(!isPerRcType){ // Discovery profile scope = configuration wide - + CfgInfoContext c = new CfgInfoContext(cfg); InfoContext baseContext = c.toInfoContext(); IScannerConfigBuilderInfo2 info = container.getInfo(baseContext); - + if(info == null){ String id = cfg.getDiscoveryProfileId(); if(id == null) id = CfgScannerConfigUtil.getFirstProfileId(cfg.getFilteredTools()); - + IScannerConfigBuilderInfo2 prefInfo = null; if(!cfg.isPreference()){ IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false); @@ -165,10 +167,10 @@ public class CfgScannerConfigInfoFactory2 { info = container.createInfo(baseContext, prefInfo, prefInfo.getSelectedProfileId()); } } - map.put(new CfgInfoContext(cfg), info); + map.put(new CfgInfoContext(cfg), info); } else { // Discovery profile scope = per language - + Map configMap = getConfigInfoMap(baseMap); IResourceInfo[] rcInfos = cfg.getResourceInfos(); @@ -196,15 +198,15 @@ public class CfgScannerConfigInfoFactory2 { // Scanner discovery options aren't settable on a file-per-file basis. Thus // files with custom properties don't have a persisted entry in the config - // info map; we create an ephemeral entry instead. We need to assign that file - // the scanner profile that's used for non-custom files of the same + // info map; we create an ephemeral entry instead. We need to assign that file + // the scanner profile that's used for non-custom files of the same // inputType/tool (and configuration, of course). Unfortunately, identifying // a match is inefficient, but in practice, projects don't have tons of // customized files. See Bug 354194 String id = null; for (Entry entry : configMap.entrySet()) { CfgInfoContext cfgInfoCxt = entry.getKey(); - if (match(cfgInfoCxt.getInputType(), context.getInputType()) && + if (match(cfgInfoCxt.getInputType(), context.getInputType()) && match(cfgInfoCxt.getTool(), context.getTool().getSuperClass()) && cfgInfoCxt.getConfiguration().equals(context.getConfiguration())) { id = entry.getValue().getSelectedProfileId(); @@ -213,7 +215,7 @@ public class CfgScannerConfigInfoFactory2 { if (id == null) { id = CfgScannerConfigUtil.getDefaultProfileId(context, true); } - + InfoContext baseContext = context.toInfoContext(); if(info == null){ if(id != null){ @@ -233,11 +235,11 @@ public class CfgScannerConfigInfoFactory2 { // permanent and stagnant part of the project description. It was // added to the container only so we could obtain an // IScannerConfigBuilderInfo2. Now that we have the info object, - // revert the container. See Bug 354194. Note that the permanent - // entry for the project's root folder resource info gets created - // by us shortly after project creation; thus we have to make an + // revert the container. See Bug 354194. Note that the permanent + // entry for the project's root folder resource info gets created + // by us shortly after project creation; thus we have to make an // exception for that rcinfo. - if (!(rcInfo instanceof IFolderInfo && rcInfo.getPath().isEmpty())) { + if (!(rcInfo instanceof IFolderInfo && rcInfo.getPath().isEmpty())) { container.removeInfo(context.toInfoContext()); } } @@ -269,7 +271,7 @@ public class CfgScannerConfigInfoFactory2 { } } } - + if(!configMap.isEmpty()){ for (Entry entry : configMap.entrySet()) { if(map.containsKey(entry.getKey())) @@ -289,10 +291,10 @@ public class CfgScannerConfigInfoFactory2 { return map; } - + private Map getConfigInfoMap(Map baseMap){ Map map = new HashMap(); - + for (Entry entry : baseMap.entrySet()) { InfoContext baseContext = entry.getKey(); CfgInfoContext c = CfgInfoContext.fromInfoContext(cfg, baseContext); @@ -305,14 +307,17 @@ public class CfgScannerConfigInfoFactory2 { return map; } + @Override public Map getInfoMap() { return createMap(); } + @Override public void setPerRcTypeDiscovery(boolean on) { cfg.setPerRcTypeDiscovery(on); } + @Override public IScannerConfigBuilderInfo2 applyInfo(CfgInfoContext context, IScannerConfigBuilderInfo2 base) { try { @@ -326,7 +331,7 @@ public class CfgScannerConfigInfoFactory2 { container.removeInfo(baseContext); newInfo = getInfo(context); } - + return newInfo; } catch (CoreException e) { ManagedBuilderCorePlugin.log(e); @@ -334,10 +339,12 @@ public class CfgScannerConfigInfoFactory2 { return null; } + @Override public IConfiguration getConfiguration() { return cfg; } + @Override public boolean isProfileSupported(CfgInfoContext context, String profileId) { if(!isPerRcTypeDiscovery()) @@ -374,7 +381,7 @@ public class CfgScannerConfigInfoFactory2 { des.setSessionProperty(CONTAINER_INFO_PROPERTY, null); } } - + public static void savePreference(IConfiguration cfg) throws CoreException{ ICfgScannerConfigBuilderInfo2Set container = ((Configuration)cfg).getCfgScannerConfigInfo(); if(container != null){ @@ -384,25 +391,25 @@ public class CfgScannerConfigInfoFactory2 { } } } - + private static boolean match(ITool t1, ITool t2){ if (t1 == null || t2 == null) return false; if (t1.getId().equals(t2.getId())) { return true; } - - return match(t1.getSuperClass(), t2.getSuperClass()); + + return match(t1.getSuperClass(), t2.getSuperClass()); } - + private static boolean match(IInputType i1, IInputType i2){ if (i1 == null || i2 == null) return false; if (i1.getId().equals(i2.getId())) { return true; } - - return match(i1.getSuperClass(), i2.getSuperClass()); + + return match(i1.getSuperClass(), i2.getSuperClass()); } - + } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IResourceConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IResourceConfiguration.java index 36304d7e71e..f1101b84aaf 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IResourceConfiguration.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IResourceConfiguration.java @@ -13,13 +13,13 @@ package org.eclipse.cdt.managedbuilder.core; import org.eclipse.core.resources.IResource; /** - * This class is a place to define build attributes of individual - * resources that are different from the configuration as a whole. The - * resourceConfiguration element can have multiple tool children. They - * define the tool(s) to be used to build the specified resource. The - * tool(s) can execute before, after, or instead of the default tool for + * This class is a place to define build attributes of individual + * resources that are different from the configuration as a whole. The + * resourceConfiguration element can have multiple tool children. They + * define the tool(s) to be used to build the specified resource. The + * tool(s) can execute before, after, or instead of the default tool for * the resources (see the toolOrder attribute in the tool element). - * + * * @since 2.1 * @noextend This class is not intended to be subclassed by clients. * @noimplement This interface is not intended to be implemented by clients. @@ -37,60 +37,63 @@ public interface IResourceConfiguration extends IResourceInfo { public static final String DISABLE_RCBS_TOOL = "disable"; //$NON-NLS-1$ public static final int KIND_DISABLE_RCBS_TOOL = 4; - //TODO: Set name and ID in the constructors to be + //TODO: Set name and ID in the constructors to be // configuration-name#resource-path - + /** * Returns the configuration that is the parent of this resource configuration. - * + * * @return IConfiguration */ + @Override public IConfiguration getParent(); - + /** * Returns whether the resource referenced by this element should be excluded - * from builds of the parent configuration. + * from builds of the parent configuration. * Returns false if the attribute was not specified. - * - * @return boolean + * + * @return boolean */ + @Override public boolean isExcluded(); - + /** - * Returns the path of the project resource that this element references. + * Returns the path of the project resource that this element references. * TODO: What is the format of the path? Absolute? Relative? Canonical? * - * @return String + * @return String */ public String getResourcePath(); - + /** * Returns an integer constant representing the users desire for ordering the application of * a resource custom build step tool. * - * @return int + * @return int */ public int getRcbsApplicability(); - + /** - * Returns the list of tools currently defined for the project resource that + * Returns the list of tools currently defined for the project resource that * this element references. Updates the String attribute toolsToInvoke. * - * @return String + * @return String */ public ITool[] getToolsToInvoke(); - + /** * Sets the new value representing the users desire for ordering the application of * a resource custom build step tool. */ public void setRcbsApplicability(int value); - + /** * Sets the "excluded" flag for the resource. * If true, the project resource identified by the resoursePath * attribute is excluded from the build of the parent configuration. */ + @Override public void setExclude(boolean excluded); /** @@ -99,34 +102,37 @@ public interface IResourceConfiguration extends IResourceInfo { public void setResourcePath(String path); /** - * Returns true if this element has changes that need to + * Returns true if this element has changes that need to * be saved in the project file, else false. - * - * @return boolean + * + * @return boolean */ + @Override public boolean isDirty(); - + /** * Sets the element's "dirty" (have I been modified?) flag. */ + @Override public void setDirty(boolean isDirty); /** * Returns the list of tools associated with this resource configuration. - * + * * @return ITool[] */ + @Override public ITool[] getTools(); /** - * Returns the tool in this resource configuration with the ID specified - * in the argument, or null - * + * Returns the tool in this resource configuration with the ID specified + * in the argument, or null + * * @param id The ID of the requested tool * @return ITool */ public ITool getTool(String id); - + /** * Removes the Tool from the Tool list and map */ @@ -139,83 +145,88 @@ public interface IResourceConfiguration extends IResourceInfo { * @param Id The id for the new tool chain * @param name The name for the new tool chain * @param isExtensionElement Indicates whether this is an extension element or a managed project element - * + * * @return ITool */ public ITool createTool(ITool superClass, String Id, String name, boolean isExtensionElement); /** * Overrides the tool command for a tool defined in this resource configuration's tool. - * + * * @param tool The tool that will have its command modified * @param command The command */ public void setToolCommand(ITool tool, String command); - + /** * Sets the value of a boolean option for this resource configuration. - * + * * @param parent The holder/parent of the option. * @param option The option to change. * @param value The value to apply to the option. - * + * * @return IOption The modified option. This can be the same option or a newly created option. - * + * * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions. * Code assuming ITool as type, will continue to work unchanged. */ - public IOption setOption(IHoldsOptions parent, IOption option, boolean value) - throws BuildException; + @Override + public IOption setOption(IHoldsOptions parent, IOption option, boolean value) + throws BuildException; /** * Sets the value of a string option for this resource configuration. - * + * * @param parent The holder/parent of the option. * @param option The option that will be effected by change. * @param value The value to apply to the option. - * + * * @return IOption The modified option. This can be the same option or a newly created option. - * + * * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions. * Code assuming ITool as type, will continue to work unchanged. */ + @Override public IOption setOption(IHoldsOptions parent, IOption option, String value) throws BuildException; - + /** * Sets the value of a list option for this resource configuration. - * + * * @param parent The holder/parent of the option. * @param option The option to change. * @param value The values to apply to the option. - * + * * @return IOption The modified option. This can be the same option or a newly created option. - * + * * @since 3.0 - The type of parent has changed from ITool to IHoldsOptions. * Code assuming ITool as type, will continue to work unchanged. */ + @Override public IOption setOption(IHoldsOptions parent, IOption option, String[] value) throws BuildException; - + /** * Returns the Eclipse project that owns the resource configuration. - * + * * @return IResource */ public IResource getOwner(); /** * specifies whether the resource configuration is modified and needs rebuild - * + * * @return boolean - */ + */ + @Override public boolean needsRebuild(); /** * sets the resource configuration rebuild state */ + @Override void setRebuildState(boolean rebuild); - + void setTools(ITool[] tools); } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolReference.java index 18a92806dfa..7e1a1beb460 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolReference.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolReference.java @@ -16,22 +16,22 @@ import org.eclipse.cdt.managedbuilder.internal.core.OptionReference; /** * @deprecated This class was deprecated in 2.1 - * + * * @noextend This class is not intended to be subclassed by clients. * @noimplement This interface is not intended to be implemented by clients. */ @Deprecated public interface IToolReference extends ITool { - + /** - * Answers a reference to the option. If the reference does not exist, - * a new reference is created. + * Answers a reference to the option. If the reference does not exist, + * a new reference is created. */ public OptionReference createOptionReference(IOption option); - + /** * Answers the list of option references contained in the receiver. - * + * * @return List */ public List getOptionReferenceList(); @@ -43,30 +43,33 @@ public interface IToolReference extends ITool { /** * Answers true if the receiver ahs been modified in any way. - * + * * @return boolean */ + @Override public boolean isDirty(); - + /** - * Answers true if the reference is a reference to the + * Answers true if the reference is a reference to the * tool specified in the argument. - * + * * @param tool the tool that should be tested * @return boolean */ public boolean references(ITool tool); - + /** * @param isDirty The value to set the dirty flag to in the receiver */ + @Override public void setDirty(boolean isDirty); /** * Set the tool command in the receiver to be the argument. - * + * * @return true if the command is changed, else false */ + @Override public boolean setToolCommand(String cmd); /* @@ -74,19 +77,19 @@ public interface IToolReference extends ITool { * to retrieve the actual value of attributes. These routines do not go to the * referenced Tool for a value if the ToolReference does not have a value. */ - + /** * Answers all of the output extensions that the receiver can build. - * + * * @return String */ public String getRawOutputExtensions(); - + /** - * Answers the argument that must be passed to a specific tool in order to - * control the name of the output artifact. For example, the GCC compile and - * linker use '-o', while the archiver does not. - * + * Answers the argument that must be passed to a specific tool in order to + * control the name of the output artifact. For example, the GCC compile and + * linker use '-o', while the archiver does not. + * * @return String */ public String getRawOutputFlag(); @@ -97,10 +100,10 @@ public interface IToolReference extends ITool { * @return String */ public String getRawOutputPrefix(); - + /** * Answers the command-line invocation defined for the receiver. - * + * * @return String */ public String getRawToolCommand(); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java index 1c058f564a4..7c3d89a5367 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java @@ -143,7 +143,7 @@ import org.w3c.dom.ProcessingInstruction; /** * This is the main entry point for getting at the build information * for the managed build system. - * + * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. */ @@ -257,16 +257,19 @@ public class ManagedBuildManager extends AbstractCExtension { private static Map fInfoMap = new HashMap(); private static ISorter fToolChainSorter = new ISorter(){ + @Override public void sort() { resortToolChains(); } }; private static ISorter fToolSorter = new ISorter(){ + @Override public void sort() { resortTools(); } }; private static ISorter fBuilderSorter = new ISorter(){ + @Override public void sort() { resortBuilders(); } @@ -280,6 +283,7 @@ public class ManagedBuildManager extends AbstractCExtension { static { getEnvironmentVariableProvider().subscribe( fEnvironmentBuildPathsChangeListener = new IEnvironmentBuildPathsChangeListener(){ + @Override public void buildPathsChanged(IConfiguration configuration, int buildPathType){ // if(buildPathType == IEnvVarBuildPath.BUILDPATH_INCLUDE){ // initializePathEntries(configuration,null); @@ -415,7 +419,7 @@ public class ManagedBuildManager extends AbstractCExtension { public static SortedMap getExtensionToolChainMap() { return getExtensionToolChainMapInternal(); } - + public static IToolChain[] getExtensionToolChains() { return getExtensionToolChainMapInternal().values().toArray(new ToolChain[extensionToolChainMap.size()]); } @@ -440,7 +444,7 @@ public class ManagedBuildManager extends AbstractCExtension { public static SortedMap getExtensionToolMap() { return getExtensionToolMapInternal(); } - + public static ITool[] getExtensionTools() { return getExtensionToolMapInternal().values().toArray(new Tool[extensionToolMap.size()]); } @@ -475,7 +479,7 @@ public class ManagedBuildManager extends AbstractCExtension { public static SortedMap getExtensionBuilderMap() { return getExtensionBuilderMapInternal(); } - + public static IBuilder[] getExtensionBuilders() { return getExtensionBuilderMapInternal().values().toArray(new Builder[extensionBuilderMap.size()]); } @@ -563,7 +567,7 @@ public class ManagedBuildManager extends AbstractCExtension { /** * @return the base extension configuration from the manifest (plugin.xml) * or {@code null} if not found. - * + * * @since 8.0 */ public static IConfiguration getExtensionConfiguration(IConfiguration cfg) { @@ -732,7 +736,7 @@ public class ManagedBuildManager extends AbstractCExtension { /** * @param resource to find the target * @param id - ID of the target - * + * * @return the result of a best-effort search to find a target with the * specified ID, or {@code null} if one is not found. */ @@ -819,7 +823,7 @@ public class ManagedBuildManager extends AbstractCExtension { /** * Gets the currently selected target. This is used while the project * property pages are displayed. - * + * * @return target configuration. */ public static IConfiguration getSelectedConfiguration(IProject project) { @@ -1327,6 +1331,7 @@ public class ManagedBuildManager extends AbstractCExtension { if (shell != null) { final String exceptionMsg = err.getMessage(); shell.getDisplay().syncExec( new Runnable() { + @Override public void run() { MessageDialog.openError(shell, ManagedMakeMessages.getResourceString("ManagedBuildManager.error.write_failed_title"), //$NON-NLS-1$ @@ -2152,6 +2157,7 @@ public class ManagedBuildManager extends AbstractCExtension { final Shell shell = window.getShell(); final String errMsg = ManagedMakeMessages.getFormattedString(MANIFEST_VERSION_ERROR, extension.getUniqueIdentifier()); shell.getDisplay().asyncExec( new Runnable() { + @Override public void run() { MessageDialog.openError(shell, ManagedMakeMessages.getResourceString("ManagedBuildManager.error.manifest_load_failed_title"), //$NON-NLS-1$ @@ -3512,7 +3518,7 @@ public class ManagedBuildManager extends AbstractCExtension { /** * Generic routine for checking the availability of converters for the given * Build Object. - * + * * @return true if there are converters for the given Build Object. * Returns false if there are no converters. */ @@ -3647,15 +3653,15 @@ public class ManagedBuildManager extends AbstractCExtension { return superId + "." + suffix; //$NON-NLS-1$ } - + private static int isInt(String s) { - try { + try { return Integer.parseInt(s); } catch (NumberFormatException e) { return 0; } } - + /** * @return base id when the given id was generated by {@link #calculateChildId(String, String)}. * @since 8.0 @@ -3664,7 +3670,7 @@ public class ManagedBuildManager extends AbstractCExtension { int index = id.lastIndexOf('.'); if (index<0) return id; - + String lastSeg = id.substring(index+1,id.length()); if (isInt(lastSeg)>0) { String baseId = id.substring(0,index); @@ -3672,7 +3678,7 @@ public class ManagedBuildManager extends AbstractCExtension { } return getIdFromIdAndVersion(id); } - + /** * @return calculated relative path given the full path to a folder and a file */ @@ -4494,7 +4500,7 @@ public class ManagedBuildManager extends AbstractCExtension { /** * Build the specified build configurations. - * + * * @param configs - configurations to build * @param builder - builder to retrieve build arguments * @param monitor - progress monitor @@ -4504,10 +4510,10 @@ public class ManagedBuildManager extends AbstractCExtension { public static void buildConfigurations(IConfiguration[] configs, IBuilder builder, IProgressMonitor monitor, boolean allBuilders) throws CoreException{ buildConfigurations(configs, builder, monitor, allBuilders, IncrementalProjectBuilder.FULL_BUILD); } - + /** * Build the specified build configurations. - * + * * @param configs - configurations to build * @param builder - builder to retrieve build arguments * @param monitor - progress monitor @@ -4517,7 +4523,7 @@ public class ManagedBuildManager extends AbstractCExtension { *

  • {@link IncrementalProjectBuilder#CLEAN_BUILD}
  • *
  • {@link IncrementalProjectBuilder#INCREMENTAL_BUILD}
  • *
  • {@link IncrementalProjectBuilder#FULL_BUILD}
  • - * + * * @since 7.0 */ public static void buildConfigurations(IConfiguration[] configs, IBuilder builder, IProgressMonitor monitor, @@ -4558,7 +4564,7 @@ public class ManagedBuildManager extends AbstractCExtension { /** * Build the specified build configurations for a given project. - * + * * @param project - project the configurations belong to * @param configs - configurations to build * @param builder - builder to retrieve build arguments @@ -4569,7 +4575,7 @@ public class ManagedBuildManager extends AbstractCExtension { *
  • {@link IncrementalProjectBuilder#CLEAN_BUILD}
  • *
  • {@link IncrementalProjectBuilder#INCREMENTAL_BUILD}
  • *
  • {@link IncrementalProjectBuilder#FULL_BUILD}
  • - * + * * @throws CoreException */ private static void buildConfigurations(final IProject project, final IConfiguration[] configs, @@ -4581,6 +4587,7 @@ public class ManagedBuildManager extends AbstractCExtension { * * @see org.eclipse.core.resources.IWorkspaceRunnable#run(org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void run(IProgressMonitor monitor) throws CoreException { int ticks = 1; if (buildKind==IncrementalProjectBuilder.CLEAN_BUILD) { @@ -4591,18 +4598,18 @@ public class ManagedBuildManager extends AbstractCExtension { ticks = ticks*configs.length; } monitor.beginTask(project.getName(), ticks); - + if (buildKind==IncrementalProjectBuilder.CLEAN_BUILD) { // It is not possible to pass arguments to clean() method of a builder // So we iterate setting active configuration IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project); IConfiguration savedCfg = buildInfo.getDefaultConfiguration(); - + try { for (IConfiguration config : configs) { if (monitor.isCanceled()) break; - + buildInfo.setDefaultConfiguration(config); buildProject(project, null, allBuilders, buildKind, monitor); } @@ -4621,13 +4628,13 @@ public class ManagedBuildManager extends AbstractCExtension { private void buildProject(IProject project, Map args, boolean allBuilders, int buildKind, IProgressMonitor monitor) throws CoreException { - + if (allBuilders) { ICommand[] commands = project.getDescription().getBuildSpec(); for (ICommand command : commands) { if (monitor.isCanceled()) break; - + String builderName = command.getBuilderName(); Map newArgs = null; if (buildKind!=IncrementalProjectBuilder.CLEAN_BUILD) { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedCProjectNature.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedCProjectNature.java index 49bd9fcd744..ec7daee1604 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedCProjectNature.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedCProjectNature.java @@ -38,7 +38,7 @@ public class ManagedCProjectNature implements IProjectNature { /** * Utility method for adding a managed nature to a project. - * + * * @param project the project to add the managed nature to. * @param monitor a progress monitor to indicate the duration of the operation, or * null if progress reporting is not required. @@ -60,12 +60,12 @@ public class ManagedCProjectNature implements IProjectNature { Vector vec = new Vector(Arrays.asList(commands)); vec.removeElementAt(i); vec.trimToSize(); - ICommand[] tempCommands = vec.toArray(new ICommand[commands.length-1]); + ICommand[] tempCommands = vec.toArray(new ICommand[commands.length-1]); description.setBuildSpec(tempCommands); break; } } - + commands = description.getBuildSpec(); boolean found = false; // See if the builder is already there @@ -75,7 +75,7 @@ public class ManagedCProjectNature implements IProjectNature { break; } } - if (!found) { + if (!found) { //add builder to project ICommand command = description.newCommand(); command.setBuilderName(getBuilderID()); @@ -85,12 +85,12 @@ public class ManagedCProjectNature implements IProjectNature { newCommands[0] = command; description.setBuildSpec(newCommands); project.setDescription(description, null); - } + } } /** * Utility method for adding a nature to a project. - * + * * @param project the project to add the nature to. * @param natureId the id of the nature to assign to the project * @param monitor a progress monitor to indicate the duration of the operation, or @@ -109,7 +109,7 @@ public class ManagedCProjectNature implements IProjectNature { description.setNatureIds(newNatures); project.setDescription(description, monitor); } - + /** * Update the Java command in the build spec (replace existing one if present, * add one first if none). @@ -139,7 +139,7 @@ public class ManagedCProjectNature implements IProjectNature { description.setBuildSpec(newCommands); return description; } - + public static ICommand getBuildSpec(IProjectDescription description, String builderID) { ICommand[] commands = description.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { @@ -164,6 +164,7 @@ public class ManagedCProjectNature implements IProjectNature { /* (non-Javadoc) * @see org.eclipse.core.resources.IProjectNature#configure() */ + @Override public void configure() throws CoreException { addManagedBuilder(project, new NullProgressMonitor()); } @@ -171,6 +172,7 @@ public class ManagedCProjectNature implements IProjectNature { /* (non-Javadoc) * @see org.eclipse.core.resources.IProjectNature#deconfigure() */ + @Override public void deconfigure() throws CoreException { // TODO remove builder from here } @@ -178,6 +180,7 @@ public class ManagedCProjectNature implements IProjectNature { /* (non-Javadoc) * @see org.eclipse.core.resources.IProjectNature#getProject() */ + @Override public IProject getProject() { // Just return the project associated with the nature return project; @@ -186,10 +189,10 @@ public class ManagedCProjectNature implements IProjectNature { /** * Utility method to remove the managed nature from a project. - * + * * @param project to remove the managed nature from - * @param mon progress monitor to indicate the duration of the operation, or - * null if progress reporting is not required. + * @param mon progress monitor to indicate the duration of the operation, or + * null if progress reporting is not required. */ public static void removeManagedNature(IProject project, IProgressMonitor mon) throws CoreException { removeNature(project, MNG_NATURE_ID, mon); @@ -197,7 +200,7 @@ public class ManagedCProjectNature implements IProjectNature { /** * Utility method for removing a project nature from a project. - * + * * @param project the project to remove the nature from * @param natureId the nature id to remove * @param monitor a progress monitor to indicate the duration of the operation, or @@ -215,6 +218,7 @@ public class ManagedCProjectNature implements IProjectNature { /* (non-Javadoc) * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject) */ + @Override public void setProject(IProject project) { // Set the project for the nature this.project = project; diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedOptionValueHandler.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedOptionValueHandler.java index d1d2a261615..cf081b242f5 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedOptionValueHandler.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedOptionValueHandler.java @@ -26,57 +26,58 @@ public class ManagedOptionValueHandler implements * E N A B L E U S E A S B A S E C L A S S A N D * D E F A U L T I M P L E M E N T A T I O N */ - + private static ManagedOptionValueHandler mbsValueHandler; - - protected ManagedOptionValueHandler() { + + protected ManagedOptionValueHandler() { mbsValueHandler = null; } - + public static ManagedOptionValueHandler getManagedOptionValueHandler() { if( mbsValueHandler == null ) { mbsValueHandler = new ManagedOptionValueHandler(); } return mbsValueHandler; } - + /* * D E F A U L T I M P L E M E N T A T I O N S O F I N T E R F A C E */ - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler#handleValue(IConfiguration,IToolChain,IOption,String,int) */ - public boolean handleValue(IBuildObject configuration, - IHoldsOptions holder, + @Override + public boolean handleValue(IBuildObject configuration, + IHoldsOptions holder, IOption option, String extraArgument, int event) { /* - // The following is for debug purposes and thus normally commented out + // The following is for debug purposes and thus normally commented out String configLabel = "???"; //$NON-NLS-1$ String holderLabel = "???"; //$NON-NLS-1$ String eventLabel = "???"; //$NON-NLS-1$ - + if (configuration instanceof IConfiguration) { configLabel = "IConfiguration"; //$NON-NLS-1$ } else if (configuration instanceof IResourceConfiguration) { configLabel = "IResourceConfiguration"; //$NON-NLS-1$ } - + if (holder instanceof IToolChain) { holderLabel = "IToolChain"; //$NON-NLS-1$ } else if (holder instanceof ITool) { holderLabel = "ITool"; //$NON-NLS-1$ } - + switch (event) { case EVENT_OPEN: eventLabel = "EVENT_OPEN"; break; //$NON-NLS-1$ case EVENT_APPLY: eventLabel = "EVENT_APPLY"; break; //$NON-NLS-1$ case EVENT_SETDEFAULT: eventLabel = "EVENT_SETDEFAULT"; break; //$NON-NLS-1$ case EVENT_CLOSE: eventLabel = "EVENT_CLOSE"; break; //$NON-NLS-1$ } - + // Print the event System.out.println(eventLabel + "(" + //$NON-NLS-1$ configLabel + " = " + //$NON-NLS-1$ @@ -87,7 +88,7 @@ public class ManagedOptionValueHandler implements option.getId() + ", " + //$NON-NLS-1$ "String = " + //$NON-NLS-1$ extraArgument + ")"); //$NON-NLS-1$ - */ + */ // The event was not handled, thus return false return false; } @@ -95,6 +96,7 @@ public class ManagedOptionValueHandler implements /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler#isDefaultValue(IConfiguration,IToolChain,IOption,String) */ + @Override public boolean isDefaultValue(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument) { // Get the default Value Object defaultValue = option.getDefaultValue(); @@ -171,8 +173,9 @@ public class ManagedOptionValueHandler implements /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler#isEnumValueAppropriate(IConfiguration,IToolChain,IOption,String,String) */ - public boolean isEnumValueAppropriate(IBuildObject configuration, - IHoldsOptions holder, + @Override + public boolean isEnumValueAppropriate(IBuildObject configuration, + IHoldsOptions holder, IOption option, String extraArgument, String enumValue) { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ResourceChangeHandler2.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ResourceChangeHandler2.java index c4197fcf38e..4d92f96c5ea 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ResourceChangeHandler2.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ResourceChangeHandler2.java @@ -42,9 +42,11 @@ import org.eclipse.core.runtime.jobs.Job; class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ private class RcMoveHandler implements IResourceMoveHandler { + @Override public void done() { } + @Override public void handleProjectClose(IProject project) { sendClose(project); try { @@ -53,6 +55,7 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ } } + @Override public boolean handleResourceMove(IResource fromRc, IResource toRc) { switch(fromRc.getType()){ case IResource.PROJECT: @@ -67,6 +70,7 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ return false; } + @Override public boolean handleResourceRemove(IResource rc) { switch(rc.getType()){ case IResource.PROJECT: @@ -80,13 +84,13 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ return false; } } - + @Override protected IResourceMoveHandler createResourceMoveHandler( IResourceChangeEvent event) { return new RcMoveHandler(); } - + public void sendClose(IProject project){ sendClose(ManagedBuildManager.getBuildInfo(project,false)); } @@ -96,7 +100,7 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ IManagedProject managedProj = info.getManagedProject(); if (managedProj != null) { IConfiguration cfgs[] = managedProj.getConfigurations(); - + for(int i = 0; i < cfgs.length; i++) ManagedBuildManager.performValueHandlerEvent(cfgs[i], IManagedOptionValueHandler.EVENT_CLOSE, true); } @@ -105,11 +109,12 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ private static class Visitor implements IResourceDeltaVisitor { private Set fProjSet; - + Visitor(Set projSet){ fProjSet = projSet; } + @Override public boolean visit(IResourceDelta delta) throws CoreException { IResource rc = delta.getResource(); switch (rc.getType()) { @@ -129,7 +134,7 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ if(checkNaturesNeedUpdate(cachedIds, natureIds)){ if(fProjSet == null) fProjSet = new HashSet(); - + fProjSet.add(project); break; } @@ -141,17 +146,17 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ return false; } } - + Set getProjSet(){ return fProjSet; } - + } - + private static boolean checkNaturesNeedUpdate(String[] oldIds, String[] newIds){ if(oldIds == null) return true; - + Set oldSet = new HashSet(Arrays.asList(oldIds)); Set oldSetCopy = new HashSet(oldSet); Set newSet = new HashSet(Arrays.asList(newIds)); @@ -162,14 +167,14 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ || newSet.contains(CProjectNature.C_NATURE_ID) || newSet.contains(CCProjectNature.CC_NATURE_ID)) return true; - + return false; } - + @Override public void resourceChanged(IResourceChangeEvent event) { super.resourceChanged(event); - + switch(event.getType()){ case IResourceChangeEvent.POST_CHANGE: IResourceDelta delta = event.getDelta(); @@ -191,7 +196,7 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ IWorkspace wsp = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = wsp.getRoot(); - + Job job = new Job(ManagedMakeMessages.getString("ResourceChangeHandler2.0")){ //$NON-NLS-1$ @Override @@ -205,9 +210,9 @@ class ResourceChangeHandler2 extends ResourceChangeHandlerBase{ } return Status.OK_STATUS; } - + }; - + job.setRule(root); job.setSystem(true); job.schedule(); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/envvar/IBuildEnvironmentVariable.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/envvar/IBuildEnvironmentVariable.java index 03133b1a817..e82ec8e4ab0 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/envvar/IBuildEnvironmentVariable.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/envvar/IBuildEnvironmentVariable.java @@ -13,7 +13,7 @@ package org.eclipse.cdt.managedbuilder.envvar; import org.eclipse.cdt.core.envvar.IEnvironmentVariable; /** - * this interface represents the given environment variable + * this interface represents the given environment variable * @since 3.0 */ public interface IBuildEnvironmentVariable extends IEnvironmentVariable{ @@ -23,20 +23,23 @@ public interface IBuildEnvironmentVariable extends IEnvironmentVariable{ public static final int ENVVAR_APPEND = IEnvironmentVariable.ENVVAR_APPEND; /** - * + * * @return the variable name */ + @Override public String getName(); /** - * + * * @return the variable value */ + @Override public String getValue(); /** * @return one of the IBuildEnvironmentVariable.ENVVAR_* operation types */ + @Override public int getOperation(); /** @@ -44,28 +47,29 @@ public interface IBuildEnvironmentVariable extends IEnvironmentVariable{ * the delimiter that is used to separate values. This information is used for the following: * * 1. in append and prepend operations: - * If the variable already exists and contains some value the new + * If the variable already exists and contains some value the new * value will be calculated in the following way: * For the "prepend" operation: * = * For the "append" operation: * = - * - * The Environment Variable Provider will also remove the duplicates of "sub-values" - * in the resulting value. + * + * The Environment Variable Provider will also remove the duplicates of "sub-values" + * in the resulting value. * For example: - * If the current value is "string1:string2:string3", the getDelimiter() method returns ":" + * If the current value is "string1:string2:string3", the getDelimiter() method returns ":" * and getValue() method returns "string4:string2" the new value will contain: * For the "prepend" operation: "string4:string2:string1:string3" * For the "append" operation: "string1:string3:string4:string2" - * - * 2. Since the environment variables are also treated as build macros the delimiter is also used + * + * 2. Since the environment variables are also treated as build macros the delimiter is also used * by the BuildMacroProvider to determine the type of the macro used to represent the * given environment variable. If the variable has the delimiter it is treated as the Text-List macro * otherwise it is treated as the Text macro. (See Build Macro design for more details) - * + * * To specify that no delimiter should be used, the getDelimiter() method should * return null or an empty string */ + @Override public String getDelimiter(); } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildCommand.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildCommand.java index 4c369639fb2..5a783ca54bb 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildCommand.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildCommand.java @@ -24,20 +24,21 @@ public class BuildCommand implements IBuildCommand { private String fArgs[]; private Map fEnv; private IPath fCWD; - + public BuildCommand(IPath cmd, String args[], Map env, IPath cwd, BuildStep step){ fCmd = cmd; if(args != null) fArgs = args.clone(); if(env != null) fEnv = new HashMap(env); - + fCWD = cwd; } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildCommand#getCommand() */ + @Override public IPath getCommand() { return fCmd; } @@ -45,6 +46,7 @@ public class BuildCommand implements IBuildCommand { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildCommand#getArgs() */ + @Override public String[] getArgs() { if(fArgs != null) return fArgs.clone(); @@ -54,6 +56,7 @@ public class BuildCommand implements IBuildCommand { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildCommand#getEnvironment() */ + @Override public Map getEnvironment() { if(fEnv != null) return new HashMap(fEnv); @@ -63,6 +66,7 @@ public class BuildCommand implements IBuildCommand { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildCommand#getCWD() */ + @Override public IPath getCWD() { return fCWD; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java index b760a869128..ebc71db1a48 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java @@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuilder.internal.buildmodel; import java.net.URI; -import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -167,6 +166,7 @@ public class BuildDescription implements IBuildDescription { fPostProcessMode = postProcess; } + @Override public boolean visit(IResourceProxy proxy) throws CoreException { try { if(proxy.getType() == IResource.FILE){ @@ -240,6 +240,7 @@ public class BuildDescription implements IBuildDescription { } + @Override public boolean visit(IResourceDelta delta) throws CoreException { if(fPostProcessMode) return postProcessVisit(delta); @@ -294,6 +295,7 @@ public class BuildDescription implements IBuildDescription { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IStepVisitor#visit(org.eclipse.cdt.managedbuilder.builddescription.IBuildStep) */ + @Override public int visit(IBuildStep a) throws CoreException { BuildStep action = (BuildStep)a; BuildResource rcs[] = (BuildResource[])action.getInputResources(); @@ -692,6 +694,7 @@ public class BuildDescription implements IBuildDescription { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getInputStep() */ + @Override public IBuildStep getInputStep() { return fInputStep; } @@ -699,6 +702,7 @@ public class BuildDescription implements IBuildDescription { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getOutputStep() */ + @Override public IBuildStep getOutputStep() { return fOutputStep; } @@ -1037,7 +1041,7 @@ public class BuildDescription implements IBuildDescription { } /** - * Turns a filesystem location into a URI using the project as the hint for the + * Turns a filesystem location into a URI using the project as the hint for the * URI metadata. * @param location toString() is used as the URI path * @return URI representing the location or null @@ -1456,6 +1460,7 @@ public class BuildDescription implements IBuildDescription { return location; } + @Override public IBuildResource getBuildResource(IPath location) { return getBuildResource(getURIForLocation(location)); } @@ -1463,10 +1468,11 @@ public class BuildDescription implements IBuildDescription { private IBuildResource getBuildResource(URI locationURI) { return fLocationToRcMap.get(locationURI); } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getResources() */ + @Override public IBuildResource[] getResources(){ return fLocationToRcMap.values().toArray(new IBuildResource[0]); } @@ -1484,6 +1490,7 @@ public class BuildDescription implements IBuildDescription { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getConfiguration() */ + @Override public IConfiguration getConfiguration() { return fCfg; } @@ -1747,26 +1754,32 @@ public class BuildDescription implements IBuildDescription { } depCalc = new IManagedDependencyCalculator(){ + @Override public IPath[] getAdditionalTargets() { return null; } + @Override public IPath[] getDependencies() { return paths; } + @Override public IBuildObject getBuildContext() { return bof; } + @Override public IPath getSource() { return rc.getLocation(); } + @Override public ITool getTool() { return tool; } + @Override public IPath getTopBuildDirectory() { return getTopBuildDirectory(); } @@ -2172,14 +2185,17 @@ public class BuildDescription implements IBuildDescription { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getDefaultBuildDirLocation() */ + @Override public IPath getDefaultBuildDirLocation() { return getTopBuildDirLocation(); } + @Override public URI getDefaultBuildDirLocationURI() { return getTopBuildDirLocationURI(); } + @Override public IPath getDefaultBuildDirFullPath() { return getTopBuildDirFullPath(); } @@ -2206,6 +2222,7 @@ public class BuildDescription implements IBuildDescription { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescription#getSteps() */ + @Override public IBuildStep[] getSteps() { return fStepList.toArray(new BuildStep[fStepList.size()]); } @@ -2213,6 +2230,7 @@ public class BuildDescription implements IBuildDescription { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription#findBuildResource(org.eclipse.core.resources.IResource) */ + @Override public IBuildResource getBuildResource(IResource resource){ return getBuildResource(calcResourceLocation(resource)); } @@ -2240,7 +2258,7 @@ public class BuildDescription implements IBuildDescription { for (IResourceInfo rcInfo : fCfg.getResourceInfos()) { // if(rcInfo.isExcluded()) // continue; - + ToolInfoHolder h = getToolInfo(rcInfo.getPath(), true); if(rcInfo instanceof IFolderInfo){ IFolderInfo fo = (IFolderInfo)rcInfo; diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescriptionGnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescriptionGnuMakefileGenerator.java index 69d28671477..6d1cea095cd 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescriptionGnuMakefileGenerator.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescriptionGnuMakefileGenerator.java @@ -43,22 +43,23 @@ public class BuildDescriptionGnuMakefileGenerator { private static final String EQUALS = "="; //$NON-NLS-1$ private static final String VARREF_PREFIX = "${"; //$NON-NLS-1$ private static final String VARREF_SUFFIX = "}"; //$NON-NLS-1$ - + private static final String DOT_DOT_SLASH = "../"; //$NON-NLS-1$ private static final String DOT_DOT_BACKSLASH = "..\\"; //$NON-NLS-1$ - + private IBuildDescription fDes; - + private class DescriptionVisitor implements IStepVisitor { Writer fWriter; DescriptionVisitor(Writer writer){ fWriter = writer; } - + + @Override public int visit(IBuildStep step) throws CoreException { if(step == fDes.getInputStep() || step == fDes.getOutputStep()) return VISIT_CONTINUE; - + try { write(fWriter, step); } catch (IOException e) { @@ -67,14 +68,14 @@ public class BuildDescriptionGnuMakefileGenerator { return VISIT_CONTINUE; } } - + public BuildDescriptionGnuMakefileGenerator(IBuildDescription des){ fDes = des; } - + public void store(OutputStream stream) throws CoreException{ Writer writer = createWriter(stream); - + try { writer.write(VAR_SOURCES); writer.write(EQUALS); @@ -96,18 +97,18 @@ public class BuildDescriptionGnuMakefileGenerator { writeRuleHeader(writer, ALL, IN_STEP_RULE + SPACE + OUT_STEP_RULE); writer.write(LINE_SEPARATOR); writer.write(LINE_SEPARATOR); - + write(writer, fDes.getOutputStep()); write(writer, fDes.getInputStep()); BuildDescriptionManager.accept(new DescriptionVisitor(writer), fDes, true); - + writer.flush(); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), ManagedMakeMessages.getString("BuildDescriptionGnuMakefileGenerator.1"), e)); //$NON-NLS-1$ } - + } protected Writer createWriter(OutputStream stream){ @@ -117,9 +118,9 @@ public class BuildDescriptionGnuMakefileGenerator { ManagedBuilderCorePlugin.log(e1); } return new OutputStreamWriter(stream); - + } - + protected String createVarRef(String var){ return new StringBuffer().append(VARREF_PREFIX).append(var).append(VARREF_SUFFIX).toString(); } @@ -140,26 +141,26 @@ public class BuildDescriptionGnuMakefileGenerator { target = toString(outputs); deps = toString(inputs); } - + writeRuleHeader(writer, target, deps); - + IBuildCommand[] cmds = step.getCommands(null, null, null, true); for(int i = 0; i < cmds.length; i++){ String cmdStr = toString(cmds[i]); writeCommand(writer, cmdStr); } - + writer.write(LINE_SEPARATOR); writer.write(LINE_SEPARATOR); } - + protected void writeCommand(Writer writer, String cmd) throws IOException{ writer.write(TAB); writer.write(cmd); writer.write(LINE_SEPARATOR); } - + protected String toString(IBuildCommand cmd){ StringBuffer buf = new StringBuffer(); buf.append(cmd.getCommand()); @@ -170,7 +171,7 @@ public class BuildDescriptionGnuMakefileGenerator { } return removeDotDotSlashesAndBackSlashesHack(buf.toString()); } - + protected void writeRuleHeader(Writer writer, String target, String deps) throws IOException{ writer.write(target); writer.write(TARGET_SEPARATOR); @@ -178,18 +179,18 @@ public class BuildDescriptionGnuMakefileGenerator { writer.write(deps); writer.write(LINE_SEPARATOR); } - + protected String toString(IBuildResource[] rcs){ StringBuffer buf = new StringBuffer(); for(int i = 0; i < rcs.length; i++){ if(i != 0) buf.append(SPACE); buf.append(toString(rcs[i])); - + } return buf.toString(); } - + protected String toString(IBuildResource rc){ return removeDotDotSlashesAndBackSlashesHack(BuildDescriptionManager.getRelPath(fDes.getDefaultBuildDirLocation(), rc.getLocation()).toString()); } @@ -218,7 +219,7 @@ public class BuildDescriptionGnuMakefileGenerator { } return str; } - + private String removeDotDotBackslashes(String str){ int index = str.indexOf(DOT_DOT_BACKSLASH, 0); if(index != -1){ diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildIOType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildIOType.java index fbb595244de..4ac398a5bdd 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildIOType.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildIOType.java @@ -51,10 +51,12 @@ public class BuildIOType implements IBuildIOType { ((BuildDescription)fStep.getBuildDescription()).typeCreated(this); } + @Override public IBuildResource[] getResources() { return fResources.toArray(new BuildResource[fResources.size()]); } + @Override public IBuildStep getStep() { return fStep; } @@ -66,14 +68,14 @@ public class BuildIOType implements IBuildIOType { DbgUtil.trace("resource " + DbgUtil.resourceName(rc) + " added as " //$NON-NLS-1$ //$NON-NLS-2$ + (fIsInput ? "input" : "output") //$NON-NLS-1$ //$NON-NLS-2$ + " to the action " + DbgUtil.stepName(fStep)); //$NON-NLS-1$ - + ((BuildDescription)fStep.getBuildDescription()).resourceAddedToType(this, rc); } - + public void removeResource(BuildResource rc){ fResources.remove(rc); rc.removeFromArg(this); - + if(DbgUtil.DEBUG) DbgUtil.trace("resource " + DbgUtil.resourceName(rc) + " removed as " //$NON-NLS-1$ //$NON-NLS-2$ + (fIsInput ? "input" : "output") //$NON-NLS-1$ //$NON-NLS-2$ @@ -82,16 +84,17 @@ public class BuildIOType implements IBuildIOType { ((BuildDescription)fStep.getBuildDescription()).resourceRemovedFromType(this, rc); } + @Override public boolean isInput() { return fIsInput; } - + public boolean isPrimary(){ return fIsPrimary; } - + public String getLinkId(){ - if(!fIsInput && fStep.getTool() != null && /*(fLinkId == null || fLinkId.length() == 0) && */ + if(!fIsInput && fStep.getTool() != null && /*(fLinkId == null || fLinkId.length() == 0) && */ fStep.getTool().getCustomBuildStep()){ IBuildResource rcs[] = getResources(); if(rcs.length != 0){ @@ -103,7 +106,7 @@ public class BuildIOType implements IBuildIOType { } else { } } - + } return fLinkId; } @@ -111,14 +114,14 @@ public class BuildIOType implements IBuildIOType { public IBuildObject getIoType(){ return fIoType; } - + BuildResource[] remove(){ BuildResource rcs[] = (BuildResource[])getResources(); - + for(int i = 0; i < rcs.length; i++){ removeResource(rcs[i]); } - + fStep = null; return rcs; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildResource.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildResource.java index aea988620eb..af997d7ab45 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildResource.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildResource.java @@ -31,7 +31,7 @@ public class BuildResource implements IBuildResource { private BuildIOType fProducerArg; private boolean fNeedsRebuild; private boolean fIsRemoved; - private IPath fFullWorkspacePath; + private IPath fFullWorkspacePath; private boolean fIsProjectRc; private BuildDescription fInfo; private URI fLocationURI; @@ -41,25 +41,26 @@ public class BuildResource implements IBuildResource { } protected BuildResource(BuildDescription info, IPath fullWorkspacePath, URI locationURI){ - + if(locationURI == null) throw new IllegalArgumentException(); // must point to somewhere! - + fLocationURI = locationURI; - + fFullWorkspacePath = fullWorkspacePath; fInfo = info; - + fIsProjectRc = (fullWorkspacePath != null); info.resourceCreated(this); - + if(DbgUtil.DEBUG) DbgUtil.trace("resource " + fullWorkspacePath + " created"); //$NON-NLS-1$ //$NON-NLS-2$ } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getLocation() */ + @Override public IPath getLocation() { if(fFullWorkspacePath == null) { return new Path(fLocationURI.getPath()); @@ -69,7 +70,7 @@ public class BuildResource implements IBuildResource { if(resource == null) { return new Path(fLocationURI.getPath()); } - + if(resource.getLocation() != null) return resource.getLocation(); else @@ -79,6 +80,7 @@ public class BuildResource implements IBuildResource { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getFullPath() */ + @Override public IPath getFullPath() { return fFullWorkspacePath; //return new Path(getLocationURI().getPath().toString()); @@ -87,6 +89,7 @@ public class BuildResource implements IBuildResource { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getProducerIOType() */ + @Override public IBuildIOType getProducerIOType() { return fProducerArg; } @@ -94,6 +97,7 @@ public class BuildResource implements IBuildResource { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#getDependentIOTypes() */ + @Override public IBuildIOType[] getDependentIOTypes() { return fDepArgs.toArray(new BuildIOType[fDepArgs.size()]); } @@ -101,17 +105,19 @@ public class BuildResource implements IBuildResource { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#needsRebuild() */ + @Override public boolean needsRebuild() { return fNeedsRebuild; } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildResource#isRemoved() */ + @Override public boolean isRemoved() { return fIsRemoved; } - + public void setRemoved(boolean removed) { if(DbgUtil.DEBUG){ if(removed) @@ -121,7 +127,7 @@ public class BuildResource implements IBuildResource { if(fIsRemoved) fNeedsRebuild = false; } - + public void setRebuildState(boolean rebuild){ fNeedsRebuild = rebuild; } @@ -143,19 +149,19 @@ public class BuildResource implements IBuildResource { String step1Name = DbgUtil.stepName(fProducerArg.getStep()); String step2Name = DbgUtil.stepName(arg.getStep()); String rcs[] = new String[]{rcName, step1Name, step2Name}; - + String externalizedErr = BuildModelMessages.getFormattedString("BuildResource.0", rcs); //$NON-NLS-1$ if(DbgUtil.DEBUG){ err = err + externalizedErr + "curent producer: " + DbgUtil.dumpStep(fProducerArg.getStep()) + "\n producer attempt: " + DbgUtil.dumpStep(arg.getStep()); //$NON-NLS-1$ //$NON-NLS-2$ } - - + + throw new IllegalArgumentException(externalizedErr); } } } - + void removeFromArg(BuildIOType arg){ if(arg.isInput()){ fDepArgs.remove(arg); @@ -166,43 +172,46 @@ public class BuildResource implements IBuildResource { throw new IllegalArgumentException("Resource is not produced by this arg!!!"); //$NON-NLS-1$ } } - + + @Override public boolean isProjectResource() { return fIsProjectRc; } - + BuildIOType[][] clear(){ BuildIOType types[][] = new BuildIOType[2][]; types[0] = new BuildIOType[1]; types[0][0] = fProducerArg; BuildIOType outs[] = (BuildIOType[])getDependentIOTypes(); types[1] = outs; - + if(fProducerArg != null) fProducerArg.removeResource(this); for(int i = 0; i < outs.length; i++){ outs[i].removeResource(this); } - + return types; } - + BuildIOType[][] remove(){ BuildIOType types[][] = clear(); - + if(DbgUtil.DEBUG) DbgUtil.trace("resource " + DbgUtil.resourceName(this) + " removed"); //$NON-NLS-1$ //$NON-NLS-2$ - + fInfo.resourceRemoved(this); fInfo = null; - + return types; } - + + @Override public IBuildDescription getBuildDescription(){ return fInfo; } + @Override public IBuildStep[] getDependentSteps() { Set set = new HashSet(); for(Iterator iter = fDepArgs.iterator(); iter.hasNext();){ @@ -211,6 +220,7 @@ public class BuildResource implements IBuildResource { return set.toArray(new BuildStep[set.size()]); } + @Override public IBuildStep getProducerStep() { if(fProducerArg != null) return fProducerArg.getStep(); @@ -226,13 +236,14 @@ public class BuildResource implements IBuildResource { buf.append("WSP|").append(fullPath); //$NON-NLS-1$ else buf.append("FS|").append(getLocation()); //$NON-NLS-1$ - + return buf.toString(); } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource#getLocationURI() */ + @Override public URI getLocationURI() { return fLocationURI; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildStateManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildStateManager.java index 1128ee57a77..917a4f06a6a 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildStateManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildStateManager.java @@ -29,21 +29,25 @@ public class BuildStateManager { private static final String PREFS_LOCATION = "buildState"; //$NON-NLS-1$ private static BuildStateManager fInstance; - + private EventListener fListener; - + private class ResourceMoveHandler implements IResourceMoveHandler { + @Override public void done() { } + @Override public void handleProjectClose(IProject project) { } + @Override public boolean handleResourceMove(IResource fromRc, IResource toRc) { return doHandleResourceRemove(fromRc); } + @Override public boolean handleResourceRemove(IResource rc) { return doHandleResourceRemove(rc); } @@ -60,7 +64,7 @@ public class BuildStateManager { return false; } } - + private class EventListener extends ResourceChangeHandlerBase implements ICProjectDescriptionListener { @Override @@ -69,6 +73,7 @@ public class BuildStateManager { //TODO: may handle resource changes as well } + @Override public void handleEvent(CProjectDescriptionEvent event) { switch(event.getEventType()){ case CProjectDescriptionEvent.APPLIED: @@ -78,11 +83,11 @@ public class BuildStateManager { break; } } - + private void processAppliedDelta(CProjectDescriptionEvent event, ICDescriptionDelta delta){ if(delta == null) return; - + IProjectBuildState pbs = null; boolean apply = false; switch (delta.getDeltaKind()) { @@ -108,7 +113,7 @@ public class BuildStateManager { default: break; } - + if(pbs != null && apply){ setProjectBuildState(event.getProject(), pbs); } @@ -119,9 +124,9 @@ public class BuildStateManager { IResourceChangeEvent event) { return new ResourceMoveHandler(); } - + } - + private void removeProjectInfo(IProject project){ File f = getPrefsDir(project); if(f.exists()){ @@ -132,22 +137,22 @@ public class BuildStateManager { f.delete(); } } - + private BuildStateManager(){ } - + public static BuildStateManager getInstance(){ if(fInstance == null) fInstance = new BuildStateManager(); return fInstance; } - + public void startup(){ if(fListener == null){ fListener = new EventListener(); CoreModel.getDefault().getProjectDescriptionManager().addCProjectDescriptionListener(fListener, CProjectDescriptionEvent.APPLIED | CProjectDescriptionEvent.LOADED); - ResourcesPlugin.getWorkspace().addResourceChangeListener(fListener, - IResourceChangeEvent.POST_CHANGE + ResourcesPlugin.getWorkspace().addResourceChangeListener(fListener, + IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.PRE_CLOSE); } @@ -167,7 +172,7 @@ public class BuildStateManager { public void setProjectBuildState(IProject project, IProjectBuildState state){ ((ProjectBuildState)state).serialize(); } - + private IPath getPrefsDirPath(){ IPath path = ManagedBuilderCorePlugin.getDefault().getStateLocation(); path = path.append(PREFS_LOCATION); @@ -179,7 +184,7 @@ public class BuildStateManager { path = path.append(project.getName()); return path; } - + private File getPrefsDir(IProject project){ IPath path = getPrefsDirPath(project); File file = path.toFile(); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildStep.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildStep.java index c91d170f2b0..0142f707db9 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildStep.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildStep.java @@ -56,21 +56,22 @@ public class BuildStep implements IBuildStep { private IInputType fInputType; private ITool fLibTool; private boolean fAssignToCalculated; - + protected BuildStep(BuildDescription des, ITool tool, IInputType inputType){ fTool = tool; fInputType = inputType; fBuildDescription = des; - + if(DbgUtil.DEBUG) DbgUtil.trace("step " + DbgUtil.stepName(this) + " created"); //$NON-NLS-1$ //$NON-NLS-2$ - + des.stepCreated(this); } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getInputIOTypes() */ + @Override public IBuildIOType[] getInputIOTypes() { return fInputTypes.toArray(new BuildIOType[fInputTypes.size()]); } @@ -78,6 +79,7 @@ public class BuildStep implements IBuildStep { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getOutputIOTypes() */ + @Override public IBuildIOType[] getOutputIOTypes() { return fOutputTypes.toArray(new BuildIOType[fOutputTypes.size()]); } @@ -85,65 +87,66 @@ public class BuildStep implements IBuildStep { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#needsRebuild() */ + @Override public boolean needsRebuild() { - if(fNeedsRebuild + if(fNeedsRebuild || (fTool != null && fTool.needsRebuild()) || (fLibTool != null && fLibTool.needsRebuild())) return true; - + if(fBuildGroup != null && fBuildGroup.needsRebuild()) return true; - + return false; } - + public void setRebuildState(boolean rebuild){ fNeedsRebuild = rebuild; } public BuildResource[] removeIOType(BuildIOType type) { - + BuildResource rcs[] = type.remove(); - + if(type.isInput()) fInputTypes.remove(type); else fOutputTypes.remove(type); - + return rcs; } - + BuildResource[][] remove(){ BuildResource[][] rcs = clear(); - + if(DbgUtil.DEBUG) DbgUtil.trace("step " + DbgUtil.stepName(this) + " removed"); //$NON-NLS-1$ //$NON-NLS-2$ fBuildDescription.stepRemoved(this); fBuildDescription = null; - + return rcs; } - + BuildResource[][] clear(){ BuildResource[][] rcs = new BuildResource[2][]; rcs[0] = (BuildResource[])getInputResources(); rcs[1] = (BuildResource[])getOutputResources(); - + BuildIOType types[] = (BuildIOType[])getInputIOTypes(); for(int i = 0; i < types.length; i++){ removeIOType(types[i]); } - + types = (BuildIOType[])getOutputIOTypes(); for(int i = 0; i < types.length; i++){ removeIOType(types[i]); } - + return rcs; } - + public void removeResource(BuildIOType type, BuildResource rc, boolean rmTypeIfEmpty){ type.removeResource(rc); if(rmTypeIfEmpty && type.getResources().length == 0){ @@ -159,27 +162,27 @@ public class BuildStep implements IBuildStep { if(fBuildDescription.getOutputStep() == this) throw new IllegalArgumentException("input step can not have outputs"); //$NON-NLS-1$ } - + BuildIOType arg = new BuildIOType(this, input, primary, /*ext,*/ ioType); if(input) fInputTypes.add(arg); else fOutputTypes.add(arg); - + return arg; } public void setTool(ITool tool){ fTool = tool; } - + public ITool getTool(){ return fTool; } - + public BuildIOType[] getPrimaryTypes(boolean input){ List types = input ? fInputTypes : fOutputTypes; - + List list = new ArrayList(); for (BuildIOType arg : types) { if(arg.isPrimary()) @@ -187,11 +190,11 @@ public class BuildStep implements IBuildStep { } return list.toArray(new BuildIOType[list.size()]); } - + public BuildIOType getIOTypeForType(IBuildObject ioType, boolean input){ List list = input ? fInputTypes : fOutputTypes; - - if(ioType != null){ + + if(ioType != null){ for (BuildIOType arg : list) { if(arg.getIoType() == ioType) return arg; @@ -210,6 +213,7 @@ public class BuildStep implements IBuildStep { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getInputResources() */ + @Override public IBuildResource[] getInputResources() { return getResources(true); } @@ -217,10 +221,11 @@ public class BuildStep implements IBuildStep { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getOutputResources() */ + @Override public IBuildResource[] getOutputResources() { return getResources(false); } - + public IBuildResource[] getResources(boolean input){ List list = input ? fInputTypes : fOutputTypes; Set set = new HashSet(); @@ -234,15 +239,16 @@ public class BuildStep implements IBuildStep { return set.toArray(new BuildResource[set.size()]); } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getCommands(org.eclipse.core.runtime.IPath, java.util.Map, java.util.Map, boolean) */ + @Override public IBuildCommand[] getCommands(IPath cwd, Map inputArgValues, Map outputArgValues, boolean resolveAll) { if(cwd == null) cwd = calcCWD(); - + if(fTool == null){ String step = null; String appendToLastStep = null; @@ -252,31 +258,31 @@ public class BuildStep implements IBuildStep { step = fBuildDescription.getConfiguration().getPostbuildStep(); } else if(this == fBuildDescription.getCleanStep()){ step = fBuildDescription.getConfiguration().getCleanCommand(); - + IBuildResource[] generated = fBuildDescription.getResources(true); if(generated.length != 0){ StringBuffer buf = new StringBuffer(); for(int i = 0; i < generated.length; i++){ buf.append(' '); - + IPath rel = BuildDescriptionManager.getRelPath(cwd, generated[i].getLocation()); buf.append(rel.toString()); } appendToLastStep = buf.toString(); } } - + if(step != null && (step = step.trim()).length() > 0){ step = resolveMacros(step, resolveAll); if(step != null && (step = step.trim()).length() > 0){ String commands[] = step.split(";"); //$NON-NLS-1$ - + if(appendToLastStep != null && commands.length != 0){ commands[commands.length - 1] = commands[commands.length - 1] + appendToLastStep; } - - List list = new ArrayList(); + + List list = new ArrayList(); for(int i = 0; i < commands.length; i++){ IBuildCommand cmds[] = createCommandsFromString(commands[i], cwd, getEnvironment()); for(int j = 0; j < cmds.length; j++){ @@ -288,10 +294,10 @@ public class BuildStep implements IBuildStep { } return new IBuildCommand[0]; } - - + + performAsignToOption(cwd); - + BuildResource inRc = getRcForMacros(true); BuildResource outRc = getRcForMacros(false); IPath inRcPath = inRc != null ? BuildDescriptionManager.getRelPath(cwd, inRc.getLocation()) : null; @@ -302,19 +308,19 @@ public class BuildStep implements IBuildStep { String outPrefix = fTool.getOutputPrefix(); outPrefix = resolveMacros(outPrefix, data, true); outRcPath = rmNamePrefix(outRcPath, outPrefix); - - IManagedCommandLineInfo info = gen.generateCommandLineInfo(fTool, + + IManagedCommandLineInfo info = gen.generateCommandLineInfo(fTool, fTool.getToolCommand(), - getCommandFlags(inRcPath, outRcPath, resolveAll), - fTool.getOutputFlag(), + getCommandFlags(inRcPath, outRcPath, resolveAll), + fTool.getOutputFlag(), outPrefix, listToString(resourcesToStrings(cwd, getPrimaryResources(false), outPrefix), " "), //$NON-NLS-1$ - getInputResources(cwd, getPrimaryResources(true)), + getInputResources(cwd, getPrimaryResources(true)), fTool.getCommandLinePattern()); return createCommandsFromString(resolveMacros(info.getCommandLine(), data, true), cwd, getEnvironment()); } - + private IPath rmNamePrefix(IPath path, String prefix){ if(prefix != null && prefix.length() != 0){ String name = path.lastSegment(); @@ -325,10 +331,10 @@ public class BuildStep implements IBuildStep { } return path; } - + private String[] getInputResources(IPath cwd, BuildResource[] rcs) { String[] resources = resourcesToStrings(cwd, rcs, null); - + // also need to get libraries String[] libs = null; IOption[] opts = fTool.getOptions(); @@ -347,7 +353,7 @@ public class BuildStep implements IBuildStep { } catch (BuildException e) { } } - + if (libs != null) { String[] irs = new String[resources.length + libs.length]; System.arraycopy(resources, 0, irs, 0, resources.length); @@ -357,20 +363,20 @@ public class BuildStep implements IBuildStep { return resources; } } - + private IPath calcCWD(){ IPath cwd = fBuildDescription.getDefaultBuildDirLocation(); - + if(!cwd.isAbsolute()) cwd = fBuildDescription.getConfiguration().getOwner().getProject().getLocation().append(cwd); - + return cwd; } protected Map getEnvironment(){ return fBuildDescription.getEnvironment(); } - + protected IBuildCommand[] createCommandsFromString(String cmd, IPath cwd, Map env){ char arr[] = cmd.toCharArray(); char expect = 0; @@ -379,7 +385,7 @@ public class BuildStep implements IBuildStep { List list = new ArrayList(); StringBuffer buf = new StringBuffer(); for(int i = 0; i < arr.length; i++){ - char ch = arr[i]; + char ch = arr[i]; switch(ch){ case '\'': case '"': @@ -411,40 +417,40 @@ public class BuildStep implements IBuildStep { default: buf.append(ch); break; - + } prev = ch; } - + if(buf.length() > 0) list.add(buf.toString()); - + IPath c = new Path(list.remove(0)); String[] args = list.toArray(new String[list.size()]); - + return new IBuildCommand[]{new BuildCommand(c, args, env, cwd, this)}; } - + private BuildResource[] getPrimaryResources(boolean input){ BuildIOType[] types = getPrimaryTypes(input); if(types.length == 0) types = input ? (BuildIOType[])getInputIOTypes() : (BuildIOType[])getOutputIOTypes(); List list = new ArrayList(); - + for(int i = 0; i < types.length; i++){ BuildResource [] rcs = (BuildResource[])types[i].getResources(); - + for(int j = 0; j < rcs.length; j++){ list.add(rcs[j]); } } - + return list.toArray(new BuildResource[list.size()]); } - + private String[] resourcesToStrings(IPath cwd, BuildResource rcs[], String prefixToRm){ List list = new ArrayList(rcs.length); - + for(int i = 0; i < rcs.length; i++){ IPath path = BuildDescriptionManager.getRelPath(cwd, rcs[i].getLocation()); path = rmNamePrefix(path, prefixToRm); @@ -487,7 +493,7 @@ public class BuildStep implements IBuildStep { private SupplierBasedCdtVariableSubstitutor createSubstitutor(IConfiguration cfg, IBuilder builder, IFileContextData fileData){ BuildMacroProvider prov = (BuildMacroProvider)ManagedBuildManager.getBuildMacroProvider(); - IMacroContextInfo info = prov.getMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE, fileData); + IMacroContextInfo info = prov.getMacroContextInfo(IBuildMacroProvider.CONTEXT_FILE, fileData); FileMacroExplicitSubstitutor sub = new FileMacroExplicitSubstitutor( info, cfg, @@ -496,13 +502,13 @@ public class BuildStep implements IBuildStep { return sub; } - + private String[] getCommandFlags(IPath inRcPath, IPath outRcPath, boolean resolveAll){ try { if(resolveAll) { IConfiguration cfg = getBuildDescription().getConfiguration(); IBuilder builder = cfg.getBuilder(); - return ((Tool)fTool).getToolCommandFlags(inRcPath, outRcPath, + return ((Tool)fTool).getToolCommandFlags(inRcPath, outRcPath, createSubstitutor(cfg, builder, new FileContextData(inRcPath, outRcPath, null, fTool)), BuildMacroProvider.getDefault()); @@ -512,20 +518,20 @@ public class BuildStep implements IBuildStep { } return new String[0]; } - + private String listToString(String[] list, String delimiter){ if(list == null || list.length == 0) return new String(); StringBuffer buf = new StringBuffer(list[0]); - + for(int i = 1; i < list.length; i++){ buf.append(delimiter).append(list[i]); } - + return buf.toString(); } - + private BuildResource getRcForMacros(boolean input){ IBuildIOType types[] = getPrimaryTypes(input); if(types.length != 0){ @@ -535,7 +541,7 @@ public class BuildStep implements IBuildStep { return (BuildResource)rcs[0]; } } - + types = input ? getInputIOTypes() : getOutputIOTypes(); if(types.length != 0){ for(int i = 0; i < types.length; i++){ @@ -547,30 +553,32 @@ public class BuildStep implements IBuildStep { return null; } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#isRemoved() */ + @Override public boolean isRemoved(){ return fIsRemoved; } - + public void setRemoved() { fIsRemoved = true; fNeedsRebuild = false; } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildStep#getBuildDescription() */ + @Override public IBuildDescription getBuildDescription(){ return fBuildDescription; } - + boolean isMultiAction(){ BuildIOType args[] = getPrimaryTypes(true); BuildIOType arg = args.length > 0 ? args[0] : null; - + if(arg != null){ if(arg.getIoType() != null) return ((IInputType)arg.getIoType()).getMultipleOfType(); @@ -578,33 +586,33 @@ public class BuildStep implements IBuildStep { } return false; } - + public IInputType getInputType(){ return fInputType; } - + public void setLibTool(ITool libTool){ fLibTool = libTool; } - + public ITool getLibTool(){ return fLibTool; } - + protected void performAsignToOption(IPath cwd){ if(fTool == null && !fAssignToCalculated) return; - + fAssignToCalculated = true; IConfiguration cfg = fBuildDescription.getConfiguration(); - + for (BuildIOType bType : fInputTypes) { IInputType type = (IInputType)bType.getIoType(); - + if(type == null) continue; - + IOption option = fTool.getOptionBySuperClassId(type.getOptionId()); IOption assignToOption = fTool.getOptionBySuperClassId(type.getAssignToOptionId()); if (assignToOption != null && option == null) { @@ -619,7 +627,7 @@ public class BuildStep implements IBuildStep { } optVal += BuildDescriptionManager.getRelPath(cwd, bRcs[j].getLocation()).toOSString(); } - ManagedBuildManager.setOption(cfg, fTool, assignToOption, optVal); + ManagedBuildManager.setOption(cfg, fTool, assignToOption, optVal); } else if ( optType == IOption.STRING_LIST || optType == IOption.LIBRARIES || @@ -636,7 +644,7 @@ public class BuildStep implements IBuildStep { optType == IOption.UNDEF_LIBRARY_PATHS || optType == IOption.UNDEF_LIBRARY_FILES || optType == IOption.UNDEF_MACRO_FILES){ - // Mote that when using the enumerated inputs, the path(s) must be translated from project relative + // Mote that when using the enumerated inputs, the path(s) must be translated from project relative // to top build directory relative String[] paths = new String[bRcs.length]; for (int j=0; j map){ if(map == null) return null; - + List list = new ArrayList(); - + Set> entrySet = map.entrySet(); for (Entry entry : entrySet) { list.add(entry.getKey() + '=' + entry.getValue()); } - + return list.toArray(new String[list.size()]); } @@ -268,7 +269,7 @@ public class CommandBuilder implements IBuildModelBuilder { // ignore; } } - + } protected void printMessage(String msg, OutputStream os){ @@ -276,21 +277,21 @@ public class CommandBuilder implements IBuildModelBuilder { msg = ManagedMakeMessages.getFormattedString(BUILDER_MSG_HEADER, msg); printMessage(null, msg, os); } - + } - + private void printErrorMessage(String msg, OutputStream os){ if (os != null) { String errorPrefix = ManagedMakeMessages.getResourceString("ManagedMakeBuilder.error.prefix"); //$NON-NLS-1$ printMessage(errorPrefix, msg, os); } - + } - + public int getNumCommands() { return 1; } - + protected String getCommandLine() { StringBuffer buf = new StringBuffer(); if (fCmd != null) { @@ -310,7 +311,7 @@ public class CommandBuilder implements IBuildModelBuilder { return command; return searchExecutable(command, getPaths(environment)); } - + private String[] getPaths(Map env){ String pathsStr = env.get(PATH_ENV); if(pathsStr == null){ @@ -324,23 +325,23 @@ public class CommandBuilder implements IBuildModelBuilder { } if(pathsStr != null){ String delimiter = getDelimiter(); - + return pathsStr.split(delimiter); } return null; } - + private String getDelimiter(){ String delimiter = System.getProperty(PROPERTY_DELIMITER); if(delimiter == null) delimiter = isWindows() ? DELIMITER_WINDOWS : DELIMITER_UNIX; return delimiter; } - + private String searchExecutable(String command, String paths[]){ if(paths == null) return null; - + for(int i = 0; i < paths.length; i++){ File file = new File(paths[i], command.toString()); if(file.isFile()) @@ -348,7 +349,7 @@ public class CommandBuilder implements IBuildModelBuilder { } return null; } - + private boolean isWindows() { String prop = System.getProperty(PROPERTY_OS_NAME); return prop != null ? prop.toLowerCase().startsWith(PROPERTY_OS_VALUE) : false; diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ConfigurationBuildState.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ConfigurationBuildState.java index 95a6043cb9c..12c3c8a319b 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ConfigurationBuildState.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ConfigurationBuildState.java @@ -27,34 +27,35 @@ public class ConfigurationBuildState implements IConfigurationBuildState { private final static Integer REBUILD_STATE = new Integer(NEED_REBUILD); private final static Integer REMOVED_STATE = new Integer(REMOVED); private final static Integer NONE_STATE = new Integer(0); - + private HashMap> fStateToPathListMap; private Properties fPathToStateProps; private String fCfgId; private IProject fProject; private int fState; - + ConfigurationBuildState(IProject project, String cfgId){ fCfgId = cfgId; fProject = project; fState = NEED_REBUILD; } - + void setProject(IProject project){ fProject = project; } + @Override public IPath[] getFullPathsForState(int state) { if(fStateToPathListMap == null) return new IPath[0]; - + Set set = fStateToPathListMap.get(new Integer(state)); if(set == null) return new IPath[0]; return setToFullPaths(set); } - + private IPath[] setToFullPaths(Set set){ IPath paths[] = new IPath[set.size()]; IPath path = fProject.getFullPath(); @@ -65,6 +66,7 @@ public class ConfigurationBuildState implements IConfigurationBuildState { return paths; } + @Override public int getStateForFullPath(IPath fullPath) { if(fPathToStateProps == null) return 0; @@ -78,12 +80,13 @@ public class ConfigurationBuildState implements IConfigurationBuildState { return 0; } + @Override public void setStateForFullPath(IPath fullPath, int state) { String str = fullPathToString(fullPath); int cur = getStateForFullPath(fullPath); if(cur == state) return; - + if(fPathToStateProps == null){ fPathToStateProps = new Properties(); fStateToPathListMap = new HashMap>(); @@ -92,7 +95,7 @@ public class ConfigurationBuildState implements IConfigurationBuildState { Integer iState = stateToInt(strState); if(iState == null) throw new IllegalArgumentException(); - + if(cur != 0){ Set set = fStateToPathListMap.get(new Integer(cur)); set.remove(str); @@ -109,10 +112,10 @@ public class ConfigurationBuildState implements IConfigurationBuildState { } set.add(str); } else { - fPathToStateProps.remove(str); + fPathToStateProps.remove(str); } } - + private String fullPathToString(IPath fullPath){ return fullPath.removeFirstSegments(1).toString(); } @@ -134,7 +137,7 @@ public class ConfigurationBuildState implements IConfigurationBuildState { } list.add((String)entry.getKey()); } - + //TODO: trim lists if(map.size() != 0){ fStateToPathListMap = map; @@ -142,7 +145,7 @@ public class ConfigurationBuildState implements IConfigurationBuildState { } fState = 0; } - + public void store(OutputStream oStream) throws IOException{ if(fPathToStateProps != null) fPathToStateProps.store(oStream, ""); //$NON-NLS-1$ @@ -154,7 +157,7 @@ public class ConfigurationBuildState implements IConfigurationBuildState { // public void store(Properties props){ // if(fStateToPathListMap == null) // return; -// +// // for(Iterator iter = fStateToPathListMap.entrySet().iterator(); iter.hasNext();){ // Map.Entry entry = (Map.Entry)iter.next(); // String propValue = stateToString((Integer)entry.getKey()); @@ -184,28 +187,32 @@ public class ConfigurationBuildState implements IConfigurationBuildState { return state.toString(); } + @Override public int getState() { return fState; } + @Override public void setState(int state) { fState = state; clear(); } - + private void clear(){ fPathToStateProps = null; fStateToPathListMap = null; } + @Override public String getConfigurationId() { return fCfgId; } + @Override public IProject getProject() { return fProject; } - + public boolean exists(){ return fState == 0; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/DefaultBuildDescriptionFactory.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/DefaultBuildDescriptionFactory.java index 117a9f40396..bde693fcea2 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/DefaultBuildDescriptionFactory.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/DefaultBuildDescriptionFactory.java @@ -20,7 +20,7 @@ import org.eclipse.core.runtime.CoreException; public class DefaultBuildDescriptionFactory implements IBuildDescriptionFactory { static private DefaultBuildDescriptionFactory fInstance; protected DefaultBuildDescriptionFactory(){ - + } public static DefaultBuildDescriptionFactory getInstance(){ @@ -28,10 +28,11 @@ public class DefaultBuildDescriptionFactory implements IBuildDescriptionFactory fInstance = new DefaultBuildDescriptionFactory(); return fInstance; } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescriptionFactory#createBuildDescription(org.eclipse.cdt.managedbuilder.core.IConfiguration, org.eclipse.core.resources.IResourceDelta, int) */ + @Override public IBuildDescription createBuildDescription(IConfiguration cfg, IResourceDelta delta, int flags) throws CoreException { return createBuildDescription(cfg, null, delta, flags); } @@ -48,10 +49,11 @@ public class DefaultBuildDescriptionFactory implements IBuildDescriptionFactory /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IBuildDescriptionFactory#getSupportedMethods() */ + @Override public int getSupportedMethods() { - return BuildDescriptionManager.REMOVED - | BuildDescriptionManager.REBUILD - | BuildDescriptionManager.DEPFILES + return BuildDescriptionManager.REMOVED + | BuildDescriptionManager.REBUILD + | BuildDescriptionManager.DEPFILES | BuildDescriptionManager.DEPS; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/DescriptionBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/DescriptionBuilder.java index ea9966e500f..77fb344e986 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/DescriptionBuilder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/DescriptionBuilder.java @@ -28,20 +28,20 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.SubProgressMonitor; /** - * + * * This class implements the IBuildDescription building, - * that is the build of the entire configuration/project + * that is the build of the entire configuration/project * To perform a build, create an instance of this class * and invoke the build method * - * NOTE: This class is subject to change and discuss, + * NOTE: This class is subject to change and discuss, * and is currently available in experimental mode only - * + * */ public class DescriptionBuilder implements IBuildModelBuilder { private static final String BUILDER_MSG_HEADER = "InternalBuilder.msg.header"; //$NON-NLS-1$ private static final String BUILDER_NOTHING_TODO = "InternalBuilder.nothing.todo"; //$NON-NLS-1$ - private static final String LINE_SEPARATOR = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + private static final String LINE_SEPARATOR = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ private IBuildDescription fDes; @@ -52,7 +52,7 @@ public class DescriptionBuilder implements IBuildModelBuilder { private int fNumCommands = -1; private GenDirInfo fDir; private IResourceRebuildStateContainer fRebuildStateContainer; - + private class BuildStepVisitor implements IStepVisitor{ private OutputStream fOut; private OutputStream fErr; @@ -71,14 +71,15 @@ public class DescriptionBuilder implements IBuildModelBuilder { fStatus = STATUS_OK; fBuild = build; } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.builddescription.IStepVisitor#visit(org.eclipse.cdt.managedbuilder.builddescription.IBuildStep) */ + @Override public int visit(IBuildStep action) throws CoreException { if(fMonitor.isCanceled()) return VISIT_STOP; - + if(DbgUtil.DEBUG) DbgUtil.trace("visiting step " + DbgUtil.stepName(action)); //$NON-NLS-1$ if(!action.isRemoved() @@ -86,7 +87,7 @@ public class DescriptionBuilder implements IBuildModelBuilder { if(DbgUtil.DEBUG) DbgUtil.trace("step " + DbgUtil.stepName(action) + " needs rebuild" ); //$NON-NLS-1$ //$NON-NLS-2$ StepBuilder builder = getStepBuilder(action);//new StepBuilder(action, fCWD, fResumeOnErrs, fDir); - + if(fBuild){ switch(builder.build(fOut, fErr, new SubProgressMonitor(fMonitor, builder.getNumCommands()))){ case STATUS_OK: @@ -97,20 +98,20 @@ public class DescriptionBuilder implements IBuildModelBuilder { case STATUS_ERROR_BUILD: case STATUS_ERROR_LAUNCH: default: - fStatus = STATUS_ERROR_BUILD; + fStatus = STATUS_ERROR_BUILD; break; } } else { fNumCommands += builder.getNumCommands(); } } - - if(fStatus != STATUS_CANCELLED + + if(fStatus != STATUS_CANCELLED && (fResumeOnErrs || fStatus == STATUS_OK)) return VISIT_CONTINUE; return VISIT_STOP; } - + } public DescriptionBuilder(IBuildDescription des, IResourceRebuildStateContainer rs){ @@ -131,27 +132,28 @@ public class DescriptionBuilder implements IBuildModelBuilder { fBuildIncrementaly = buildIncrementaly; fResumeOnErrs = resumeOnErrs; fDir = new GenDirInfo(fDes.getConfiguration()); - + if(fCWD == null) fCWD = fDes.getDefaultBuildDirLocation(); - + fRebuildStateContainer = rs; } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.internal.builddescription.IBuildDescriptionBuilder#build(java.io.OutputStream, java.io.OutputStream, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public int build(OutputStream out, OutputStream err, IProgressMonitor monitor){ - + initRebuildStates(); int num = getNumCommands(); int status = STATUS_OK; - + //TODO: should we specify some task name here? monitor.beginTask("", num > 0 ? num : 1); //$NON-NLS-1$ monitor.subTask(""); //$NON-NLS-1$ - + if(num > 0){ BuildStepVisitor visitor = new BuildStepVisitor(out, err, monitor); try { @@ -160,12 +162,12 @@ public class DescriptionBuilder implements IBuildModelBuilder { } catch (CoreException e) { status = STATUS_ERROR_LAUNCH; } - + if(status == STATUS_OK) status = visitor.fStatus; } else { printMessage( - ManagedMakeMessages.getFormattedString(BUILDER_NOTHING_TODO, + ManagedMakeMessages.getFormattedString(BUILDER_NOTHING_TODO, fDes.getConfiguration().getOwner().getName()), out); } @@ -174,7 +176,7 @@ public class DescriptionBuilder implements IBuildModelBuilder { if(status == STATUS_OK) clearRebuildStates(); - + return status; } @@ -193,7 +195,7 @@ public class DescriptionBuilder implements IBuildModelBuilder { } return fNumCommands; } - + protected StepBuilder getStepBuilder(IBuildStep step){ StepBuilder b = fStepToStepBuilderMap.get(step); if(b == null){ @@ -202,7 +204,7 @@ public class DescriptionBuilder implements IBuildModelBuilder { } return b; } - + protected void printMessage(String msg, OutputStream os){ if (os != null) { msg = ManagedMakeMessages.getFormattedString(BUILDER_MSG_HEADER, msg) + LINE_SEPARATOR; @@ -214,13 +216,13 @@ public class DescriptionBuilder implements IBuildModelBuilder { } } } - + private void initRebuildStates(){ if(fRebuildStateContainer == null) return; - + fRebuildStateContainer.setState(0); - + IBuildResource[] rcs = fDes.getResources(); putAll(fRebuildStateContainer, rcs, IRebuildState.NEED_REBUILD, true); } @@ -228,9 +230,9 @@ public class DescriptionBuilder implements IBuildModelBuilder { private void clearRebuildStates(){ if(fRebuildStateContainer == null) return; - + fRebuildStateContainer.setState(0); - + // IBuildResource[] rcs = fDes.getResources(); // putAll(fRebuildStateContainer, rcs, IRebuildState.NEED_REBUILD, true); } @@ -240,15 +242,15 @@ public class DescriptionBuilder implements IBuildModelBuilder { IBuildResource rc = rcs[i]; if(rebuildRcOnly && !rc.needsRebuild()) continue; - + if(!rc.isProjectResource()) continue; IPath fullPath = rc.getFullPath(); if(fullPath == null) continue; - + cbs.setStateForFullPath(fullPath, state); } } - + } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ProjectBuildState.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ProjectBuildState.java index 00f399b8f0c..937f164d0a0 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ProjectBuildState.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ProjectBuildState.java @@ -33,13 +33,13 @@ import org.eclipse.core.runtime.IPath; public class ProjectBuildState implements IProjectBuildState { private Properties fCfgIdToFileNameProps; private Map fCfgIdToStateMap = new HashMap(); - private IProject fProject; + private IProject fProject; private boolean fIsMapInfoDirty; - + public ProjectBuildState(IProject project){ fProject = project; } - + void setProject(IProject project){ fProject = project; Collection cbStates = fCfgIdToStateMap.values(); @@ -48,6 +48,7 @@ public class ProjectBuildState implements IProjectBuildState { } } + @Override public IConfigurationBuildState getConfigurationBuildState(String id, boolean create) { ConfigurationBuildState state = fCfgIdToStateMap.get(id); if(state == null){ @@ -59,7 +60,7 @@ public class ProjectBuildState implements IProjectBuildState { } return state; } - + private ConfigurationBuildState loadState(String id, boolean create){ File file = getFileForCfg(id, create); ConfigurationBuildState bs = new ConfigurationBuildState(fProject, id); @@ -77,6 +78,7 @@ public class ProjectBuildState implements IProjectBuildState { return bs; } + @Override public IConfigurationBuildState[] getConfigurationBuildStates() { Properties props = getIdToNameProperties(); List list = new ArrayList(props.size()); @@ -90,6 +92,7 @@ public class ProjectBuildState implements IProjectBuildState { return list.toArray(new ConfigurationBuildState[list.size()]); } + @Override public void removeConfigurationBuildState(String id) { ConfigurationBuildState cbs = (ConfigurationBuildState)getConfigurationBuildState(id, false); if(cbs != null){ @@ -97,17 +100,19 @@ public class ProjectBuildState implements IProjectBuildState { } } + @Override public int getState() { // TODO Auto-generated method stub return 0; } + @Override public void setState(int state) { // TODO Auto-generated method stub } private static final int OP_CREATE = 1; private static final int OP_REMOVE = 2; - + private String getFileName(String id, int op){ Properties props = getIdToNameProperties(); String name = props.getProperty(id); @@ -124,26 +129,26 @@ public class ProjectBuildState implements IProjectBuildState { } return name; } - + private File getFileForCfg(String id, boolean create){ String name = getFileName(id, create ? OP_CREATE : 0); if(name == null) return null; - + IPath path = BuildStateManager.getInstance().getPrefsDirPath(fProject); path = path.append(name); return path.toFile(); } - + private void saveMapFile(){ if(fCfgIdToFileNameProps == null) return; - + File file = getMapFile(); File parent = file.getParentFile(); if(!parent.exists()) parent.mkdirs(); - + try { OutputStream oStream = new FileOutputStream(file); fCfgIdToFileNameProps.store(oStream, ""); //$NON-NLS-1$ @@ -154,7 +159,7 @@ public class ProjectBuildState implements IProjectBuildState { ManagedBuilderCorePlugin.log(e); } } - + private File getMapFile(){ IPath path = BuildStateManager.getInstance().getPrefsDirPath(fProject); path = path.append(getProjFileName()); @@ -180,17 +185,18 @@ public class ProjectBuildState implements IProjectBuildState { } return fCfgIdToFileNameProps; } - + private String getProjFileName(){ return fProject.getName(); } + @Override public IProject getProject() { return fProject; } - + void serialize(){ - + Collection cbStates = fCfgIdToStateMap.values(); for (ConfigurationBuildState s : cbStates) { String id = s.getConfigurationId(); @@ -205,7 +211,7 @@ public class ProjectBuildState implements IProjectBuildState { File parent = file.getParentFile(); if(!parent.exists()) parent.mkdirs(); - + try { FileOutputStream oStream = new FileOutputStream(file); s.store(oStream); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/StepBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/StepBuilder.java index 968917bc730..d8a38cf341f 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/StepBuilder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/StepBuilder.java @@ -28,14 +28,14 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.SubProgressMonitor; /** - * + * * This class implements the IBuildStep building * To build the step, create an instance of this class * and invoke the build method * - * NOTE: This class is subject to change and discuss, + * NOTE: This class is subject to change and discuss, * and is currently available in experimental mode only - * + * */ public class StepBuilder implements IBuildModelBuilder { private IBuildStep fStep; @@ -45,7 +45,7 @@ public class StepBuilder implements IBuildModelBuilder { private int fNumCommands = -1; private CommandBuilder fCommandBuilders[]; private IResourceRebuildStateContainer fRebuildStateContainer; - + public StepBuilder(IBuildStep step, IResourceRebuildStateContainer rs){ this(step, null, rs); } @@ -59,19 +59,20 @@ public class StepBuilder implements IBuildModelBuilder { fCWD = cwd; fDirs = dirs; fResumeOnErrs = resumeOnErrs; - + if(fDirs == null) fDirs = new GenDirInfo(fStep.getBuildDescription().getConfiguration()); - + if(fCWD == null) fCWD = fStep.getBuildDescription().getDefaultBuildDirLocation(); - + fRebuildStateContainer = rs; } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.internal.builddescription.IBuildDescriptionBuilder#build(java.io.OutputStream, java.io.OutputStream, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public int build(OutputStream out, OutputStream err, IProgressMonitor monitor){ @@ -83,9 +84,9 @@ public class StepBuilder implements IBuildModelBuilder { if(bs.length > 0){ //TODO: monitor createOutDirs(new NullProgressMonitor()); - - for(int i = 0; - i < bs.length + + for(int i = 0; + i < bs.length && status != STATUS_CANCELLED && (fResumeOnErrs || status == STATUS_OK); i++){ @@ -111,7 +112,7 @@ public class StepBuilder implements IBuildModelBuilder { monitor.done(); return status; } - + protected int postProcess(int status, IProgressMonitor monitor){ if(status != STATUS_ERROR_LAUNCH){ refreshOutputs(monitor); @@ -129,23 +130,23 @@ public class StepBuilder implements IBuildModelBuilder { } return status; } - + private void clearRebuildState(){ if(fRebuildStateContainer == null) return; - + IBuildResource[] rcs = fStep.getOutputResources(); DescriptionBuilder.putAll(fRebuildStateContainer, rcs, 0, false); rcs = fStep.getInputResources(); DescriptionBuilder.putAll(fRebuildStateContainer, rcs, 0, false); } - + protected void refreshOutputs(IProgressMonitor monitor){ if(fStep == fStep.getBuildDescription().getInputStep()) return; - + IBuildResource rcs[] = fStep.getOutputResources(); - + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); for(int i = 0; i < rcs.length; i++){ IPath path = rcs[i].getFullPath(); @@ -156,18 +157,18 @@ public class StepBuilder implements IBuildModelBuilder { } catch (CoreException e) { if(DbgUtil.DEBUG){ DbgUtil.trace("failed to refresh resource " //$NON-NLS-1$ - + file.getFullPath() + + file.getFullPath() + ", error: " + e.getLocalizedMessage()); //$NON-NLS-1$ } } } } } - + protected void cleanOutputs(IProgressMonitor monitor){ if(fStep == fStep.getBuildDescription().getInputStep()) return; - + IBuildResource bRcs[] = fStep.getOutputResources(); for(int i = 0; i < bRcs.length; i++){ if(!bRcs[i].isProjectResource()) @@ -180,14 +181,14 @@ public class StepBuilder implements IBuildModelBuilder { } catch (CoreException e) { if(DbgUtil.DEBUG){ DbgUtil.trace("failed to delete resource " //$NON-NLS-1$ - + rc.getFullPath() + + rc.getFullPath() + ", error: " + e.getLocalizedMessage()); //$NON-NLS-1$ } } } } } - + protected void createOutDirs(IProgressMonitor monitor){ IBuildDescription des = fStep.getBuildDescription(); if(des != null && des.getInputStep() == fStep){ @@ -198,7 +199,7 @@ public class StepBuilder implements IBuildModelBuilder { } IBuildResource rcs[] = fStep.getOutputResources(); - + for(int i = 0; i < rcs.length; i++){ fDirs.createDir(rcs[i], monitor); } @@ -214,7 +215,7 @@ public class StepBuilder implements IBuildModelBuilder { } return fNumCommands; } - + protected CommandBuilder[] getCommandBuilders(){ if(fCommandBuilders == null){ IBuildCommand cmds[] = fStep.getCommands(fCWD, null, null, true); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperties.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperties.java index edd2cd967c7..3b174a0de75 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperties.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperties.java @@ -23,11 +23,11 @@ import org.eclipse.core.runtime.CoreException; public class BuildProperties implements IBuildProperties { private HashMap fPropertiesMap = new HashMap(); private ArrayList fInexistentProperties; - + public BuildProperties(){ - + } - + public BuildProperties(String properties){ StringTokenizer t = new StringTokenizer(properties, BuildPropertyManager.PROPERTIES_SEPARATOR); while(t.hasMoreTokens()){ @@ -38,15 +38,15 @@ public class BuildProperties implements IBuildProperties { } catch (CoreException e) { if(fInexistentProperties == null) fInexistentProperties = new ArrayList(); - + fInexistentProperties.add(property); } } - + if(fInexistentProperties != null) fInexistentProperties.trimToSize(); } - + @SuppressWarnings("unchecked") public BuildProperties(BuildProperties properties){ fPropertiesMap.putAll(properties.fPropertiesMap); @@ -54,18 +54,21 @@ public class BuildProperties implements IBuildProperties { fInexistentProperties = (ArrayList)properties.fInexistentProperties.clone(); } + @Override public IBuildProperty[] getProperties(){ return fPropertiesMap.values().toArray(new BuildProperty[fPropertiesMap.size()]); } - + + @Override public IBuildProperty getProperty(String id){ return fPropertiesMap.get(id); } - + void addProperty(IBuildProperty property){ fPropertiesMap.put(property.getPropertyType().getId(), property); } + @Override public IBuildProperty setProperty(String propertyId, String propertyValue) throws CoreException { return setProperty(propertyId, propertyValue, false); } @@ -73,30 +76,31 @@ public class BuildProperties implements IBuildProperties { public IBuildProperty setProperty(String propertyId, String propertyValue, boolean force) throws CoreException { try { IBuildProperty property = BuildPropertyManager.getInstance().createProperty(propertyId, propertyValue); - + addProperty(property); - + return property; } catch (CoreException e){ if(force){ if(fInexistentProperties == null) fInexistentProperties = new ArrayList(1); - + fInexistentProperties.add(BuildProperty.toString(propertyId, propertyValue)); fInexistentProperties.trimToSize(); } throw e; } } - + + @Override public IBuildProperty removeProperty(String id){ return fPropertiesMap.remove(id); } - + void removeProperty(BuildProperty property){ fPropertiesMap.remove(property.getPropertyType().getId()); } - + @Override public String toString(){ String props = toStringExistingProperties(); @@ -111,14 +115,14 @@ public class BuildProperties implements IBuildProperties { } return props; } - + public String toStringExistingProperties(){ - int size = fPropertiesMap.size(); + int size = fPropertiesMap.size(); if(size == 0) return ""; //$NON-NLS-1$ else if(size == 1) return fPropertiesMap.values().iterator().next().toString(); - + StringBuffer buf = new StringBuffer(); Iterator iter = fPropertiesMap.values().iterator(); buf.append(iter.next().toString()); @@ -134,10 +138,10 @@ public class BuildProperties implements IBuildProperties { public Object clone() { try { BuildProperties clone = (BuildProperties)super.clone(); - + if(fInexistentProperties != null) clone.fInexistentProperties = (ArrayList)fInexistentProperties.clone(); - + clone.fPropertiesMap = (HashMap)fPropertiesMap.clone(); /* for(Iterator iter = clone.fPropertiesMap.entrySet().iterator(); iter.hasNext();){ Map.Entry entry = (Map.Entry)iter.next(); @@ -151,11 +155,13 @@ public class BuildProperties implements IBuildProperties { return null; } + @Override public void clear() { fPropertiesMap.clear(); fInexistentProperties.clear(); } + @Override public boolean containsValue(String propertyId, String valueId) { IBuildProperty prop = getProperty(propertyId); if(prop != null){ @@ -163,7 +169,7 @@ public class BuildProperties implements IBuildProperties { } return false; } - - - + + + } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperty.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperty.java index c63d9eec9aa..a31c10b5cad 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperty.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildProperty.java @@ -34,7 +34,7 @@ public class BuildProperty implements IBuildProperty{ type = SafeStringInterner.safeIntern(property); value = null; } - + fType = BuildPropertyManager.getInstance().getPropertyType(type); if(fType == null){ throw new CoreException(new Status(IStatus.ERROR, @@ -43,19 +43,20 @@ public class BuildProperty implements IBuildProperty{ } setValue(value); } - + BuildProperty(IBuildPropertyType type, String valueId) throws CoreException { fType = type; setValue(valueId); } - + + @Override public IBuildPropertyType getPropertyType(){ return fType; } - + private void setValue(String id) throws CoreException { IBuildPropertyValue value = fType.getSupportedValue(id); - + if(value == null) throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), @@ -63,25 +64,26 @@ public class BuildProperty implements IBuildProperty{ setValue(value); } - + private void setValue(IBuildPropertyValue value){ fValue = value; } - + + @Override public IBuildPropertyValue getValue(){ return fValue; } - + @Override public String toString(){ return toString(fType.toString(), fValue.toString()); } - + public static String toString(String type, String value){ StringBuffer buf = new StringBuffer(); buf.append(type).append(BuildPropertyManager.PROPERTY_VALUE_SEPARATOR).append(value); return buf.toString(); - + } /* public Object clone() { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildPropertyManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildPropertyManager.java index fb4614d8861..407a0b6bd1d 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildPropertyManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildPropertyManager.java @@ -39,34 +39,35 @@ public class BuildPropertyManager implements IBuildPropertyManager{ static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$ private static BuildPropertyManager fInstance; - + private List fTypeCfgElements; private List fValueCfgElements; - + private BuildPropertyManager(){ loadExtensions(); } - + public static BuildPropertyManager getInstance(){ if(fInstance == null) fInstance = new BuildPropertyManager(); return fInstance; } - + public BuildProperties loadPropertiesFromString(String properties){ return new BuildProperties(properties); } - + public String savePropertiesToString(BuildProperties properties){ return properties.toString(); } private Map fPropertyTypeMap = new HashMap(); - + + @Override public IBuildPropertyType getPropertyType(String id){ return fPropertyTypeMap.get(id); } - + public IBuildPropertyType createPropertyType(String id, String name) throws CoreException{ IBuildPropertyType type = getPropertyType(id); if(type != null){ @@ -88,7 +89,7 @@ public class BuildPropertyManager implements IBuildPropertyManager{ IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), BuildPropertiesMessages.getString("BuildPropertyManager.9"))); //$NON-NLS-1$ - + return createPropertyValue(type, id, name); } @@ -103,14 +104,15 @@ public class BuildPropertyManager implements IBuildPropertyManager{ value = new BuildPropertyValue(id, name); ((BuildPropertyType)type).addSupportedValue(value); } - + return value; } - + + @Override public IBuildPropertyType[] getPropertyTypes(){ return fPropertyTypeMap.values().toArray(new BuildPropertyType[fPropertyTypeMap.size()]); } - + public IBuildProperty createProperty(String id, String value) throws CoreException { IBuildPropertyType type = getPropertyType(id); if(type == null) @@ -118,11 +120,11 @@ public class BuildPropertyManager implements IBuildPropertyManager{ IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), BuildPropertiesMessages.getString("BuildPropertyManager.11"))); //$NON-NLS-1$ - + BuildProperty property = new BuildProperty(type, value); return property; } - + private boolean addConfigElement(IConfigurationElement el){ if(ELEMENT_PROPERTY_TYPE.equals(el.getName())){ getTypeElList(true).add(el); @@ -133,7 +135,7 @@ public class BuildPropertyManager implements IBuildPropertyManager{ } return false; } - + private List getTypeElList(boolean create){ if(fTypeCfgElements == null && create) fTypeCfgElements = new ArrayList(); @@ -145,7 +147,7 @@ public class BuildPropertyManager implements IBuildPropertyManager{ fValueCfgElements = new ArrayList(); return fValueCfgElements; } - + private void loadExtensions(){ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PROPERTIES_EXT_POINT_ID); if( extensionPoint != null) { @@ -157,11 +159,11 @@ public class BuildPropertyManager implements IBuildPropertyManager{ addConfigElement(els[k]); } } - + resolveConfigElements(); } } - + private void resolveConfigElements(){ List typeEls = getTypeElList(false); @@ -185,7 +187,7 @@ public class BuildPropertyManager implements IBuildPropertyManager{ } } - + private IBuildPropertyType createPropertyType(IConfigurationElement el) throws CoreException{ String id = el.getAttribute(ATTRIBUTE_ID); if(id == null) @@ -200,7 +202,7 @@ public class BuildPropertyManager implements IBuildPropertyManager{ return createPropertyType(id, name); } - + private IBuildPropertyValue createPropertyValue(IConfigurationElement el) throws CoreException{ String id = el.getAttribute(ATTRIBUTE_ID); if(id == null) @@ -218,7 +220,7 @@ public class BuildPropertyManager implements IBuildPropertyManager{ ManagedBuilderCorePlugin.getUniqueIdentifier(), BuildPropertiesMessages.getString("BuildPropertyManager.16"))); //$NON-NLS-1$ - + return createPropertyValue(property, id, name); } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildPropertyType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildPropertyType.java index be74a9b46f8..421b24623b2 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildPropertyType.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildproperties/BuildPropertyType.java @@ -19,7 +19,7 @@ import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue; public class BuildPropertyType extends PropertyBase implements IBuildPropertyType{ private Map fValuesMap = new HashMap(); - + BuildPropertyType(String id, String name){ super(id, name); } @@ -27,11 +27,13 @@ public class BuildPropertyType extends PropertyBase implements IBuildPropertyTyp void addSupportedValue(BuildPropertyValue value){ fValuesMap.put(value.getId(), value); } - + + @Override public IBuildPropertyValue[] getSupportedValues(){ return fValuesMap.values().toArray(new BuildPropertyValue[fValuesMap.size()]); } - + + @Override public IBuildPropertyValue getSupportedValue(String id){ return fValuesMap.get(id); } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java index 15fe5197395..b0ba81b5e2c 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/AdditionalInput.java @@ -37,11 +37,11 @@ public class AdditionalInput implements IAdditionalInput { /* * C O N S T R U C T O R S */ - + /** - * This constructor is called to create an AdditionalInput defined by an extension point in + * This constructor is called to create an AdditionalInput defined by an extension point in * a plugin manifest file, or returned by a dynamic element provider - * + * * @param parent The IInputType parent of this AdditionalInput * @param element The AdditionalInput definition from the manifest file or a dynamic element * provider @@ -49,7 +49,7 @@ public class AdditionalInput implements IAdditionalInput { public AdditionalInput(IInputType parent, IManagedConfigElement element) { this.fParent = parent; fIsExtensionAdditionalInput = true; - + // setup for resolving fResolved = false; @@ -57,9 +57,9 @@ public class AdditionalInput implements IAdditionalInput { } /** - * This constructor is called to create an AdditionalInput whose attributes and children will be + * This constructor is called to create an AdditionalInput whose attributes and children will be * added by separate calls. - * + * * @param parent The parent of the an AdditionalInput * @param isExtensionElement Indicates whether this is an extension element or a managed project element */ @@ -73,30 +73,30 @@ public class AdditionalInput implements IAdditionalInput { } /** - * Create an AdditionalInput based on the specification stored in the + * Create an AdditionalInput based on the specification stored in the * project file (.cdtbuild). - * - * @param parent The ITool the AdditionalInput will be added to. + * + * @param parent The ITool the AdditionalInput will be added to. * @param element The XML element that contains the AdditionalInput settings. */ public AdditionalInput(IInputType parent, ICStorageElement element) { this.fParent = parent; fIsExtensionAdditionalInput = false; - + // Initialize from the XML attributes loadFromProject(element); } /** * Create an AdditionalInput based upon an existing AdditionalInput. - * + * * @param parent The IInputType the AdditionalInput will be added to. * @param additionalInput The existing AdditionalInput to clone. */ public AdditionalInput(IInputType parent, AdditionalInput additionalInput) { this.fParent = parent; fIsExtensionAdditionalInput = false; - + // Copy the remaining attributes if (additionalInput.fPaths != null) { fPaths = new String(additionalInput.fPaths); @@ -105,7 +105,7 @@ public class AdditionalInput implements IAdditionalInput { if (additionalInput.fKind != null) { fKind = new Integer(additionalInput.fKind.intValue()); } - + setDirty(true); setRebuildState(true); } @@ -113,12 +113,12 @@ public class AdditionalInput implements IAdditionalInput { /* * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S */ - + /* (non-Javadoc) - * Loads the AdditionalInput information from the ManagedConfigElement specified in the + * Loads the AdditionalInput information from the ManagedConfigElement specified in the * argument. - * - * @param element Contains the AdditionalInput information + * + * @param element Contains the AdditionalInput information */ protected void loadFromManifest(IManagedConfigElement element) { @@ -135,20 +135,20 @@ public class AdditionalInput implements IAdditionalInput { fKind = new Integer(KIND_ADDITIONAL_DEPENDENCY); } } - + /* (non-Javadoc) - * Initialize the AdditionalInput information from the XML element + * Initialize the AdditionalInput information from the XML element * specified in the argument - * - * @param element An XML element containing the AdditionalInput information + * + * @param element An XML element containing the AdditionalInput information */ protected void loadFromProject(ICStorageElement element) { - + // path if (element.getAttribute(IAdditionalInput.PATHS) != null) { fPaths = SafeStringInterner.safeIntern(element.getAttribute(IAdditionalInput.PATHS)); } - + // kind if (element.getAttribute(IAdditionalInput.KIND) != null) { String kindStr = element.getAttribute(IAdditionalInput.KIND); @@ -184,12 +184,12 @@ public class AdditionalInput implements IAdditionalInput { str = ADDITIONAL_INPUT_DEPENDENCY; break; default: - str = EMPTY_STRING; + str = EMPTY_STRING; break; } element.setAttribute(IAdditionalInput.KIND, str); } - + // I am clean now fIsDirty = false; } @@ -201,6 +201,7 @@ public class AdditionalInput implements IAdditionalInput { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IAdditionalInput#getParent() */ + @Override public IInputType getParent() { return fParent; } @@ -212,6 +213,7 @@ public class AdditionalInput implements IAdditionalInput { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IAdditionalInput#getPaths() */ + @Override public String[] getPaths() { if (fPaths == null) { return null; @@ -223,6 +225,7 @@ public class AdditionalInput implements IAdditionalInput { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IAdditionalInput#setPaths() */ + @Override public void setPaths(String newPaths) { if (fPaths == null && newPaths == null) return; if (fPaths == null || newPaths == null || !(fPaths.equals(newPaths))) { @@ -235,6 +238,7 @@ public class AdditionalInput implements IAdditionalInput { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IAdditionalInput#getKind() */ + @Override public int getKind() { if (fKind == null) { return KIND_ADDITIONAL_INPUT_DEPENDENCY; @@ -245,6 +249,7 @@ public class AdditionalInput implements IAdditionalInput { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IAdditionalInput#setKind() */ + @Override public void setKind(int newKind) { if (fKind == null || !(fKind.intValue() == newKind)) { fKind = new Integer(newKind); @@ -256,7 +261,7 @@ public class AdditionalInput implements IAdditionalInput { /* * O B J E C T S T A T E M A I N T E N A N C E */ - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IAdditionalInput#isExtensionElement() */ @@ -267,6 +272,7 @@ public class AdditionalInput implements IAdditionalInput { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IAdditionalInput#isDirty() */ + @Override public boolean isDirty() { // This shouldn't be called for an extension AdditionalInput if (fIsExtensionAdditionalInput) return false; @@ -276,10 +282,11 @@ public class AdditionalInput implements IAdditionalInput { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IAdditionalInput#setDirty(boolean) */ + @Override public void setDirty(boolean isDirty) { this.fIsDirty = isDirty; } - + /* (non-Javadoc) * Resolve the element IDs to interface references */ @@ -288,11 +295,11 @@ public class AdditionalInput implements IAdditionalInput { fResolved = true; } } - + public boolean needsRebuild(){ return fRebuildState; } - + public void setRebuildState(boolean rebuild){ if(isExtensionElement() && rebuild) return; diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BooleanExpressionApplicabilityCalculator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BooleanExpressionApplicabilityCalculator.java index 5e48a85cd92..6cba2dd6986 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BooleanExpressionApplicabilityCalculator.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BooleanExpressionApplicabilityCalculator.java @@ -38,28 +38,29 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab private OptionEnablementExpression fExpressions[]; private Map> fRefPropsMap; - + public BooleanExpressionApplicabilityCalculator(IManagedConfigElement optionElement){ this(optionElement.getChildren(OptionEnablementExpression.NAME)); } public BooleanExpressionApplicabilityCalculator(IManagedConfigElement enablementElements[]){ fExpressions = new OptionEnablementExpression[enablementElements.length]; - + for(int i = 0; i < enablementElements.length; i++){ fExpressions[i] = new OptionEnablementExpression(enablementElements[i]); } } - - public boolean isOptionVisible(IBuildObject configuration, - IHoldsOptions holder, + + @Override + public boolean isOptionVisible(IBuildObject configuration, + IHoldsOptions holder, IOption option){ IResourceInfo rcInfo = rcInfoFromConfiguration(configuration); if(rcInfo != null) return evaluate(rcInfo, holder, option, OptionEnablementExpression.FLAG_UI_VISIBILITY); return true; } - + public static IResourceInfo rcInfoFromConfiguration(IBuildObject configuration){ if(configuration instanceof IFolderInfo) return (IFolderInfo)configuration; @@ -69,7 +70,7 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab return ((IConfiguration)configuration).getRootFolderInfo(); return null; } - + public boolean isInputTypeEnabled(ITool tool, IInputType type){ return evaluate(tool.getParentResourceInfo(), tool, null, OptionEnablementExpression.FLAG_CMD_USAGE); } @@ -82,9 +83,10 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab ITool tool){ return evaluate(rcInfo, tool, null, OptionEnablementExpression.FLAG_CMD_USAGE); } - - public boolean isOptionEnabled(IBuildObject configuration, - IHoldsOptions holder, + + @Override + public boolean isOptionEnabled(IBuildObject configuration, + IHoldsOptions holder, IOption option){ IResourceInfo rcInfo = rcInfoFromConfiguration(configuration); if(rcInfo != null) @@ -92,8 +94,9 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab return true; } - public boolean isOptionUsedInCommandLine(IBuildObject configuration, - IHoldsOptions holder, + @Override + public boolean isOptionUsedInCommandLine(IBuildObject configuration, + IHoldsOptions holder, IOption option){ IResourceInfo rcInfo = rcInfoFromConfiguration(configuration); if(rcInfo != null) @@ -109,7 +112,7 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab } return true; } - + /* public boolean performAdjustment(IBuildObject configuration, IHoldsOptions holder, IOption option, boolean extensionAdjustment){ boolean adjusted = false; @@ -119,9 +122,9 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab } return adjusted; } -*/ - public boolean adjustOption(IResourceInfo rcInfo, - IHoldsOptions holder, +*/ + public boolean adjustOption(IResourceInfo rcInfo, + IHoldsOptions holder, IOption option, boolean extensionAdjustment){ boolean adjusted = false; @@ -130,7 +133,7 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab if(fExpressions[i].adjustOption(rcInfo, holder, option, context, extensionAdjustment)) adjusted = true; } - + if(context != null){ String unadjusted[] = context.getUnadjusted(); for(int i = 0; i < unadjusted.length; i++){ @@ -140,7 +143,7 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab return adjusted; } - public boolean adjustToolChain(IFolderInfo info, + public boolean adjustToolChain(IFolderInfo info, IToolChain tChain, boolean extensionAdjustment){ boolean adjusted = false; @@ -149,7 +152,7 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab if(fExpressions[i].adjustToolChain(info, tChain, context, extensionAdjustment)) adjusted = true; } - + if(context != null){ String unadjusted[] = context.getUnadjusted(); for(int i = 0; i < unadjusted.length; i++){ @@ -160,7 +163,7 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab return adjusted; } - public boolean adjustTool(IResourceInfo info, + public boolean adjustTool(IResourceInfo info, ITool tool, boolean extensionAdjustment){ boolean adjusted = false; @@ -195,14 +198,14 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab OptionEnablementExpression.adjustConfiguration(cfg, unadjusted[i], null, extensionAdjustment); } } - + return adjusted; } - + private Map> getReferencedProperties(){ if(fRefPropsMap == null){ fRefPropsMap = new HashMap>(); - + for(int i = 0; i < fExpressions.length; i++){ fExpressions[i].getReferencedProperties(fRefPropsMap); } @@ -212,7 +215,7 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab public boolean referesProperty(String id){ Map> map = getReferencedProperties(); - + return map.containsKey(id); } @@ -223,7 +226,7 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab return set.contains(valueId); return false; } - + public String[] getReferencedPropertyIds(){ Map> map = getReferencedProperties(); return map.keySet().toArray(new String[map.size()]); @@ -235,11 +238,12 @@ public class BooleanExpressionApplicabilityCalculator implements IOptionApplicab return set.toArray(new String[set.size()]); } + @Override public boolean isOptionCategoryVisible(IBuildObject configuration, IHoldsOptions optHolder, IOptionCategory category) { return evaluateCategory(rcInfoFromConfiguration(configuration), optHolder, category); } - + private boolean evaluateCategory(IResourceInfo rcInfo, IHoldsOptions holder, IOptionCategory category) { for(int i = 0; i < fExpressions.length; i++){ if(!fExpressions[i].evaluate(rcInfo, holder, category)) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java index 40de8e7fc85..e309fb22ffa 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObject.java @@ -20,13 +20,14 @@ public class BuildObject implements IBuildObject { protected String id; protected String name; private String baseId=null; - + protected Version version = null; protected String managedBuildRevision = null; - + /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IBuildObject#getId() */ + @Override public String getId() { return id; } @@ -41,10 +42,11 @@ public class BuildObject implements IBuildObject { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IBuildObject#getName() */ + @Override public String getName() { return name; } - + /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IBuildObject#setName(java.lang.String) */ @@ -59,17 +61,19 @@ public class BuildObject implements IBuildObject { public String toString() { return name; } - + /** * @return Returns the managedBuildRevision. */ + @Override public String getManagedBuildRevision() { return managedBuildRevision; } - + /** * @return Returns the version. */ + @Override public Version getVersion() { return version; } @@ -77,28 +81,30 @@ public class BuildObject implements IBuildObject { /** * @param version The version to set. */ + @Override public void setVersion(Version version) { this.version = version; } /** - * @return id of the object this class was based on. Note that this function + * @return id of the object this class was based on. Note that this function * assumes that id was generated by {@link ManagedBuildManager#calculateChildId(String, String)}. */ + @Override public String getBaseId() { if (baseId==null) baseId = ManagedBuildManager.calculateBaseId(id); return baseId; } - + public Version getVersionFromId() { String versionNumber = ManagedBuildManager.getVersionFromIdAndVersion( getId()); - + if( versionNumber == null) { // It means, Tool Integrator either not provided version information in 'id' or provided in wrong format, // So get the default version based on 'managedBuildRevision' attribute. - + if ( getManagedBuildRevision() != null) { Version tmpManagedBuildRevision = new Version( getManagedBuildRevision() ); if (tmpManagedBuildRevision.equals(new Version("1.2.0")) ) //$NON-NLS-1$ @@ -119,7 +125,7 @@ public class BuildObject implements IBuildObject { public void setManagedBuildRevision(String managedBuildRevision) { this.managedBuildRevision = managedBuildRevision; } - + /* * updates revision for this build object and all its children */ diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObjectProperties.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObjectProperties.java index d1cbb249806..b53a5dbf046 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObjectProperties.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/BuildObjectProperties.java @@ -26,13 +26,13 @@ public class BuildObjectProperties extends BuildProperties implements IBuildObjectProperties { private IBuildPropertiesRestriction fRestriction; private IBuildPropertyChangeListener fListener; - + public BuildObjectProperties(IBuildPropertiesRestriction restriction, IBuildPropertyChangeListener listener) { super(); fRestriction = restriction; fListener = listener; } - + public BuildObjectProperties(BuildObjectProperties properties, IBuildPropertiesRestriction restriction, IBuildPropertyChangeListener listener) { super(properties); fRestriction = restriction; @@ -45,22 +45,24 @@ public class BuildObjectProperties extends BuildProperties implements fListener = listener; } + @Override public IBuildPropertyType[] getSupportedTypes() { IBuildPropertyType types[] = BuildPropertyManager.getInstance().getPropertyTypes(); - + if(fRestriction != null && types.length != 0){ List list = new ArrayList(types.length); for (IBuildPropertyType type : types) { if(fRestriction.supportsType(type.getId())) list.add(type); } - + types = list.toArray(new IBuildPropertyType[list.size()]); } return types; } + @Override public IBuildPropertyValue[] getSupportedValues(String typeId) { IBuildPropertyType type = BuildPropertyManager.getInstance().getPropertyType(typeId); if(type != null){ @@ -71,13 +73,14 @@ public class BuildObjectProperties extends BuildProperties implements if(fRestriction.supportsValue(type.getId(), value.getId())) list.add(value); } - + return list.toArray(new IBuildPropertyValue[list.size()]); } } return new IBuildPropertyValue[0]; } + @Override public boolean supportsType(String id) { return fRestriction.supportsType(id); // IBuildPropertyType type = BuildPropertyManager.getInstance().getPropertyType(id); @@ -90,6 +93,7 @@ public class BuildObjectProperties extends BuildProperties implements // return false; } + @Override public boolean supportsValue(String typeId, String valueId) { return fRestriction.supportsValue(typeId, valueId); // IBuildPropertyType type = BuildPropertyManager.getInstance().getPropertyType(typeId); @@ -118,7 +122,7 @@ public class BuildObjectProperties extends BuildProperties implements fListener.propertiesChanged(); return property; } - + IBuildProperty internalSetProperty(String propertyId, String propertyValue) throws CoreException{ return super.setProperty(propertyId, propertyValue); } @@ -134,24 +138,28 @@ public class BuildObjectProperties extends BuildProperties implements // throw new CoreException(new Status(IStatus.ERROR, // ManagedBuilderCorePlugin.getUniqueIdentifier(), // "property value is not supported")); - + IBuildProperty property = super.setProperty(propertyId, propertyValue); fListener.propertiesChanged(); return property; } + @Override public String[] getRequiredTypeIds() { return fRestriction.getRequiredTypeIds(); } + @Override public boolean requiresType(String typeId) { return fRestriction.requiresType(typeId); } + @Override public String[] getSupportedTypeIds() { return fRestriction.getSupportedTypeIds(); } + @Override public String[] getSupportedValueIds(String typeId) { return fRestriction.getSupportedValueIds(typeId); } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java index 3167b768e3e..e1f9d58adae 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java @@ -253,6 +253,7 @@ public class CommonBuilder extends ACBuilder { return fullBuildNeeded; } + @Override public boolean visit(IResourceDelta delta) throws CoreException { IResource resource = delta.getResource(); // If the project has changed, then a build is needed and we can stop @@ -345,6 +346,7 @@ public class CommonBuilder extends ACBuilder { } + @Override public boolean visit(IResourceDelta delta) throws CoreException { IResource rc = delta.getResource(); @@ -1111,6 +1113,7 @@ public class CommonBuilder extends ACBuilder { try { ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { bInfo.fBuilder.getBuildRunner().invokeBuild( CLEAN_BUILD, diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationNameProvider.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationNameProvider.java index 1bfc6f3e599..7770586b566 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationNameProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationNameProvider.java @@ -17,20 +17,21 @@ import org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider; public class ConfigurationNameProvider implements IConfigurationNameProvider { private static ConfigurationNameProvider configurationNameProvider; - + protected ConfigurationNameProvider() { configurationNameProvider = null; } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider#getUniqueConfigurationName(org.eclipse.cdt.managedbuilder.core.IConfiguration, java.lang.String[]) */ + @Override public String getNewConfigurationName(IConfiguration configuration, String[] usedConfigurationNames) { // TODO Auto-generated method stub return null; } - + public static ConfigurationNameProvider getConfigurationNameProvider() { if( configurationNameProvider == null) configurationNameProvider = new ConfigurationNameProvider(); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationV2.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationV2.java index 2aec567e76c..f65adbc4e37 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationV2.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ConfigurationV2.java @@ -49,23 +49,23 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /** * Build a configuration from the project manifest file. - * - * @param target The Target the configuration belongs to. + * + * @param target The Target the configuration belongs to. * @param element The element from the manifest that contains the overridden configuration information. */ public ConfigurationV2(Target target, Element element) { this.target = target; - + // id setId(element.getAttribute(IConfigurationV2.ID)); - + // hook me up target.addConfiguration(this); - + // name if (element.hasAttribute(IConfigurationV2.NAME)) setName(element.getAttribute(IConfigurationV2.NAME)); - + if (element.hasAttribute(IConfigurationV2.PARENT)) { // See if the target has a parent ITarget targetParent = target.getParent(); @@ -77,7 +77,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { parent = null; } } - + NodeList configElements = element.getChildNodes(); for (int i = 0; i < configElements.getLength(); ++i) { Node configElement = configElements.item(i); @@ -85,12 +85,12 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { new ToolReference(this, (Element)configElement); } } - + } /** * Create a new configuration based on one already defined. - * + * * @param target The Target the receiver will be added to. * @param parentConfig The IConfigurationV2 to copy the settings from. * @param id A unique ID for the configuration. @@ -100,15 +100,15 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { this.name = parentConfig.getName(); this.target = target; - // If this contructor is called to clone an existing - // configuration, the parent of the parent should be stored. + // If this contructor is called to clone an existing + // configuration, the parent of the parent should be stored. // As of 2.0, there is still one single level of inheritence to // worry about parent = parentConfig.getParent() == null ? parentConfig : parentConfig.getParent(); - + // Check that the tool and the project match IProject project = (IProject) target.getOwner(); - + // Get the tool references from the target and parent List allToolRefs = new Vector(target.getLocalToolReferences()); allToolRefs.addAll(((ConfigurationV2)parentConfig).getLocalToolReferences()); @@ -116,13 +116,13 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { // Make a new ToolReference based on the tool in the ref ITool parentTool = toolRef.getTool(); ToolReference newRef = new ToolReference(this, parentTool); - + // The reference may have a different command than the parent tool - String refCmd = toolRef.getToolCommand(); + String refCmd = toolRef.getToolCommand(); if (!refCmd.equals(parentTool.getToolCommand())) { newRef.setToolCommand(refCmd); } - + List optRefs = toolRef.getOptionReferenceList(); for (OptionReference optRef : optRefs) { IOption opt = optRef.getOption(); @@ -158,29 +158,29 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { } } } - + target.addConfiguration(this); } /** * Create a new ConfigurationV2 based on the specification in the plugin manifest. - * + * * @param target The Target the receiver will be added to. * @param element The element from the manifest that contains the default configuration settings. */ public ConfigurationV2(Target target, IManagedConfigElement element) { this.target = target; - + // setup for resolving ManagedBuildManager.putConfigElement(this, element); resolved = false; - + // id setId(element.getAttribute(IConfigurationV2.ID)); - + // hook me up target.addConfiguration(this); - + // name setName(element.getAttribute(IConfigurationV2.NAME)); @@ -192,14 +192,14 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { } } } - + /** * A fresh new configuration for a target. - */ + */ public ConfigurationV2(Target target, String id) { this.id = id; this.target = target; - + target.addConfiguration(this); } @@ -213,24 +213,25 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { } } } - + /** * Adds a tool reference to the receiver. */ public void addToolReference(ToolReference toolRef) { getLocalToolReferences().add(toolRef); } - + /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getToolReferences() */ + @Override public IToolReference[] getToolReferences() { List list = getLocalToolReferences(); IToolReference[] tools = new IToolReference[list.size()]; list.toArray(tools); return tools; } - + /* (non-Javadoc) * @param option * @return @@ -243,12 +244,12 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { // The option reference belongs to an existing tool reference OptionReference optionRef = (OptionReference)option; searchRef = optionRef.getToolReference(); - + // That tool reference may belong to a target or to the configuration if (searchRef.ownedByConfiguration(this)) return optionRef; else { - // All this means is that the tool ref does not belong to the receiver. + // All this means is that the tool ref does not belong to the receiver. // The receiver may also have a reference to the tool if ((answer = findLocalReference(searchRef)) == null) { // Otherwise, create one and save the option setting in it @@ -286,13 +287,14 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { return ref; } } - + return null; } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#getFilteredTools(org.eclipse.core.resources.IProject) */ + @Override public ITool[] getFilteredTools(IProject project) { ITool[] localTools = getTools(); Vector tools = new Vector(localTools.length); @@ -320,15 +322,15 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { continue; } } - + // Answer the filtered tools as an array return tools.toArray(new ITool[tools.size()]); } /* (non-javadoc) - * A safety method to avoid NPEs. It answers the tool reference list in the + * A safety method to avoid NPEs. It answers the tool reference list in the * receiver. It does not look at the tool references defined in the parent. - * + * * @return List */ protected List getLocalToolReferences() { @@ -349,16 +351,17 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getTools() */ + @Override public ITool[] getTools() { ITool[] tools = parent != null ? parent.getTools() : target.getTools(); - + // Validate that the tools correspond to the nature IProject project = (IProject)target.getOwner(); if (project != null) { List validTools = new ArrayList(); - + // The target is associated with a real project for (int i = 0; i < tools.length; ++i) { ITool tool = tools[i]; @@ -385,66 +388,69 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { case ITool.FILTER_BOTH: validTools.add(tool); break; - } + } } // Now put the valid tools back into the array - tools = validTools.toArray(new ITool[validTools.size()]); + tools = validTools.toArray(new ITool[validTools.size()]); } - + // Replace tools with local overrides for (int i = 0; i < tools.length; ++i) { IToolReference ref = getToolReference(tools[i]); if (ref != null) tools[i] = ref; } - + return tools; } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#isDirty() */ + @Override public boolean isDirty() { // If I need saving, just say yes if (isDirty) return true; - + // Otherwise see if any tool references need saving List localToolReferences = getLocalToolReferences(); for (IToolReference ref : localToolReferences) { if (ref.isDirty()) return true; } - + return isDirty; } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#needsRebuild() */ + @Override public boolean needsRebuild() { return rebuildNeeded; } - + /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getParent() */ + @Override public IConfigurationV2 getParent() { return parent; } - + /* (non-javadoc) - * + * * @param tool * @return List */ protected List getOptionReferences(ITool tool) { List references = new ArrayList(); - + // Get all the option references I add for this tool IToolReference toolRef = getToolReference(tool); if (toolRef != null) { references.addAll(toolRef.getOptionReferenceList()); } - + // See if there is anything that my parents add that I don't if (parent != null) { List temp = ((ConfigurationV2)parent).getOptionReferences(tool); @@ -454,13 +460,14 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { } } } - + return references; } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#getToolById(java.lang.String) */ + @Override public ITool getToolById(String id) { ITool[] tools = parent != null ? parent.getTools() @@ -486,6 +493,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getTarget() */ + @Override public ITarget getTarget() { return (target == null && parent != null) ? parent.getTarget() : target; } @@ -493,6 +501,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#getOwner() */ + @Override public IResource getOwner() { return getTarget().getOwner(); } @@ -500,7 +509,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * Returns the reference for a given tool or null if one is not * found. - * + * * @param tool * @return ToolReference */ @@ -515,7 +524,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { return temp; } } - + // See if the target that the receiver belongs to has a reference to the tool ITool[] targetTools = target.getTools(); for (int index = targetTools.length - 1; index >= 0; --index) { @@ -528,7 +537,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { } return null; } - + public void reset(IManagedConfigElement element) { // I just need to reset the tool references getLocalToolReferences().clear(); @@ -548,13 +557,13 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { */ public void serialize(Document doc, Element element) { element.setAttribute(IConfigurationV2.ID, id); - + if (name != null) element.setAttribute(IConfigurationV2.NAME, name); - + if (parent != null) element.setAttribute(IConfigurationV2.PARENT, parent.getId()); - + // Serialize only the tool references defined in the configuration List localToolReferences = getLocalToolReferences(); for (IToolReference toolRef : localToolReferences) { @@ -562,14 +571,15 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { element.appendChild(toolRefElement); ((ToolReference)toolRef).serialize(doc, toolRefElement); } - + // I am clean now isDirty = false; } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setDirty(boolean) */ + @Override public void setDirty(boolean isDirty) { // Override the dirty flag this.isDirty = isDirty; @@ -583,6 +593,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean) */ + @Override public void setOption(IOption option, boolean value) throws BuildException { // Is there a delta if (option.getBooleanValue() != value) { @@ -595,6 +606,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String) */ + @Override public void setOption(IOption option, String value) throws BuildException { String oldValue; // Check whether this is an enumerated option @@ -602,7 +614,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { oldValue = option.getSelectedEnum(); } else { - oldValue = option.getStringValue(); + oldValue = option.getStringValue(); } if (oldValue != null && !oldValue.equals(value)) { createOptionReference(option).setValue(value); @@ -614,6 +626,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * @see org.eclipse.cdt.core.build.managed.IConfigurationV2#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[]) */ + @Override public void setOption(IOption option, String[] value) throws BuildException { // Is there a delta String[] oldValue; @@ -641,12 +654,13 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { createOptionReference(option).setValue(value); isDirty = true; rebuildNeeded = true; - } + } } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setRebuildState(boolean) */ + @Override public void setRebuildState(boolean rebuild) { rebuildNeeded = rebuild; } @@ -654,6 +668,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setToolCommand(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String) */ + @Override public void setToolCommand(ITool tool, String command) { // Make sure the command is different if (command != null) { @@ -672,6 +687,7 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#setCreatedConfig(IConfiguration) */ + @Override public void setCreatedConfig(IConfiguration config) { createdConfig = config; } @@ -679,8 +695,9 @@ public class ConfigurationV2 extends BuildObject implements IConfigurationV2 { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationV2#getCreatedConfig() */ + @Override public IConfiguration getCreatedConfig() { return createdConfig; } - + } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/DefaultManagedConfigElement.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/DefaultManagedConfigElement.java index f74796caa82..85ef181e3df 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/DefaultManagedConfigElement.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/DefaultManagedConfigElement.java @@ -23,15 +23,16 @@ public class DefaultManagedConfigElement implements IManagedConfigElement { private IConfigurationElement element; private IExtension extension; - + public DefaultManagedConfigElement(IConfigurationElement element, IExtension extension) { this.element = element; this.extension = extension; } - + /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getName() */ + @Override public String getName() { return element.getName(); } @@ -39,6 +40,7 @@ public class DefaultManagedConfigElement implements IManagedConfigElement { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getAttribute(java.lang.String) */ + @Override public String getAttribute(String name) { return element.getAttribute(name); } @@ -46,6 +48,7 @@ public class DefaultManagedConfigElement implements IManagedConfigElement { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren() */ + @Override public IManagedConfigElement[] getChildren() { return convertArray(element.getChildren(), extension); } @@ -53,6 +56,7 @@ public class DefaultManagedConfigElement implements IManagedConfigElement { /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IManagedConfigElement#getChildren(java.lang.String) */ + @Override public IManagedConfigElement[] getChildren(String elementName) { return convertArray(element.getChildren(elementName), extension); } @@ -63,11 +67,11 @@ public class DefaultManagedConfigElement implements IManagedConfigElement { public IExtension getExtension() { return extension; } - + public IConfigurationElement getConfigurationElement() { return element; } - + /** * Convenience method for converting an array of IConfigurationElements * into an array of IManagedConfigElements. diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/EnvVarBuildPath.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/EnvVarBuildPath.java index 298ce39ee0e..2aaa38572d1 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/EnvVarBuildPath.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/EnvVarBuildPath.java @@ -22,7 +22,7 @@ import org.eclipse.core.runtime.IConfigurationElement; public class EnvVarBuildPath implements IEnvVarBuildPath { - + private int fType; private String fVariableNames[]; private String fPathDelimiter; @@ -32,41 +32,42 @@ public class EnvVarBuildPath implements /** * Constructor to create an EnvVarBuildPath based on an element from the plugin - * manifest. - * + * manifest. + * * @param element The element containing the information about the tool. */ public EnvVarBuildPath(ITool tool, IManagedConfigElement element) { loadFromManifest(element); } - + /* (non-Javadoc) - * Load the EnvVarBuildPath information from the XML element specified in the + * Load the EnvVarBuildPath information from the XML element specified in the * argument - * @param element An XML element containing the tool information + * @param element An XML element containing the tool information */ protected void loadFromManifest(IManagedConfigElement element) { - + setType(convertPathTypeToInt(element.getAttribute(TYPE))); - + setVariableNames(SafeStringInterner.safeIntern(element.getAttribute(LIST))); - + setPathDelimiter(SafeStringInterner.safeIntern(element.getAttribute(PATH_DELIMITER))); - - // Store the configuration element IFF there is a build path resolver defined - String buildPathResolver = element.getAttribute(BUILD_PATH_RESOLVER); + + // Store the configuration element IFF there is a build path resolver defined + String buildPathResolver = element.getAttribute(BUILD_PATH_RESOLVER); if (buildPathResolver != null && element instanceof DefaultManagedConfigElement) { - fBuildPathResolverElement = ((DefaultManagedConfigElement)element).getConfigurationElement(); + fBuildPathResolverElement = ((DefaultManagedConfigElement)element).getConfigurationElement(); } } /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath#getType() */ + @Override public int getType() { return fType; } - + public void setType(int type){ this.fType = type; } @@ -74,10 +75,11 @@ public class EnvVarBuildPath implements /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath#getVariableNames() */ + @Override public String[] getVariableNames() { return fVariableNames; } - + public void setVariableNames(String names[]){ fVariableNames = names; fVariableNames = SafeStringInterner.safeIntern(fVariableNames); @@ -86,7 +88,7 @@ public class EnvVarBuildPath implements public void setVariableNames(String names){ setVariableNames(getNamesFromString(names)); } - + public String[] getNamesFromString(String names){ if(names == null) return null; @@ -96,6 +98,7 @@ public class EnvVarBuildPath implements /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath#getPathDelimiter() */ + @Override public String getPathDelimiter() { return fPathDelimiter; } @@ -125,6 +128,7 @@ public class EnvVarBuildPath implements /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath#getBuildPathResolver() */ + @Override public IBuildPathResolver getBuildPathResolver() { if(fBuildPathResolver == null && fBuildPathResolverElement != null){ try { diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/FolderInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/FolderInfo.java index 569e18480b6..987b7c4cb33 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/FolderInfo.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/FolderInfo.java @@ -316,6 +316,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return tools.toArray(new Tool[tools.size()]); } + @Override public ITool[] getFilteredTools() { if (toolChain == null) { return new ITool[0]; @@ -325,6 +326,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return filterTools(localTools, manProj); } + @Override public final int getKind() { return ICSettingBase.SETTING_FOLDER; } @@ -355,18 +357,22 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { toolChain.setRebuildState(false); } + @Override public IToolChain getToolChain() { return toolChain; } + @Override public ITool[] getTools() { return toolChain.getTools(); } + @Override public ITool getTool(String id) { return toolChain.getTool(id); } + @Override public ITool[] getToolsBySuperClassId(String id) { return toolChain.getToolsBySuperClassId(id); } @@ -410,10 +416,12 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return null; } + @Override public CFolderData getFolderData(){ return (CFolderData)getResourceData(); } + @Override public CLanguageData[] getCLanguageDatas() { List list = new ArrayList(); for(ITool t : getFilteredTools()) @@ -422,6 +430,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return list.toArray(new BuildLanguageData[list.size()]); } + @Override public ITool getToolFromOutputExtension(String extension) { // Treat a null argument as an empty string String ext = extension == null ? "" : extension; //$NON-NLS-1$ @@ -435,6 +444,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return null; } + @Override public ITool getToolFromInputExtension(String sourceExtension) { // Get all the tools for the current config ITool[] tools = getFilteredTools(); @@ -540,6 +550,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { public void checkPropertiesModificationCompatibility(final ITool tools[], Map unspecifiedRequiredProps, Map unspecifiedProps, Set undefinedSet){ final ToolChain tc = (ToolChain)getToolChain(); IBuildPropertiesRestriction r = new IBuildPropertiesRestriction(){ + @Override public boolean supportsType(String typeId) { if(tc.supportsType(typeId, false)) return true; @@ -551,6 +562,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return false; } + @Override public boolean supportsValue(String typeId, String valueId) { if(tc.supportsValue(typeId, valueId, false)) return true; @@ -562,6 +574,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return false; } + @Override public String[] getRequiredTypeIds() { List list = new ArrayList(); @@ -574,6 +587,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return list.toArray(new String[list.size()]); } + @Override public String[] getSupportedTypeIds() { List list = new ArrayList(); @@ -586,6 +600,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return list.toArray(new String[list.size()]); } + @Override public String[] getSupportedValueIds(String typeId) { List list = new ArrayList(); @@ -598,6 +613,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return list.toArray(new String[list.size()]); } + @Override public boolean requiresType(String typeId) { if(tc.requiresType(typeId, false)) return true; @@ -641,6 +657,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return set; } + @Override public boolean isToolChainCompatible(IToolChain tCh){ return isToolChainCompatible(toolChain, tCh); } @@ -672,6 +689,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return compatible; } + @Override public IToolChain changeToolChain(IToolChain newSuperClass, String Id, String name) throws BuildException{ boolean usePrefTc = false; if(newSuperClass == null){ @@ -898,6 +916,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return map; } + @Override public void modifyToolChain(ITool[] removed, ITool[] added){ ToolListModificationInfo info = ToolChainModificationHelper.getModificationInfo(this, getTools(), added, removed); info.apply(); @@ -1171,6 +1190,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { } + @Override public IModificationStatus getToolChainModificationStatus(ITool[] removed, ITool[] added){ ITool[][] checked = checkDups(removed, added); removed = checked[0]; @@ -1193,6 +1213,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return new ModificationStatus(unspecifiedRequiredProps, unspecifiedProps, undefinedSet, conflicting, nonManagedTools); } + @Override public boolean supportsBuild(boolean managed) { if(getRequiredUnspecifiedProperties().size() != 0) return false; @@ -1210,6 +1231,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return true; } + @Override public boolean buildsFileType(String srcExt) { // Check to see if there is a rule to build a file with this extension ITool[] tools = getFilteredTools(); @@ -1221,6 +1243,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return false; } + @Override public String getOutputExtension(String resourceExtension) { String outputExtension = null; ITool[] tools = getFilteredTools(); @@ -1233,6 +1256,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { return null; } + @Override public boolean isHeaderFile(String ext) { // Check to see if there is a rule to build a file with this extension IManagedProject manProj = getParent().getManagedProject(); @@ -1376,6 +1400,7 @@ public class FolderInfo extends ResourceInfo implements IFolderInfo { setRebuildState(true); } + @Override public boolean isSupported(){ if(toolChain != null) return toolChain.isSupported(); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GnuConfigurationNameProvider.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GnuConfigurationNameProvider.java index 7b24a4c091f..2a4fab7a0a1 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GnuConfigurationNameProvider.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GnuConfigurationNameProvider.java @@ -19,6 +19,7 @@ public class GnuConfigurationNameProvider implements IConfigurationNameProvider /* (non-Javadoc) * @see org.eclipse.cdt.managedbuilder.core.IConfigurationNameProvider#getUniqueConfigurationName(org.eclipse.cdt.managedbuilder.core.IConfiguration, java.lang.String[]) */ + @Override public String getNewConfigurationName(IConfiguration configuration, String[] usedConfigurationNames) { // TODO Auto-generated method stub diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java index 30da79450ec..dea699185f9 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java @@ -258,6 +258,7 @@ public class HeadlessBuilder implements IApplication { final Map map = BuilderFactory.createBuildArgs(configs); IWorkspaceRunnable op = new IWorkspaceRunnable() { + @Override public void run(IProgressMonitor monitor) throws CoreException { ICommand[] commands = proj.getDescription().getBuildSpec(); monitor.beginTask("", commands.length); //$NON-NLS-1$ @@ -390,6 +391,7 @@ public class HeadlessBuilder implements IApplication { return result; } + @Override public Object start(IApplicationContext context) throws Exception { // Build result: whether projects were built successfully boolean buildSuccessful = true; @@ -792,6 +794,7 @@ public class HeadlessBuilder implements IApplication { } } + @Override public void stop() { } } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java index d5dc41705a2..c7bd60b56ad 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HoldsOptions.java @@ -37,20 +37,20 @@ import org.eclipse.core.runtime.Status; /** * Implements the functionality that is needed to hold options and option - * categories. In CDT 3.0, the functionality has been moved from ITool and + * categories. In CDT 3.0, the functionality has been moved from ITool and * Tool to this class. - * + * * This class is intended to be used as base class for all MBS grammar * elements that can hold Options and Option Categories. These are currently - * Tool and ToolChain. - * - * Note that the member superClass must be shared with the - * derived class. This requires to wrap this member by access functions + * Tool and ToolChain. + * + * Note that the member superClass must be shared with the + * derived class. This requires to wrap this member by access functions * in the derived class or frequent casts, because the type of superClass - * in HoldsOptions must be IHoldOptions. Further + * in HoldsOptions must be IHoldOptions. Further * note that the member resolved must inherit the value of its * derived class. This achieved through the constructor. - * + * * @since 3.0 */ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions, IBuildPropertiesRestriction, IBuildPropertyChangeListener { @@ -69,33 +69,33 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions, // Miscellaneous private boolean isDirty = false; private boolean rebuildState; - + /* * C O N S T R U C T O R S */ - + @SuppressWarnings("unused") private HoldsOptions() { // prevent accidental construction of class without setting up // resolved } - + protected HoldsOptions(boolean resolved) { this.resolved = resolved; } - + /** * Copies children of HoldsOptions. Helper function for * derived constructors. - * - * @param source The children of the source will be cloned and added + * + * @param source The children of the source will be cloned and added * to the class itself. */ protected void copyChildren(HoldsOptions source) { // Note: This function ignores OptionCategories since they should not be // found on an non-extension tools - + boolean copyIds = id.equals(source.id); if (source.optionMap != null) { for (Option option : source.getOptionCollection()) { @@ -113,22 +113,22 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions, addOption(newOption); } } - + if(copyIds){ isDirty = source.isDirty; rebuildState = source.rebuildState; } } - + void copyNonoverriddenSettings(HoldsOptions ho){ if (ho.optionMap == null || ho.optionMap.size() == 0) return; - + IOption options[] = getOptions(); for(int i = 0; i < options.length; i++){ if(!options[i].getParent().equals(ho)) continue; - + Option option = (Option)options[i]; int nnn = ManagedBuildManager.getRandomNumber(); String subId; @@ -145,16 +145,16 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions, } } - + /* * E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S */ /** * Load child element from XML element if it is of the correct type - * + * * @param element which is loaded as child only iff it is of the correct type - * @return true when a child has been loaded, false otherwise + * @return true when a child has been loaded, false otherwise */ protected boolean loadChild(ICStorageElement element) { if (element.getName().equals(IHoldsOptions.OPTION)) { @@ -170,9 +170,9 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions, /** * Load child element from configuration element if it is of the correct type - * + * * @param element which is loaded as child only iff it is of the correct type - * @return true when a child has been loaded, false otherwise + * @return true when a child has been loaded, false otherwise */ protected boolean loadChild(IManagedConfigElement element) { if (element.getName().equals(IHoldsOptions.OPTION)) { @@ -185,11 +185,11 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions, } return false; } - + /** * Persist the tool to the XML storage element. Intended to be called by derived * class only, thus do not handle exceptions. - * + * * @param element where to serialize the tool */ protected void serialize(ICStorageElement element) throws BuildException { @@ -199,21 +199,22 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions, ((OptionCategory)optCat).serialize(optCatElement); } } - + Collection