diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 00000000000..f40ce5ed8b9
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,142 @@
+* text=auto
+
+# Generic files
+AUTHORS text
+ChangeLog text
+COPYING text
+NEWS text
+README text
+*.txt text
+*.zip binary
+
+# C-like Sources
+*.asm text
+*.c text
+*.cc text
+*.cpp text
+*.h text
+*.s text
+*.S text
+
+# C-like configuration/scripts
+*.ac text
+*.am text
+*.bat text
+*.build text
+*.incl text
+makefile text
+Makefile text
+*.mk text
+*.sh text
+
+# Qt
+*.pro text
+*.qml text
+*.qrc text
+
+# Visual Studio
+*.dsp text eol=crlf
+*.dsw text eol=crlf
+*.filters text eol=crlf
+*.sln text eol=crlf
+*.vcxproj text eol=crlf
+
+# C output files
+# (These should not normally be checked in, exceptions for pre-compiled libraries and tests)
+*.o binary
+*.d text
+*.dll binary
+*.a binary
+*.exe binary
+*.out binary
+*.app binary
+*.jnilib binary
+*.so binary
+
+# Web/Javascript/Node
+*.css text
+*.htm text
+*.html text
+*.js text
+*.json text
+.npmignore text
+package-list text
+*.xml text
+*.xsd text
+*.xsl text
+
+# Images
+*.gif binary
+*.icns binary
+*.ico binary
+*.jpg binary
+*.jpeg binary
+*.png binary
+*.PNG binary
+*.xpm binary
+
+# Java/Eclipse
+*.java text
+*.properties text
+.api_filters text
+.classpath text
+*.exsd text
+*.g text
+*.inf text
+*.ini text
+*.launch text
+*.mappings text
+*.MF text
+.options text
+*.options text
+*.prefs text
+*.product text
+.project text
+*.setup text
+*.target text
+
+# Java output files
+# (These should not normally be checked in, exceptions for pre-compiled libraries and tests)
+*.class binary
+*.jar binary
+
+# Files used in tests
+*.awts text
+be32 binary
+be32lib binary
+be64 binary
+be64lib binary
+exe binary
+exebig_g binary
+exe_g binary
+*.expected text
+*.F90 text
+*.init text
+launchConfigTestGdbinit text
+le32 binary
+le32lib binary
+le64 binary
+le64lib binary
+*.main text
+output-1 text
+*.pda text
+*.rts text
+test_commands text
+
+# Other special files
+cdtOptions text
+.contentsettings text
+*.csv text
+*.dia binary
+*.dictionary text
+.eclipseproduct text
+.euml2 text
+.gitattributes text
+.gitignore text
+*.patch text
+*.src text
+*.tmLanguage text
+*.top text
+*.ucd text
+.umlproject text
+*.upc text
diff --git a/build/org.eclipse.cdt.autotools.core/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.autotools.core/.settings/org.eclipse.jdt.core.prefs
index 5fa6bebe1e3..28477e229d9 100644
--- a/build/org.eclipse.cdt.autotools.core/.settings/org.eclipse.jdt.core.prefs
+++ b/build/org.eclipse.cdt.autotools.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,100 +1,100 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/build/org.eclipse.cdt.autotools.tests/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.autotools.tests/.settings/org.eclipse.jdt.core.prefs
index 0ff2963342c..01c8b5d65bd 100644
--- a/build/org.eclipse.cdt.autotools.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/build/org.eclipse.cdt.autotools.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,101 +1,101 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/ClangToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/ClangToolChain.java
index 96fa84d7a59..ae4f4cbb7a8 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/ClangToolChain.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/ClangToolChain.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2017 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.build.gcc.core;
-
-import java.nio.file.Path;
-
-import org.eclipse.cdt.core.build.IToolChainProvider;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-
-/**
- * The Clang toolchain. There's little different from the GCC toolchain other
- * than the toolchain type and name.
- *
- * @author dschaefer
- *
- */
-public class ClangToolChain extends GCCToolChain {
-
- public static final String TYPE_ID = "org.eclipse.cdt.build.clang"; //$NON-NLS-1$
-
- public ClangToolChain(IToolChainProvider provider, Path pathToToolChain, String arch,
- IEnvironmentVariable[] envVars) {
- super(provider, pathToToolChain, arch, envVars);
- }
-
- @Override
- public String getTypeId() {
- return TYPE_ID;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.build.gcc.core;
+
+import java.nio.file.Path;
+
+import org.eclipse.cdt.core.build.IToolChainProvider;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
+
+/**
+ * The Clang toolchain. There's little different from the GCC toolchain other
+ * than the toolchain type and name.
+ *
+ * @author dschaefer
+ *
+ */
+public class ClangToolChain extends GCCToolChain {
+
+ public static final String TYPE_ID = "org.eclipse.cdt.build.clang"; //$NON-NLS-1$
+
+ public ClangToolChain(IToolChainProvider provider, Path pathToToolChain, String arch,
+ IEnvironmentVariable[] envVars) {
+ super(provider, pathToToolChain, arch, envVars);
+ }
+
+ @Override
+ public String getTypeId() {
+ return TYPE_ID;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java
index 7b4cb3a5e1d..c702701820f 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java
@@ -1,126 +1,126 @@
-/*******************************************************************************
- * Copyright (c) 2016 QNX Software Systems and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.build.gcc.core.internal;
-
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import org.eclipse.cdt.build.gcc.core.GCCToolChain;
-import org.eclipse.cdt.core.build.IToolChain;
-import org.eclipse.cdt.core.build.IToolChainManager;
-import org.eclipse.cdt.core.build.IToolChainProvider;
-import org.eclipse.cdt.core.envvar.EnvironmentVariable;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.utils.WindowsRegistry;
-import org.eclipse.core.runtime.Platform;
-
-public class Msys2ToolChainProvider implements IToolChainProvider {
-
- private static final String ID = "org.eclipse.cdt.build.gcc.core.msys2Provider"; //$NON-NLS-1$
-
- @Override
- public String getId() {
- return ID;
- }
-
- @Override
- public void init(IToolChainManager manager) {
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- WindowsRegistry registry = WindowsRegistry.getRegistry();
- String uninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; //$NON-NLS-1$
- String subkey;
- boolean on64bit = Platform.getOSArch().equals(Platform.ARCH_X86_64);
- String key32bit = null;
- for (int i = 0; (subkey = registry.getCurrentUserKeyName(uninstallKey, i)) != null; i++) {
- String compKey = uninstallKey + '\\' + subkey;
- String displayName = registry.getCurrentUserValue(compKey, "DisplayName"); //$NON-NLS-1$
- if (on64bit) {
- if ("MSYS2 64bit".equals(displayName)) { //$NON-NLS-1$
- if (addToolChain64(manager, registry, compKey)) {
- key32bit = null;
- break;
- }
- } else if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$
- key32bit = compKey;
- }
- } else {
- if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$
- if (addToolChain32(manager, registry, compKey)) {
- break;
- }
- }
- }
- }
-
- if (on64bit && key32bit != null) {
- addToolChain64(manager, registry, key32bit);
- }
- }
- }
-
- private boolean addToolChain64(IToolChainManager manager, WindowsRegistry registry, String key) {
- String installLocation = registry.getCurrentUserValue(key, "InstallLocation"); //$NON-NLS-1$
- Path msysPath = Paths.get(installLocation);
- Path gccPath = msysPath.resolve("mingw64\\bin\\gcc.exe"); //$NON-NLS-1$
- if (Files.exists(gccPath)) {
- StringBuilder pathVar = new StringBuilder();
- pathVar.append(msysPath);
- pathVar.append("\\mingw64\\bin"); //$NON-NLS-1$
- pathVar.append(File.pathSeparatorChar);
- pathVar.append(msysPath);
- pathVar.append("\\usr\\local\\bin"); //$NON-NLS-1$
- pathVar.append(File.pathSeparatorChar);
- pathVar.append(msysPath);
- pathVar.append("\\usr\\bin"); //$NON-NLS-1$
- pathVar.append(File.pathSeparatorChar);
- pathVar.append(msysPath);
- pathVar.append("\\bin"); //$NON-NLS-1$
- IEnvironmentVariable[] vars = new IEnvironmentVariable[] {
- new EnvironmentVariable("PATH", pathVar.toString(), IEnvironmentVariable.ENVVAR_PREPEND, //$NON-NLS-1$
- File.pathSeparator)
- };
- GCCToolChain toolChain = new GCCToolChain(this, gccPath, Platform.ARCH_X86_64, vars);
- toolChain.setProperty(IToolChain.ATTR_PACKAGE, "msys2"); //$NON-NLS-1$
- manager.addToolChain(toolChain);
- return true;
- } else {
- return addToolChain32(manager, registry, key);
- }
- }
-
- private boolean addToolChain32(IToolChainManager manager, WindowsRegistry registry, String key) {
- String installLocation = registry.getCurrentUserValue(key, "InstallLocation"); //$NON-NLS-1$
- Path msysPath = Paths.get(installLocation);
- Path gccPath = msysPath.resolve("mingw32\\bin\\gcc.exe"); //$NON-NLS-1$
- if (Files.exists(gccPath)) {
- StringBuilder pathVar = new StringBuilder();
- pathVar.append(msysPath);
- pathVar.append("\\mingw32\\bin"); //$NON-NLS-1$
- pathVar.append(File.pathSeparatorChar);
- pathVar.append(msysPath);
- pathVar.append("\\usr\\local\\bin"); //$NON-NLS-1$
- pathVar.append(File.pathSeparatorChar);
- pathVar.append(msysPath);
- pathVar.append("\\usr\\bin"); //$NON-NLS-1$
- pathVar.append(File.pathSeparatorChar);
- pathVar.append(msysPath);
- pathVar.append("\\bin"); //$NON-NLS-1$
- IEnvironmentVariable[] vars = new IEnvironmentVariable[] {
- new EnvironmentVariable("PATH", pathVar.toString(), IEnvironmentVariable.ENVVAR_PREPEND, //$NON-NLS-1$
- File.pathSeparator) };
- GCCToolChain toolChain = new GCCToolChain(this, gccPath, Platform.ARCH_X86, vars);
- toolChain.setProperty(IToolChain.ATTR_PACKAGE, "msys2"); //$NON-NLS-1$
- manager.addToolChain(toolChain);
- return true;
- } else {
- return false;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2016 QNX Software Systems and others. All rights reserved. This program and the
+ * accompanying materials are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.build.gcc.core.internal;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.eclipse.cdt.build.gcc.core.GCCToolChain;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
+import org.eclipse.cdt.core.build.IToolChainProvider;
+import org.eclipse.cdt.core.envvar.EnvironmentVariable;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
+import org.eclipse.cdt.utils.WindowsRegistry;
+import org.eclipse.core.runtime.Platform;
+
+public class Msys2ToolChainProvider implements IToolChainProvider {
+
+ private static final String ID = "org.eclipse.cdt.build.gcc.core.msys2Provider"; //$NON-NLS-1$
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+
+ @Override
+ public void init(IToolChainManager manager) {
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ WindowsRegistry registry = WindowsRegistry.getRegistry();
+ String uninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; //$NON-NLS-1$
+ String subkey;
+ boolean on64bit = Platform.getOSArch().equals(Platform.ARCH_X86_64);
+ String key32bit = null;
+ for (int i = 0; (subkey = registry.getCurrentUserKeyName(uninstallKey, i)) != null; i++) {
+ String compKey = uninstallKey + '\\' + subkey;
+ String displayName = registry.getCurrentUserValue(compKey, "DisplayName"); //$NON-NLS-1$
+ if (on64bit) {
+ if ("MSYS2 64bit".equals(displayName)) { //$NON-NLS-1$
+ if (addToolChain64(manager, registry, compKey)) {
+ key32bit = null;
+ break;
+ }
+ } else if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$
+ key32bit = compKey;
+ }
+ } else {
+ if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$
+ if (addToolChain32(manager, registry, compKey)) {
+ break;
+ }
+ }
+ }
+ }
+
+ if (on64bit && key32bit != null) {
+ addToolChain64(manager, registry, key32bit);
+ }
+ }
+ }
+
+ private boolean addToolChain64(IToolChainManager manager, WindowsRegistry registry, String key) {
+ String installLocation = registry.getCurrentUserValue(key, "InstallLocation"); //$NON-NLS-1$
+ Path msysPath = Paths.get(installLocation);
+ Path gccPath = msysPath.resolve("mingw64\\bin\\gcc.exe"); //$NON-NLS-1$
+ if (Files.exists(gccPath)) {
+ StringBuilder pathVar = new StringBuilder();
+ pathVar.append(msysPath);
+ pathVar.append("\\mingw64\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\usr\\local\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\usr\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\bin"); //$NON-NLS-1$
+ IEnvironmentVariable[] vars = new IEnvironmentVariable[] {
+ new EnvironmentVariable("PATH", pathVar.toString(), IEnvironmentVariable.ENVVAR_PREPEND, //$NON-NLS-1$
+ File.pathSeparator)
+ };
+ GCCToolChain toolChain = new GCCToolChain(this, gccPath, Platform.ARCH_X86_64, vars);
+ toolChain.setProperty(IToolChain.ATTR_PACKAGE, "msys2"); //$NON-NLS-1$
+ manager.addToolChain(toolChain);
+ return true;
+ } else {
+ return addToolChain32(manager, registry, key);
+ }
+ }
+
+ private boolean addToolChain32(IToolChainManager manager, WindowsRegistry registry, String key) {
+ String installLocation = registry.getCurrentUserValue(key, "InstallLocation"); //$NON-NLS-1$
+ Path msysPath = Paths.get(installLocation);
+ Path gccPath = msysPath.resolve("mingw32\\bin\\gcc.exe"); //$NON-NLS-1$
+ if (Files.exists(gccPath)) {
+ StringBuilder pathVar = new StringBuilder();
+ pathVar.append(msysPath);
+ pathVar.append("\\mingw32\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\usr\\local\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\usr\\bin"); //$NON-NLS-1$
+ pathVar.append(File.pathSeparatorChar);
+ pathVar.append(msysPath);
+ pathVar.append("\\bin"); //$NON-NLS-1$
+ IEnvironmentVariable[] vars = new IEnvironmentVariable[] {
+ new EnvironmentVariable("PATH", pathVar.toString(), IEnvironmentVariable.ENVVAR_PREPEND, //$NON-NLS-1$
+ File.pathSeparator) };
+ GCCToolChain toolChain = new GCCToolChain(this, gccPath, Platform.ARCH_X86, vars);
+ toolChain.setProperty(IToolChain.ATTR_PACKAGE, "msys2"); //$NON-NLS-1$
+ manager.addToolChain(toolChain);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/Messages.java b/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/Messages.java
index 4905e7fd64b..2e07df00926 100644
--- a/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/Messages.java
+++ b/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/Messages.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2017 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.build.gcc.ui.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.cdt.build.gcc.ui.internal.messages"; //$NON-NLS-1$
- public static String GCCToolChainSettingsPage_Arch;
- public static String GCCToolChainSettingsPage_Browse;
- public static String GCCToolChainSettingsPage_ClangTitle;
- public static String GCCToolChainSettingsPage_Compiler;
- public static String GCCToolChainSettingsPage_Description;
- public static String GCCToolChainSettingsPage_OS;
- public static String GCCToolChainSettingsPage_Title;
- public static String NewClangToolChainWizard_Title;
- public static String NewEnvVarDialog_Append;
- public static String NewEnvVarDialog_Delimiter;
- public static String NewEnvVarDialog_Edit;
- public static String NewEnvVarDialog_Name;
- public static String NewEnvVarDialog_New;
- public static String NewEnvVarDialog_Operation;
- public static String NewEnvVarDialog_Prepend;
- public static String NewEnvVarDialog_Replace;
- public static String NewEnvVarDialog_Select;
- public static String NewEnvVarDialog_Unset;
- public static String NewEnvVarDialog_Value;
- public static String NewGCCToolChainWizard_Add;
- public static String NewGCCToolChainWizard_New;
- public static String ToolChainEnvironmentPage_Add;
- public static String ToolChainEnvironmentPage_Append;
- public static String ToolChainEnvironmentPage_Description;
- public static String ToolChainEnvironmentPage_Edit;
- public static String ToolChainEnvironmentPage_Name;
- public static String ToolChainEnvironmentPage_Operation;
- public static String ToolChainEnvironmentPage_Prepend;
- public static String ToolChainEnvironmentPage_Remove;
- public static String ToolChainEnvironmentPage_RemoveMessage;
- public static String ToolChainEnvironmentPage_RemoveTitle;
- public static String ToolChainEnvironmentPage_Replace;
- public static String ToolChainEnvironmentPage_Title;
- public static String ToolChainEnvironmentPage_Unset;
- public static String ToolChainEnvironmentPage_Value;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.build.gcc.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.build.gcc.ui.internal.messages"; //$NON-NLS-1$
+ public static String GCCToolChainSettingsPage_Arch;
+ public static String GCCToolChainSettingsPage_Browse;
+ public static String GCCToolChainSettingsPage_ClangTitle;
+ public static String GCCToolChainSettingsPage_Compiler;
+ public static String GCCToolChainSettingsPage_Description;
+ public static String GCCToolChainSettingsPage_OS;
+ public static String GCCToolChainSettingsPage_Title;
+ public static String NewClangToolChainWizard_Title;
+ public static String NewEnvVarDialog_Append;
+ public static String NewEnvVarDialog_Delimiter;
+ public static String NewEnvVarDialog_Edit;
+ public static String NewEnvVarDialog_Name;
+ public static String NewEnvVarDialog_New;
+ public static String NewEnvVarDialog_Operation;
+ public static String NewEnvVarDialog_Prepend;
+ public static String NewEnvVarDialog_Replace;
+ public static String NewEnvVarDialog_Select;
+ public static String NewEnvVarDialog_Unset;
+ public static String NewEnvVarDialog_Value;
+ public static String NewGCCToolChainWizard_Add;
+ public static String NewGCCToolChainWizard_New;
+ public static String ToolChainEnvironmentPage_Add;
+ public static String ToolChainEnvironmentPage_Append;
+ public static String ToolChainEnvironmentPage_Description;
+ public static String ToolChainEnvironmentPage_Edit;
+ public static String ToolChainEnvironmentPage_Name;
+ public static String ToolChainEnvironmentPage_Operation;
+ public static String ToolChainEnvironmentPage_Prepend;
+ public static String ToolChainEnvironmentPage_Remove;
+ public static String ToolChainEnvironmentPage_RemoveMessage;
+ public static String ToolChainEnvironmentPage_RemoveTitle;
+ public static String ToolChainEnvironmentPage_Replace;
+ public static String ToolChainEnvironmentPage_Title;
+ public static String ToolChainEnvironmentPage_Unset;
+ public static String ToolChainEnvironmentPage_Value;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/NewClangToolChainWizard.java b/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/NewClangToolChainWizard.java
index a4892173050..d508b739929 100644
--- a/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/NewClangToolChainWizard.java
+++ b/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/NewClangToolChainWizard.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2017 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.build.gcc.ui.internal;
-
-import java.nio.file.Path;
-
-import org.eclipse.cdt.build.gcc.core.ClangToolChain;
-import org.eclipse.cdt.build.gcc.core.GCCToolChain;
-import org.eclipse.cdt.build.gcc.core.GCCUserToolChainProvider;
-import org.eclipse.cdt.core.build.IToolChain;
-import org.eclipse.cdt.core.build.IToolChainManager;
-import org.eclipse.cdt.core.build.IUserToolChainProvider;
-import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
-import org.eclipse.cdt.ui.build.ToolChainWizard;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
-public class NewClangToolChainWizard extends ToolChainWizard {
-
- private GCCToolChainSettingsPage settingsPage;
- private ToolChainEnvironmentPage envPage;
-
- @Override
- public boolean performFinish() {
- Path path = settingsPage.getPath();
- String os = settingsPage.getOS();
- String arch = settingsPage.getArch();
- IEnvironmentVariable[] envvars = envPage.getEnvVars();
-
- new Job(Messages.NewGCCToolChainWizard_Add) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- IToolChainManager manager = Activator.getService(IToolChainManager.class);
- IUserToolChainProvider provider = (IUserToolChainProvider) manager
- .getProvider(GCCUserToolChainProvider.PROVIDER_ID);
-
- if (toolChain != null) {
- provider.removeToolChain(toolChain);
- }
-
- ClangToolChain gcc = new ClangToolChain(provider, path, arch, envvars);
- gcc.setProperty(IToolChain.ATTR_OS, os);
- provider.addToolChain(gcc);
- return Status.OK_STATUS;
- } catch (CoreException e) {
- return e.getStatus();
- }
- }
- }.schedule();
- return true;
- }
-
- @Override
- public void addPages() {
- super.addPages();
-
- settingsPage = new GCCToolChainSettingsPage((GCCToolChain) toolChain, true);
- addPage(settingsPage);
-
- envPage = new ToolChainEnvironmentPage(toolChain);
- addPage(envPage);
-
- setWindowTitle(Messages.NewClangToolChainWizard_Title);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.build.gcc.ui.internal;
+
+import java.nio.file.Path;
+
+import org.eclipse.cdt.build.gcc.core.ClangToolChain;
+import org.eclipse.cdt.build.gcc.core.GCCToolChain;
+import org.eclipse.cdt.build.gcc.core.GCCUserToolChainProvider;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.IToolChainManager;
+import org.eclipse.cdt.core.build.IUserToolChainProvider;
+import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
+import org.eclipse.cdt.ui.build.ToolChainWizard;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+
+public class NewClangToolChainWizard extends ToolChainWizard {
+
+ private GCCToolChainSettingsPage settingsPage;
+ private ToolChainEnvironmentPage envPage;
+
+ @Override
+ public boolean performFinish() {
+ Path path = settingsPage.getPath();
+ String os = settingsPage.getOS();
+ String arch = settingsPage.getArch();
+ IEnvironmentVariable[] envvars = envPage.getEnvVars();
+
+ new Job(Messages.NewGCCToolChainWizard_Add) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ IToolChainManager manager = Activator.getService(IToolChainManager.class);
+ IUserToolChainProvider provider = (IUserToolChainProvider) manager
+ .getProvider(GCCUserToolChainProvider.PROVIDER_ID);
+
+ if (toolChain != null) {
+ provider.removeToolChain(toolChain);
+ }
+
+ ClangToolChain gcc = new ClangToolChain(provider, path, arch, envvars);
+ gcc.setProperty(IToolChain.ATTR_OS, os);
+ provider.addToolChain(gcc);
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ }.schedule();
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+
+ settingsPage = new GCCToolChainSettingsPage((GCCToolChain) toolChain, true);
+ addPage(settingsPage);
+
+ envPage = new ToolChainEnvironmentPage(toolChain);
+ addPage(envPage);
+
+ setWindowTitle(Messages.NewClangToolChainWizard_Title);
+ }
+
+}
diff --git a/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/messages.properties b/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/messages.properties
index 47aa4fe0d0d..986e1cb776a 100644
--- a/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/messages.properties
+++ b/build/org.eclipse.cdt.build.gcc.ui/src/org/eclipse/cdt/build/gcc/ui/internal/messages.properties
@@ -1,42 +1,42 @@
-################################################################################
-# Copyright (c) 2017 QNX Software Systems and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-################################################################################
-GCCToolChainSettingsPage_Arch=CPU Architecture:
-GCCToolChainSettingsPage_Browse=Browse...
-GCCToolChainSettingsPage_ClangTitle=clang Toolchain Settings
-GCCToolChainSettingsPage_Compiler=Compiler:
-GCCToolChainSettingsPage_Description=Enter the path to the compiler and properties for the toolchain.
-GCCToolChainSettingsPage_OS=Operating System:
-GCCToolChainSettingsPage_Title=GCC ToolChain Settings
-NewClangToolChainWizard_Title=New clang Toolchain
-NewEnvVarDialog_Append=Append
-NewEnvVarDialog_Delimiter=Delimiter:
-NewEnvVarDialog_Edit=Edit Environment Variable
-NewEnvVarDialog_Name=Name:
-NewEnvVarDialog_New=New Environment Variable
-NewEnvVarDialog_Operation=Operation
-NewEnvVarDialog_Prepend=Prepend
-NewEnvVarDialog_Replace=Replace
-NewEnvVarDialog_Select=Select...
-NewEnvVarDialog_Unset=Unset
-NewEnvVarDialog_Value=Value:
-NewGCCToolChainWizard_Add=Add ToolChain
-NewGCCToolChainWizard_New=New GCC ToolChain
-ToolChainEnvironmentPage_Add=Add...
-ToolChainEnvironmentPage_Append=Append
-ToolChainEnvironmentPage_Description=Environment variables to set when using toolchain.
-ToolChainEnvironmentPage_Edit=Edit...
-ToolChainEnvironmentPage_Name=Name
-ToolChainEnvironmentPage_Operation=Operation
-ToolChainEnvironmentPage_Prepend=Prepend
-ToolChainEnvironmentPage_Remove=Remove
-ToolChainEnvironmentPage_RemoveMessage=Are you sure you would like to remove the selected environment variable(s)
-ToolChainEnvironmentPage_RemoveTitle=Remove
-ToolChainEnvironmentPage_Replace=Replace
-ToolChainEnvironmentPage_Title=Environment Variables
-ToolChainEnvironmentPage_Unset=Unset
-ToolChainEnvironmentPage_Value=Value
+################################################################################
+# Copyright (c) 2017 QNX Software Systems and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+################################################################################
+GCCToolChainSettingsPage_Arch=CPU Architecture:
+GCCToolChainSettingsPage_Browse=Browse...
+GCCToolChainSettingsPage_ClangTitle=clang Toolchain Settings
+GCCToolChainSettingsPage_Compiler=Compiler:
+GCCToolChainSettingsPage_Description=Enter the path to the compiler and properties for the toolchain.
+GCCToolChainSettingsPage_OS=Operating System:
+GCCToolChainSettingsPage_Title=GCC ToolChain Settings
+NewClangToolChainWizard_Title=New clang Toolchain
+NewEnvVarDialog_Append=Append
+NewEnvVarDialog_Delimiter=Delimiter:
+NewEnvVarDialog_Edit=Edit Environment Variable
+NewEnvVarDialog_Name=Name:
+NewEnvVarDialog_New=New Environment Variable
+NewEnvVarDialog_Operation=Operation
+NewEnvVarDialog_Prepend=Prepend
+NewEnvVarDialog_Replace=Replace
+NewEnvVarDialog_Select=Select...
+NewEnvVarDialog_Unset=Unset
+NewEnvVarDialog_Value=Value:
+NewGCCToolChainWizard_Add=Add ToolChain
+NewGCCToolChainWizard_New=New GCC ToolChain
+ToolChainEnvironmentPage_Add=Add...
+ToolChainEnvironmentPage_Append=Append
+ToolChainEnvironmentPage_Description=Environment variables to set when using toolchain.
+ToolChainEnvironmentPage_Edit=Edit...
+ToolChainEnvironmentPage_Name=Name
+ToolChainEnvironmentPage_Operation=Operation
+ToolChainEnvironmentPage_Prepend=Prepend
+ToolChainEnvironmentPage_Remove=Remove
+ToolChainEnvironmentPage_RemoveMessage=Are you sure you would like to remove the selected environment variable(s)
+ToolChainEnvironmentPage_RemoveTitle=Remove
+ToolChainEnvironmentPage_Replace=Replace
+ToolChainEnvironmentPage_Title=Environment Variables
+ToolChainEnvironmentPage_Unset=Unset
+ToolChainEnvironmentPage_Value=Value
diff --git a/build/org.eclipse.cdt.core.autotools-feature/feature.xml b/build/org.eclipse.cdt.core.autotools-feature/feature.xml
index 37023049e4b..f41dd07bfde 100644
--- a/build/org.eclipse.cdt.core.autotools-feature/feature.xml
+++ b/build/org.eclipse.cdt.core.autotools-feature/feature.xml
@@ -1,36 +1,36 @@
-
-
-
-
- %description
-
-
-
- %copyright
-
-
-
- %license
-
-
-
-
-
-
-
+
+
+
+
+ %description
+
+
+
+ %copyright
+
+
+
+ %license
+
+
+
+
+
+
+
diff --git a/build/org.eclipse.cdt.gnu.build-feature/feature.xml b/build/org.eclipse.cdt.gnu.build-feature/feature.xml
index 0ab36aedd68..b7a4c8b03cb 100644
--- a/build/org.eclipse.cdt.gnu.build-feature/feature.xml
+++ b/build/org.eclipse.cdt.gnu.build-feature/feature.xml
@@ -1,43 +1,43 @@
-
-
-
-
- %description
-
-
-
- %copyright
-
-
-
- %license
-
-
-
-
-
-
-
-
-
+
+
+
+
+ %description
+
+
+
+ %copyright
+
+
+
+ %license
+
+
+
+
+
+
+
+
+
diff --git a/build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd b/build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd
index 8f3ad3f4c93..95e49532119 100644
--- a/build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd
+++ b/build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd
@@ -1,109 +1,109 @@
-
-
-
-
-
-
-
-
- This extension point is used to identify builders that support IMakeBuidlerInfo an arguments.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Eclipse builder ID of the builder that supports target builds. (Must support IMakeInfo as argument).
-
-
-
-
-
-
- id used to identify this target builder
-
-
-
-
-
-
-
-
-
-
-
- [Enter the first release in which this extension point appears.]
-
-
-
-
-
-
-
-
- [Enter extension point usage example here.]
-
-
-
-
-
-
-
-
- [Enter API information here.]
-
-
-
-
-
-
-
-
- [Enter information about supplied implementation of this extension point.]
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ This extension point is used to identify builders that support IMakeBuidlerInfo an arguments.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Eclipse builder ID of the builder that supports target builds. (Must support IMakeInfo as argument).
+
+
+
+
+
+
+ id used to identify this target builder
+
+
+
+
+
+
+
+
+
+
+
+ [Enter the first release in which this extension point appears.]
+
+
+
+
+
+
+
+
+ [Enter extension point usage example here.]
+
+
+
+
+
+
+
+
+ [Enter API information here.]
+
+
+
+
+
+
+
+
+ [Enter information about supplied implementation of this extension point.]
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
index 5d6f82d2927..3941e48ac0a 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2017 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.make.core;
-
-import org.eclipse.cdt.core.build.ICBuildConfiguration;
-import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
-import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
-import org.eclipse.cdt.core.build.IToolChain;
-import org.eclipse.cdt.core.build.StandardBuildConfiguration;
-import org.eclipse.core.resources.IBuildConfiguration;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @since 7.4
- */
-public class MakefileBuildConfigurationProvider implements ICBuildConfigurationProvider {
-
- public static final String ID = "org.eclipse.cdt.make.core.provider"; //$NON-NLS-1$
-
- @Override
- public String getId() {
- return ID;
- }
-
- @Override
- public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name)
- throws CoreException {
- return new StandardBuildConfiguration(config, name);
- }
-
- @Override
- public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain,
- String launchMode, IProgressMonitor monitor) throws CoreException {
- ICBuildConfigurationManager configManager = MakeCorePlugin.getService(ICBuildConfigurationManager.class);
-
- StringBuilder configName = new StringBuilder("make."); //$NON-NLS-1$
- configName.append(launchMode);
- String os = toolChain.getProperty(IToolChain.ATTR_OS);
- if ("linux-container".equals(os)) { //$NON-NLS-1$
- String osConfigName = toolChain.getProperty("linux-container-id"); //$NON-NLS-1$
- configName.append('.');
- configName.append(osConfigName);
- } else {
- if (os != null) {
- configName.append('.');
- configName.append(os);
- }
- String arch = toolChain.getProperty(IToolChain.ATTR_ARCH);
- if (arch != null && !arch.isEmpty()) {
- configName.append('.');
- configName.append(arch);
- }
- }
- String name = configName.toString();
- int i = 0;
- while (configManager.hasConfiguration(this, project, name)) {
- name = configName.toString() + '.' + (++i);
- }
-
- IBuildConfiguration config = configManager.createBuildConfiguration(this, project, name, monitor);
- StandardBuildConfiguration makeConfig = new StandardBuildConfiguration(config, name, toolChain,
- launchMode);
- configManager.addBuildConfiguration(config, makeConfig);
- return makeConfig;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.make.core;
+
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
+import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
+import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.StandardBuildConfiguration;
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @since 7.4
+ */
+public class MakefileBuildConfigurationProvider implements ICBuildConfigurationProvider {
+
+ public static final String ID = "org.eclipse.cdt.make.core.provider"; //$NON-NLS-1$
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+
+ @Override
+ public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name)
+ throws CoreException {
+ return new StandardBuildConfiguration(config, name);
+ }
+
+ @Override
+ public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain,
+ String launchMode, IProgressMonitor monitor) throws CoreException {
+ ICBuildConfigurationManager configManager = MakeCorePlugin.getService(ICBuildConfigurationManager.class);
+
+ StringBuilder configName = new StringBuilder("make."); //$NON-NLS-1$
+ configName.append(launchMode);
+ String os = toolChain.getProperty(IToolChain.ATTR_OS);
+ if ("linux-container".equals(os)) { //$NON-NLS-1$
+ String osConfigName = toolChain.getProperty("linux-container-id"); //$NON-NLS-1$
+ configName.append('.');
+ configName.append(osConfigName);
+ } else {
+ if (os != null) {
+ configName.append('.');
+ configName.append(os);
+ }
+ String arch = toolChain.getProperty(IToolChain.ATTR_ARCH);
+ if (arch != null && !arch.isEmpty()) {
+ configName.append('.');
+ configName.append(arch);
+ }
+ }
+ String name = configName.toString();
+ int i = 0;
+ while (configManager.hasConfiguration(this, project, name)) {
+ name = configName.toString() + '.' + (++i);
+ }
+
+ IBuildConfiguration config = configManager.createBuildConfiguration(this, project, name, monitor);
+ StandardBuildConfiguration makeConfig = new StandardBuildConfiguration(config, name, toolChain,
+ launchMode);
+ configManager.addBuildConfiguration(config, makeConfig);
+ return makeConfig;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
index 69f6b544f4c..cfc0e622e72 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2017 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.make.core;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.cdt.core.build.CBuilder;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.tools.templates.freemarker.FMProjectGenerator;
-import org.eclipse.tools.templates.freemarker.SourceRoot;
-import org.eclipse.tools.templates.freemarker.TemplateManifest;
-import org.osgi.framework.Bundle;
-
-/**
- * Generator for Makefile projects.
- *
- * @since 7.4
- */
-public class MakefileProjectGenerator extends FMProjectGenerator {
-
- public MakefileProjectGenerator(String manifestPath) {
- super(manifestPath);
- }
-
- @Override
- protected Bundle getSourceBundle() {
- return MakeCorePlugin.getDefault().getBundle();
- }
-
- @Override
- protected void initProjectDescription(IProjectDescription description) throws CoreException {
- description.setNatureIds(new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID,
- MakeProjectNature.NATURE_ID });
- ICommand command = description.newCommand();
- CBuilder.setupBuilder(command);
- description.setBuildSpec(new ICommand[] { command });
- }
-
- @Override
- public void generate(Map model, IProgressMonitor monitor) throws CoreException {
- super.generate(model, monitor);
-
- List entries = new ArrayList<>();
- IProject project = getProject();
-
- // Create the source and output folders
- IFolder buildFolder = getProject().getFolder("build"); //$NON-NLS-1$
-
- TemplateManifest manifest = getManifest();
- if (manifest != null) {
- List srcRoots = getManifest().getSrcRoots();
- if (srcRoots != null && !srcRoots.isEmpty()) {
- for (SourceRoot srcRoot : srcRoots) {
- IFolder sourceFolder = project.getFolder(srcRoot.getDir());
- if (!sourceFolder.exists()) {
- sourceFolder.create(true, true, monitor);
- }
-
- entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath(),
- new IPath[] { buildFolder.getFullPath() }));
- }
- } else {
- entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
- }
- }
-
- entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath()));
- CoreModel.getDefault().create(project)
- .setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), monitor);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.make.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.core.build.CBuilder;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tools.templates.freemarker.FMProjectGenerator;
+import org.eclipse.tools.templates.freemarker.SourceRoot;
+import org.eclipse.tools.templates.freemarker.TemplateManifest;
+import org.osgi.framework.Bundle;
+
+/**
+ * Generator for Makefile projects.
+ *
+ * @since 7.4
+ */
+public class MakefileProjectGenerator extends FMProjectGenerator {
+
+ public MakefileProjectGenerator(String manifestPath) {
+ super(manifestPath);
+ }
+
+ @Override
+ protected Bundle getSourceBundle() {
+ return MakeCorePlugin.getDefault().getBundle();
+ }
+
+ @Override
+ protected void initProjectDescription(IProjectDescription description) throws CoreException {
+ description.setNatureIds(new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID,
+ MakeProjectNature.NATURE_ID });
+ ICommand command = description.newCommand();
+ CBuilder.setupBuilder(command);
+ description.setBuildSpec(new ICommand[] { command });
+ }
+
+ @Override
+ public void generate(Map model, IProgressMonitor monitor) throws CoreException {
+ super.generate(model, monitor);
+
+ List entries = new ArrayList<>();
+ IProject project = getProject();
+
+ // Create the source and output folders
+ IFolder buildFolder = getProject().getFolder("build"); //$NON-NLS-1$
+
+ TemplateManifest manifest = getManifest();
+ if (manifest != null) {
+ List srcRoots = getManifest().getSrcRoots();
+ if (srcRoots != null && !srcRoots.isEmpty()) {
+ for (SourceRoot srcRoot : srcRoots) {
+ IFolder sourceFolder = project.getFolder(srcRoot.getDir());
+ if (!sourceFolder.exists()) {
+ sourceFolder.create(true, true, monitor);
+ }
+
+ entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath(),
+ new IPath[] { buildFolder.getFullPath() }));
+ }
+ } else {
+ entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
+ }
+ }
+
+ entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath()));
+ CoreModel.getDefault().create(project)
+ .setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), monitor);
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java
index 8ecb3e935e4..dfe235e80e0 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.core.scannerconfig2;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
-import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerConfigUtil;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Runs a command to retrieve compiler intrinsic scanner info from 'specs' file.
- *
- * @author vhirsl
- */
-public class GCCSpecsRunSIProvider extends DefaultRunSIProvider {
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
- */
- @Override
- protected boolean initialize() {
- boolean rc = super.initialize();
-
- if (rc) {
- String targetFile = "dummy"; //$NON-NLS-1$
- IProject project = resource.getProject();
- try {
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- targetFile = GCCScannerConfigUtil.CPP_SPECS_FILE;
- }
- else if (project.hasNature(CProjectNature.C_NATURE_ID)) {
- targetFile = GCCScannerConfigUtil.C_SPECS_FILE;
- }
- // replace string variables in compile arguments
- // TODO Vmir - use string variable replacement
- for (int i = 0; i < fCompileArguments.length; ++i) {
- fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
- MakeCorePlugin.getWorkingDirectory().toString());
- fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{specs_file\\}", targetFile); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- //TODO VMIR better error handling
- MakeCorePlugin.log(e.getStatus());
- rc = false;
- }
- }
- return rc;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#prepareArguments(boolean)
- */
- @Override
- protected String[] prepareArguments(boolean isDefaultCommand) {
- if (collector == null)
- return fCompileArguments;
-
- @SuppressWarnings("unchecked")
- List tso = collector.getCollectedScannerInfo(resource.getProject(), ScannerInfoTypes.TARGET_SPECIFIC_OPTION);
- if (tso == null || tso.size() == 0) {
- return fCompileArguments;
- }
-
- String[] rv = null;
- // commandArguments may have multiple arguments; tokenizing
- int nTokens = 0;
- if (fCompileArguments != null && fCompileArguments.length > 0) {
- nTokens = fCompileArguments.length;
- rv = new String[nTokens + tso.size()];
- System.arraycopy(fCompileArguments, 0, rv, 0, nTokens);
- }
- else {
- rv = new String[tso.size()];
- }
- for (int i = 0; i < tso.size(); ++i) {
- rv[nTokens + i] = tso.get(i);
- }
- return rv;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.core.scannerconfig2;
+
+import java.util.List;
+
+import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
+import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerConfigUtil;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Runs a command to retrieve compiler intrinsic scanner info from 'specs' file.
+ *
+ * @author vhirsl
+ */
+public class GCCSpecsRunSIProvider extends DefaultRunSIProvider {
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
+ */
+ @Override
+ protected boolean initialize() {
+ boolean rc = super.initialize();
+
+ if (rc) {
+ String targetFile = "dummy"; //$NON-NLS-1$
+ IProject project = resource.getProject();
+ try {
+ if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ targetFile = GCCScannerConfigUtil.CPP_SPECS_FILE;
+ }
+ else if (project.hasNature(CProjectNature.C_NATURE_ID)) {
+ targetFile = GCCScannerConfigUtil.C_SPECS_FILE;
+ }
+ // replace string variables in compile arguments
+ // TODO Vmir - use string variable replacement
+ for (int i = 0; i < fCompileArguments.length; ++i) {
+ fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
+ MakeCorePlugin.getWorkingDirectory().toString());
+ fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{specs_file\\}", targetFile); //$NON-NLS-1$
+ }
+ } catch (CoreException e) {
+ //TODO VMIR better error handling
+ MakeCorePlugin.log(e.getStatus());
+ rc = false;
+ }
+ }
+ return rc;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#prepareArguments(boolean)
+ */
+ @Override
+ protected String[] prepareArguments(boolean isDefaultCommand) {
+ if (collector == null)
+ return fCompileArguments;
+
+ @SuppressWarnings("unchecked")
+ List tso = collector.getCollectedScannerInfo(resource.getProject(), ScannerInfoTypes.TARGET_SPECIFIC_OPTION);
+ if (tso == null || tso.size() == 0) {
+ return fCompileArguments;
+ }
+
+ String[] rv = null;
+ // commandArguments may have multiple arguments; tokenizing
+ int nTokens = 0;
+ if (fCompileArguments != null && fCompileArguments.length > 0) {
+ nTokens = fCompileArguments.length;
+ rv = new String[nTokens + tso.size()];
+ System.arraycopy(fCompileArguments, 0, rv, 0, nTokens);
+ }
+ else {
+ rv = new String[tso.size()];
+ }
+ for (int i = 0; i < tso.size(); ++i) {
+ rv[nTokens + i] = tso.get(i);
+ }
+ return rv;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.core/templates/simple/Makefile b/build/org.eclipse.cdt.make.core/templates/simple/Makefile
index bcf0bb59a77..7fe5793f75b 100644
--- a/build/org.eclipse.cdt.make.core/templates/simple/Makefile
+++ b/build/org.eclipse.cdt.make.core/templates/simple/Makefile
@@ -1,25 +1,25 @@
-PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
-
-OBJS = ${projectName}.o
-
-ifeq ($(BUILD_MODE),debug)
- CFLAGS += -g
-else ifeq ($(BUILD_MODE),run)
- CFLAGS += -O2
-else
- $(error Build mode $(BUILD_MODE) not supported by this Makefile)
-endif
-
-all: ${projectName}
-
-${projectName}: $(OBJS)
- $(CXX) -o $@ $^
-
-%.o: $(PROJECT_ROOT)%.cpp
- $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
-
-%.o: $(PROJECT_ROOT)%.c
- $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
-
-clean:
- rm -fr ${projectName} $(OBJS)
+PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+
+OBJS = ${projectName}.o
+
+ifeq ($(BUILD_MODE),debug)
+ CFLAGS += -g
+else ifeq ($(BUILD_MODE),run)
+ CFLAGS += -O2
+else
+ $(error Build mode $(BUILD_MODE) not supported by this Makefile)
+endif
+
+all: ${projectName}
+
+${projectName}: $(OBJS)
+ $(CXX) -o $@ $^
+
+%.o: $(PROJECT_ROOT)%.cpp
+ $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
+
+%.o: $(PROJECT_ROOT)%.c
+ $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
+
+clean:
+ rm -fr ${projectName} $(OBJS)
diff --git a/build/org.eclipse.cdt.make.ui.tests/.classpath b/build/org.eclipse.cdt.make.ui.tests/.classpath
index b862a296d38..eca7bdba8f0 100644
--- a/build/org.eclipse.cdt.make.ui.tests/.classpath
+++ b/build/org.eclipse.cdt.make.ui.tests/.classpath
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/build/org.eclipse.cdt.make.ui.tests/build.properties b/build/org.eclipse.cdt.make.ui.tests/build.properties
index 785a40c0ec7..9cbab3c135e 100644
--- a/build/org.eclipse.cdt.make.ui.tests/build.properties
+++ b/build/org.eclipse.cdt.make.ui.tests/build.properties
@@ -1,6 +1,6 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/AutomatedIntegrationSuite.java b/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/AutomatedIntegrationSuite.java
index d9c84daeb74..11d1a338f57 100644
--- a/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/AutomatedIntegrationSuite.java
+++ b/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/AutomatedIntegrationSuite.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2013 Andrew Gvozdev and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andrew Gvozdev - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.ui.tests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-@RunWith(Suite.class)
-@SuiteClasses({ MakeUIImagesTest.class })
-public class AutomatedIntegrationSuite {
-}
+/*******************************************************************************
+ * Copyright (c) 2013, 2013 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.ui.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({ MakeUIImagesTest.class })
+public class AutomatedIntegrationSuite {
+}
diff --git a/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUIImagesTest.java b/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUIImagesTest.java
index a03cf9f44ba..bcbc0ca0a03 100644
--- a/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUIImagesTest.java
+++ b/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUIImagesTest.java
@@ -1,118 +1,118 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2013 Andrew Gvozdev and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andrew Gvozdev - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.ui.tests;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.net.URL;
-
-import org.eclipse.cdt.make.internal.ui.MakeUIImages;
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.swt.graphics.Image;
-import org.junit.Test;
-
-public class MakeUIImagesTest {
- private static final ImageDescriptor MISSING_IMAGE_DESCRIPTOR = ImageDescriptor.getMissingImageDescriptor();
-
- // sample image (IMG_ETOOL_MAKEFILE) from MakeUIPlugin bundle
- private static final String KEY_ETOOL_MAKEFILE = MakeUIImages.IMG_ETOOL_MAKEFILE;
- private static final IPath PATH_ETOOL_MAKEFILE = new Path("icons/etool16/makefile.gif");
- private static final URL URL_ETOOL_MAKEFILE= FileLocator.find(MakeUIPlugin.getDefault().getBundle(), PATH_ETOOL_MAKEFILE, null);
-
- /**
- * Handling of missing keys.
- */
- @Test
- public void testNoImage() throws Exception {
- ImageDescriptor descriptor = MakeUIImages.getImageDescriptor("missing key 1");
- assertSame(MISSING_IMAGE_DESCRIPTOR, descriptor);
-
- Image image1 = MakeUIImages.getImage("missing key 1");
- Image image2 = MakeUIImages.getImage("missing key 2");
- assertSame(image1, image2);
- }
-
- /**
- * Test regular images.
- */
- @Test
- public void testImage() throws Exception {
- // create descriptor from MakeUIImages key
- ImageDescriptor descriptorFromKey = MakeUIImages.getImageDescriptor(KEY_ETOOL_MAKEFILE);
- assertNotSame(MISSING_IMAGE_DESCRIPTOR, descriptorFromKey);
-
- // create descriptor from registered bundle URL as a key
- MakeUIImages.register(URL_ETOOL_MAKEFILE);
- ImageDescriptor descriptorFromUrl = MakeUIImages.getImageDescriptor(URL_ETOOL_MAKEFILE.toString());
- assertNotSame(MISSING_IMAGE_DESCRIPTOR, descriptorFromUrl);
- assertSame(descriptorFromKey, descriptorFromUrl);
-
- // verify that it is the same image
- Image imageFromKey = MakeUIImages.getImage(KEY_ETOOL_MAKEFILE);
- Image imageFromUrl = MakeUIImages.getImage(URL_ETOOL_MAKEFILE.toString());
- assertSame(imageFromKey, imageFromUrl);
-
- // verify that no leaks on second access
- Image imageFromKey2 = MakeUIImages.getImage(KEY_ETOOL_MAKEFILE);
- assertSame(imageFromKey, imageFromKey2);
- }
-
- /**
- * Test images with overlays.
- */
- @Test
- public void testOverlays() throws Exception {
- {
- Image image1 = MakeUIImages.getImageOverlaid(KEY_ETOOL_MAKEFILE, new String[5]);
- Image image2 = MakeUIImages.getImage(KEY_ETOOL_MAKEFILE);
- assertSame(image1, image2);
- }
-
- {
- String[] overlayKeys = new String[5];
- overlayKeys[IDecoration.BOTTOM_LEFT] = MakeUIImages.IMG_OVR_AUTOMATIC;
- Image imageOver1 = MakeUIImages.getImageOverlaid(KEY_ETOOL_MAKEFILE, overlayKeys);
- Image imageOver2 = MakeUIImages.getImageOverlaid(KEY_ETOOL_MAKEFILE, MakeUIImages.IMG_OVR_AUTOMATIC, IDecoration.BOTTOM_LEFT);
- assertSame(imageOver1, imageOver2);
- }
- }
-
- /**
- * Verify that MakeUIImages constants define existing images.
- */
- @Test
- public void testVerifyFields() throws Exception {
- Class clazz = MakeUIImages.class;
-
- Field[] fields = clazz.getDeclaredFields();
- for (Field field : fields) {
- String name = field.getName();
- if (name.startsWith("IMG_")) {
- assertEquals("MakeUIImages."+name+" is not a String", String.class, field.getType());
- assertTrue("MakeUIImages."+name+" is not a static field", (field.getModifiers() & Modifier.STATIC) != 0);
- assertTrue("MakeUIImages."+name+" is not a public field", (field.getModifiers() & Modifier.PUBLIC) != 0);
- String imageKey = (String) field.get(null);
- ImageDescriptor descriptor = MakeUIImages.getImageDescriptor(imageKey);
- assertTrue("Missing image MakeUIImages."+name+"=\""+imageKey+"\"", descriptor!=MISSING_IMAGE_DESCRIPTOR);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013, 2013 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.ui.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+
+import org.eclipse.cdt.make.internal.ui.MakeUIImages;
+import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IDecoration;
+import org.eclipse.swt.graphics.Image;
+import org.junit.Test;
+
+public class MakeUIImagesTest {
+ private static final ImageDescriptor MISSING_IMAGE_DESCRIPTOR = ImageDescriptor.getMissingImageDescriptor();
+
+ // sample image (IMG_ETOOL_MAKEFILE) from MakeUIPlugin bundle
+ private static final String KEY_ETOOL_MAKEFILE = MakeUIImages.IMG_ETOOL_MAKEFILE;
+ private static final IPath PATH_ETOOL_MAKEFILE = new Path("icons/etool16/makefile.gif");
+ private static final URL URL_ETOOL_MAKEFILE= FileLocator.find(MakeUIPlugin.getDefault().getBundle(), PATH_ETOOL_MAKEFILE, null);
+
+ /**
+ * Handling of missing keys.
+ */
+ @Test
+ public void testNoImage() throws Exception {
+ ImageDescriptor descriptor = MakeUIImages.getImageDescriptor("missing key 1");
+ assertSame(MISSING_IMAGE_DESCRIPTOR, descriptor);
+
+ Image image1 = MakeUIImages.getImage("missing key 1");
+ Image image2 = MakeUIImages.getImage("missing key 2");
+ assertSame(image1, image2);
+ }
+
+ /**
+ * Test regular images.
+ */
+ @Test
+ public void testImage() throws Exception {
+ // create descriptor from MakeUIImages key
+ ImageDescriptor descriptorFromKey = MakeUIImages.getImageDescriptor(KEY_ETOOL_MAKEFILE);
+ assertNotSame(MISSING_IMAGE_DESCRIPTOR, descriptorFromKey);
+
+ // create descriptor from registered bundle URL as a key
+ MakeUIImages.register(URL_ETOOL_MAKEFILE);
+ ImageDescriptor descriptorFromUrl = MakeUIImages.getImageDescriptor(URL_ETOOL_MAKEFILE.toString());
+ assertNotSame(MISSING_IMAGE_DESCRIPTOR, descriptorFromUrl);
+ assertSame(descriptorFromKey, descriptorFromUrl);
+
+ // verify that it is the same image
+ Image imageFromKey = MakeUIImages.getImage(KEY_ETOOL_MAKEFILE);
+ Image imageFromUrl = MakeUIImages.getImage(URL_ETOOL_MAKEFILE.toString());
+ assertSame(imageFromKey, imageFromUrl);
+
+ // verify that no leaks on second access
+ Image imageFromKey2 = MakeUIImages.getImage(KEY_ETOOL_MAKEFILE);
+ assertSame(imageFromKey, imageFromKey2);
+ }
+
+ /**
+ * Test images with overlays.
+ */
+ @Test
+ public void testOverlays() throws Exception {
+ {
+ Image image1 = MakeUIImages.getImageOverlaid(KEY_ETOOL_MAKEFILE, new String[5]);
+ Image image2 = MakeUIImages.getImage(KEY_ETOOL_MAKEFILE);
+ assertSame(image1, image2);
+ }
+
+ {
+ String[] overlayKeys = new String[5];
+ overlayKeys[IDecoration.BOTTOM_LEFT] = MakeUIImages.IMG_OVR_AUTOMATIC;
+ Image imageOver1 = MakeUIImages.getImageOverlaid(KEY_ETOOL_MAKEFILE, overlayKeys);
+ Image imageOver2 = MakeUIImages.getImageOverlaid(KEY_ETOOL_MAKEFILE, MakeUIImages.IMG_OVR_AUTOMATIC, IDecoration.BOTTOM_LEFT);
+ assertSame(imageOver1, imageOver2);
+ }
+ }
+
+ /**
+ * Verify that MakeUIImages constants define existing images.
+ */
+ @Test
+ public void testVerifyFields() throws Exception {
+ Class clazz = MakeUIImages.class;
+
+ Field[] fields = clazz.getDeclaredFields();
+ for (Field field : fields) {
+ String name = field.getName();
+ if (name.startsWith("IMG_")) {
+ assertEquals("MakeUIImages."+name+" is not a String", String.class, field.getType());
+ assertTrue("MakeUIImages."+name+" is not a static field", (field.getModifiers() & Modifier.STATIC) != 0);
+ assertTrue("MakeUIImages."+name+" is not a public field", (field.getModifiers() & Modifier.PUBLIC) != 0);
+ String imageKey = (String) field.get(null);
+ ImageDescriptor descriptor = MakeUIImages.getImageDescriptor(imageKey);
+ assertTrue("Missing image MakeUIImages."+name+"=\""+imageKey+"\"", descriptor!=MISSING_IMAGE_DESCRIPTOR);
+ }
+ }
+ }
+}
diff --git a/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUITestBase.java b/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUITestBase.java
index cca0e43d7f8..82e00fc5529 100644
--- a/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUITestBase.java
+++ b/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUITestBase.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2013 Andrew Gvozdev and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andrew Gvozdev - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.ui.tests;
-
-import java.io.IOException;
-
-import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-
-/**
- * Base for unit testing of Make UI test suite.
- */
-public class MakeUITestBase {
- @Rule
- public TestName testNameRule = new TestName();
- private TestSourceReader commentReader;
-
- /**
- * Constructor.
- */
- protected MakeUITestBase() {
- this("src");
- }
-
- /**
- * Constructor.
- *
- * @param srcRoot - project folder where the test package is rooted.
- */
- protected MakeUITestBase(String srcRoot) {
- this.commentReader = new TestSourceReader(MakeUITestsPlugin.getDefault().getBundle(), srcRoot, this.getClass(), 1);
- }
-
- /**
- * Get name of the current test method.
- *
- * @return Name of the current test method.
- */
- public String getName() {
- return testNameRule.getMethodName();
- }
-
- /**
- * Retrieve comments above the current test method.
- *
- * @return First section of comments above the current test method.
- * A sections is defined as a block of comments starting with "//". Sections are separated by empty lines.
- * @throws IOException
- */
- public StringBuilder getTestComments() throws IOException {
- return commentReader.getContentsForTest(getName())[0];
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2013, 2013 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.ui.tests;
+
+import java.io.IOException;
+
+import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
+/**
+ * Base for unit testing of Make UI test suite.
+ */
+public class MakeUITestBase {
+ @Rule
+ public TestName testNameRule = new TestName();
+ private TestSourceReader commentReader;
+
+ /**
+ * Constructor.
+ */
+ protected MakeUITestBase() {
+ this("src");
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param srcRoot - project folder where the test package is rooted.
+ */
+ protected MakeUITestBase(String srcRoot) {
+ this.commentReader = new TestSourceReader(MakeUITestsPlugin.getDefault().getBundle(), srcRoot, this.getClass(), 1);
+ }
+
+ /**
+ * Get name of the current test method.
+ *
+ * @return Name of the current test method.
+ */
+ public String getName() {
+ return testNameRule.getMethodName();
+ }
+
+ /**
+ * Retrieve comments above the current test method.
+ *
+ * @return First section of comments above the current test method.
+ * A sections is defined as a block of comments starting with "//". Sections are separated by empty lines.
+ * @throws IOException
+ */
+ public StringBuilder getTestComments() throws IOException {
+ return commentReader.getContentsForTest(getName())[0];
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUITestsPlugin.java b/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUITestsPlugin.java
index 2c7eba97068..7c926fbce08 100644
--- a/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUITestsPlugin.java
+++ b/build/org.eclipse.cdt.make.ui.tests/src/org/eclipse/cdt/make/ui/tests/MakeUITestsPlugin.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2013 Andrew Gvozdev and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andrew Gvozdev - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.ui.tests;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class MakeUITestsPlugin extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.cdt.make.ui.tests"; //$NON-NLS-1$
-
- // The shared instance
- private static MakeUITestsPlugin plugin;
-
- /**
- * The constructor
- */
- public MakeUITestsPlugin() {
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static MakeUITestsPlugin getDefault() {
- return plugin;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2013, 2013 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.ui.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class MakeUITestsPlugin extends AbstractUIPlugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.make.ui.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static MakeUITestsPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public MakeUITestsPlugin() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static MakeUITestsPlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java
index 8caf73f4d01..5b82dd4f221 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeBuildSettingsTab.java
@@ -1,214 +1,214 @@
-/*******************************************************************************
- * Copyright (c) 2017 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui;
-
-import java.util.Map;
-
-import org.eclipse.cdt.core.build.ICBuildConfiguration;
-import org.eclipse.cdt.core.build.StandardBuildConfiguration;
-import org.eclipse.cdt.launch.ui.corebuild.CommonBuildTab;
-import org.eclipse.cdt.make.core.MakefileBuildConfigurationProvider;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-public class MakeBuildSettingsTab extends CommonBuildTab {
-
- private Button projectButton;
- private Button configButton;
- private Text buildCmdText;
- private Text cleanCmdText;
-
- private boolean defaultProject;
-
- @Override
- protected String getBuildConfigProviderId() {
- return MakefileBuildConfigurationProvider.ID;
- }
-
- @Override
- public void createControl(Composite parent) {
- Composite comp = new Composite(parent, SWT.NONE);
- comp.setLayout(new GridLayout());
- setControl(comp);
-
- // Toolchain selector
- Control tcControl = createToolchainSelector(comp);
- tcControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- // Build Output Group
- Group outputGroup = new Group(comp, SWT.NONE);
- outputGroup.setText(Messages.MakeBuildSettingsTab_BuildOutputLocation);
- outputGroup.setLayout(new GridLayout());
- outputGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- projectButton = new Button(outputGroup, SWT.RADIO);
- projectButton.setText(Messages.MakeBuildSettingsTab_BuildInProjectDir);
- projectButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- configButton = new Button(outputGroup, SWT.RADIO);
- configButton.setText(Messages.MakeBuildSettingsTab_BuildInConfigDir);
- configButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- Group cmdGroup = new Group(comp, SWT.NONE);
- cmdGroup.setText(Messages.MakeBuildSettingsTab_BuildCommands);
- cmdGroup.setLayout(new GridLayout(2, false));
- cmdGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- Label label = new Label(cmdGroup, SWT.NONE);
- label.setText(Messages.MakeBuildSettingsTab_Build);
-
- buildCmdText = new Text(cmdGroup, SWT.BORDER);
- buildCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- label = new Label(cmdGroup, SWT.NONE);
- label.setText(Messages.MakeBuildSettingsTab_Clean);
-
- cleanCmdText = new Text(cmdGroup, SWT.BORDER);
- cleanCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- }
-
- @Override
- public String getName() {
- return Messages.MakeBuildSettingsTab_Makefile;
- }
-
- @Override
- protected void restoreProperties(Map properties) {
- // TODO Auto-generated method stub
- super.restoreProperties(properties);
-
- String container = properties.get(StandardBuildConfiguration.BUILD_CONTAINER);
- if (container != null && !container.trim().isEmpty()) {
- IPath containerLoc = new Path(container);
- if (containerLoc.segmentCount() == 1) {
- // TODO what if it's not the project?
- projectButton.setSelection(true);
- defaultProject = true;
- } else {
- configButton.setSelection(true);
- defaultProject = false;
- }
- }
-
- String buildCommand = properties.get(StandardBuildConfiguration.BUILD_COMMAND);
- if (buildCommand != null && !buildCommand.trim().isEmpty()) {
- buildCmdText.setText(buildCommand);
- }
-
- String cleanCommand = properties.get(StandardBuildConfiguration.CLEAN_COMMAND);
- if (cleanCommand != null && !cleanCommand.trim().isEmpty()) {
- cleanCmdText.setText(cleanCommand);
- }
- }
-
- @Override
- protected void saveProperties(Map properties) {
- super.saveProperties(properties);
-
- try {
- ICBuildConfiguration buildConfig = getBuildConfiguration();
- if (buildConfig instanceof StandardBuildConfiguration) {
- StandardBuildConfiguration stdConfig = (StandardBuildConfiguration) buildConfig;
- if (defaultProject && !projectButton.getSelection()) {
- properties.put(StandardBuildConfiguration.BUILD_CONTAINER,
- stdConfig.getDefaultBuildContainer().getFullPath().toString());
- } else if (!defaultProject && projectButton.getSelection()) {
- properties.put(StandardBuildConfiguration.BUILD_CONTAINER,
- stdConfig.getProject().getFullPath().toString());
- }
-
- String buildCommand = buildCmdText.getText().trim();
- if (!buildCommand.isEmpty()) {
- properties.put(StandardBuildConfiguration.BUILD_COMMAND, buildCommand);
- }
-
- String cleanCommand = cleanCmdText.getText().trim();
- if (!cleanCommand.isEmpty()) {
- properties.put(StandardBuildConfiguration.CLEAN_COMMAND, cleanCommand);
- }
- }
- } catch (CoreException e) {
- MakeUIPlugin.log(e.getStatus());
- }
- }
-
- @Override
- public void initializeFrom(ILaunchConfiguration configuration) {
- super.initializeFrom(configuration);
-
- ICBuildConfiguration buildConfig = getBuildConfiguration();
- String container = buildConfig.getProperty(StandardBuildConfiguration.BUILD_CONTAINER);
- if (container != null && !container.trim().isEmpty()) {
- IPath containerLoc = new Path(container);
- if (containerLoc.segmentCount() == 1) {
- // TODO what if it's not the project?
- projectButton.setSelection(true);
- defaultProject = true;
- } else {
- configButton.setSelection(true);
- defaultProject = false;
- }
- }
-
- String buildCommand = buildConfig.getProperty(StandardBuildConfiguration.BUILD_COMMAND);
- if (buildCommand != null && !buildCommand.trim().isEmpty()) {
- buildCmdText.setText(buildCommand);
- }
-
- String cleanCommand = buildConfig.getProperty(StandardBuildConfiguration.CLEAN_COMMAND);
- if (cleanCommand != null && !cleanCommand.trim().isEmpty()) {
- cleanCmdText.setText(cleanCommand);
- }
- }
-
- @Override
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- super.performApply(configuration);
-
- try {
- ICBuildConfiguration buildConfig = getBuildConfiguration();
- if (buildConfig instanceof StandardBuildConfiguration) {
- StandardBuildConfiguration stdConfig = (StandardBuildConfiguration) buildConfig;
- if (defaultProject && !projectButton.getSelection()) {
- stdConfig.setBuildContainer(stdConfig.getDefaultBuildContainer());
- } else if (!defaultProject && projectButton.getSelection()) {
- stdConfig.setBuildContainer(stdConfig.getProject());
- }
-
- String buildCommand = buildCmdText.getText().trim();
- if (!buildCommand.isEmpty()) {
- stdConfig.setBuildCommand(buildCommand.split(" ")); //$NON-NLS-1$
- } else {
- stdConfig.setBuildCommand(null);
- }
-
- String cleanCommand = cleanCmdText.getText().trim();
- if (!cleanCommand.isEmpty()) {
- stdConfig.setCleanCommand(cleanCommand.split(" ")); //$NON-NLS-1$
- } else {
- stdConfig.setCleanCommand(null);
- }
- }
- } catch (CoreException e) {
- MakeUIPlugin.log(e.getStatus());
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.ui;
+
+import java.util.Map;
+
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
+import org.eclipse.cdt.core.build.StandardBuildConfiguration;
+import org.eclipse.cdt.launch.ui.corebuild.CommonBuildTab;
+import org.eclipse.cdt.make.core.MakefileBuildConfigurationProvider;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class MakeBuildSettingsTab extends CommonBuildTab {
+
+ private Button projectButton;
+ private Button configButton;
+ private Text buildCmdText;
+ private Text cleanCmdText;
+
+ private boolean defaultProject;
+
+ @Override
+ protected String getBuildConfigProviderId() {
+ return MakefileBuildConfigurationProvider.ID;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ comp.setLayout(new GridLayout());
+ setControl(comp);
+
+ // Toolchain selector
+ Control tcControl = createToolchainSelector(comp);
+ tcControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ // Build Output Group
+ Group outputGroup = new Group(comp, SWT.NONE);
+ outputGroup.setText(Messages.MakeBuildSettingsTab_BuildOutputLocation);
+ outputGroup.setLayout(new GridLayout());
+ outputGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ projectButton = new Button(outputGroup, SWT.RADIO);
+ projectButton.setText(Messages.MakeBuildSettingsTab_BuildInProjectDir);
+ projectButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ configButton = new Button(outputGroup, SWT.RADIO);
+ configButton.setText(Messages.MakeBuildSettingsTab_BuildInConfigDir);
+ configButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Group cmdGroup = new Group(comp, SWT.NONE);
+ cmdGroup.setText(Messages.MakeBuildSettingsTab_BuildCommands);
+ cmdGroup.setLayout(new GridLayout(2, false));
+ cmdGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ Label label = new Label(cmdGroup, SWT.NONE);
+ label.setText(Messages.MakeBuildSettingsTab_Build);
+
+ buildCmdText = new Text(cmdGroup, SWT.BORDER);
+ buildCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ label = new Label(cmdGroup, SWT.NONE);
+ label.setText(Messages.MakeBuildSettingsTab_Clean);
+
+ cleanCmdText = new Text(cmdGroup, SWT.BORDER);
+ cleanCmdText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ }
+
+ @Override
+ public String getName() {
+ return Messages.MakeBuildSettingsTab_Makefile;
+ }
+
+ @Override
+ protected void restoreProperties(Map properties) {
+ // TODO Auto-generated method stub
+ super.restoreProperties(properties);
+
+ String container = properties.get(StandardBuildConfiguration.BUILD_CONTAINER);
+ if (container != null && !container.trim().isEmpty()) {
+ IPath containerLoc = new Path(container);
+ if (containerLoc.segmentCount() == 1) {
+ // TODO what if it's not the project?
+ projectButton.setSelection(true);
+ defaultProject = true;
+ } else {
+ configButton.setSelection(true);
+ defaultProject = false;
+ }
+ }
+
+ String buildCommand = properties.get(StandardBuildConfiguration.BUILD_COMMAND);
+ if (buildCommand != null && !buildCommand.trim().isEmpty()) {
+ buildCmdText.setText(buildCommand);
+ }
+
+ String cleanCommand = properties.get(StandardBuildConfiguration.CLEAN_COMMAND);
+ if (cleanCommand != null && !cleanCommand.trim().isEmpty()) {
+ cleanCmdText.setText(cleanCommand);
+ }
+ }
+
+ @Override
+ protected void saveProperties(Map properties) {
+ super.saveProperties(properties);
+
+ try {
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
+ if (buildConfig instanceof StandardBuildConfiguration) {
+ StandardBuildConfiguration stdConfig = (StandardBuildConfiguration) buildConfig;
+ if (defaultProject && !projectButton.getSelection()) {
+ properties.put(StandardBuildConfiguration.BUILD_CONTAINER,
+ stdConfig.getDefaultBuildContainer().getFullPath().toString());
+ } else if (!defaultProject && projectButton.getSelection()) {
+ properties.put(StandardBuildConfiguration.BUILD_CONTAINER,
+ stdConfig.getProject().getFullPath().toString());
+ }
+
+ String buildCommand = buildCmdText.getText().trim();
+ if (!buildCommand.isEmpty()) {
+ properties.put(StandardBuildConfiguration.BUILD_COMMAND, buildCommand);
+ }
+
+ String cleanCommand = cleanCmdText.getText().trim();
+ if (!cleanCommand.isEmpty()) {
+ properties.put(StandardBuildConfiguration.CLEAN_COMMAND, cleanCommand);
+ }
+ }
+ } catch (CoreException e) {
+ MakeUIPlugin.log(e.getStatus());
+ }
+ }
+
+ @Override
+ public void initializeFrom(ILaunchConfiguration configuration) {
+ super.initializeFrom(configuration);
+
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
+ String container = buildConfig.getProperty(StandardBuildConfiguration.BUILD_CONTAINER);
+ if (container != null && !container.trim().isEmpty()) {
+ IPath containerLoc = new Path(container);
+ if (containerLoc.segmentCount() == 1) {
+ // TODO what if it's not the project?
+ projectButton.setSelection(true);
+ defaultProject = true;
+ } else {
+ configButton.setSelection(true);
+ defaultProject = false;
+ }
+ }
+
+ String buildCommand = buildConfig.getProperty(StandardBuildConfiguration.BUILD_COMMAND);
+ if (buildCommand != null && !buildCommand.trim().isEmpty()) {
+ buildCmdText.setText(buildCommand);
+ }
+
+ String cleanCommand = buildConfig.getProperty(StandardBuildConfiguration.CLEAN_COMMAND);
+ if (cleanCommand != null && !cleanCommand.trim().isEmpty()) {
+ cleanCmdText.setText(cleanCommand);
+ }
+ }
+
+ @Override
+ public void performApply(ILaunchConfigurationWorkingCopy configuration) {
+ super.performApply(configuration);
+
+ try {
+ ICBuildConfiguration buildConfig = getBuildConfiguration();
+ if (buildConfig instanceof StandardBuildConfiguration) {
+ StandardBuildConfiguration stdConfig = (StandardBuildConfiguration) buildConfig;
+ if (defaultProject && !projectButton.getSelection()) {
+ stdConfig.setBuildContainer(stdConfig.getDefaultBuildContainer());
+ } else if (!defaultProject && projectButton.getSelection()) {
+ stdConfig.setBuildContainer(stdConfig.getProject());
+ }
+
+ String buildCommand = buildCmdText.getText().trim();
+ if (!buildCommand.isEmpty()) {
+ stdConfig.setBuildCommand(buildCommand.split(" ")); //$NON-NLS-1$
+ } else {
+ stdConfig.setBuildCommand(null);
+ }
+
+ String cleanCommand = cleanCmdText.getText().trim();
+ if (!cleanCommand.isEmpty()) {
+ stdConfig.setCleanCommand(cleanCommand.split(" ")); //$NON-NLS-1$
+ } else {
+ stdConfig.setCleanCommand(null);
+ }
+ }
+ } catch (CoreException e) {
+ MakeUIPlugin.log(e.getStatus());
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/Messages.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/Messages.java
index cfc24769b6e..9a9af8bbdd2 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/Messages.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/Messages.java
@@ -1,21 +1,21 @@
-package org.eclipse.cdt.make.internal.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.cdt.make.internal.ui.messages"; //$NON-NLS-1$
- public static String MakeBuildSettingsTab_Build;
- public static String MakeBuildSettingsTab_BuildCommands;
- public static String MakeBuildSettingsTab_BuildInConfigDir;
- public static String MakeBuildSettingsTab_BuildInProjectDir;
- public static String MakeBuildSettingsTab_BuildOutputLocation;
- public static String MakeBuildSettingsTab_Clean;
- public static String MakeBuildSettingsTab_Makefile;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+package org.eclipse.cdt.make.internal.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.make.internal.ui.messages"; //$NON-NLS-1$
+ public static String MakeBuildSettingsTab_Build;
+ public static String MakeBuildSettingsTab_BuildCommands;
+ public static String MakeBuildSettingsTab_BuildInConfigDir;
+ public static String MakeBuildSettingsTab_BuildInProjectDir;
+ public static String MakeBuildSettingsTab_BuildOutputLocation;
+ public static String MakeBuildSettingsTab_Clean;
+ public static String MakeBuildSettingsTab_Makefile;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/messages.properties b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/messages.properties
index 0b143a70f3d..30e41542d70 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/messages.properties
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/messages.properties
@@ -1,7 +1,7 @@
-MakeBuildSettingsTab_Build=Build:
-MakeBuildSettingsTab_BuildCommands=Build Commands
-MakeBuildSettingsTab_BuildInConfigDir=Build in configuration specific directory
-MakeBuildSettingsTab_BuildInProjectDir=Build in project directory
-MakeBuildSettingsTab_BuildOutputLocation=Build Output Location
-MakeBuildSettingsTab_Clean=Clean:
-MakeBuildSettingsTab_Makefile=Makefile
+MakeBuildSettingsTab_Build=Build:
+MakeBuildSettingsTab_BuildCommands=Build Commands
+MakeBuildSettingsTab_BuildInConfigDir=Build in configuration specific directory
+MakeBuildSettingsTab_BuildInProjectDir=Build in project directory
+MakeBuildSettingsTab_BuildOutputLocation=Build Output Location
+MakeBuildSettingsTab_Clean=Clean:
+MakeBuildSettingsTab_Makefile=Makefile
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/NewMakefileProjectWizard.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/NewMakefileProjectWizard.java
index 183556dfe68..f9aaa3a1ac7 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/NewMakefileProjectWizard.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/wizards/NewMakefileProjectWizard.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2017 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.ui.wizards;
-
-import org.eclipse.cdt.make.core.MakefileProjectGenerator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tools.templates.core.IGenerator;
-import org.eclipse.tools.templates.ui.TemplateWizard;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-public class NewMakefileProjectWizard extends TemplateWizard {
-
- private WizardNewProjectCreationPage mainPage;
- private boolean generateSource = true;
-
- @Override
- public void setContainer(IWizardContainer wizardContainer) {
- super.setContainer(wizardContainer);
- setWindowTitle("New Makefile Project");
- }
-
- @Override
- public void addPages() {
- mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$
- @Override
- public void createControl(Composite parent) {
- super.createControl(parent);
- Composite comp = (Composite) getControl();
- createWorkingSetGroup(comp, getSelection(),
- new String[] { "org.eclipse.ui.resourceWorkingSetPage" }); //$NON-NLS-1$
-
- Composite buttonComp = new Composite(comp, SWT.NONE);
- buttonComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- buttonComp.setLayout(new GridLayout());
-
- Button genSourceButton = new Button(buttonComp, SWT.CHECK);
- genSourceButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- genSourceButton.setText("Generate Source and Makefile");
- genSourceButton.setSelection(generateSource);
- genSourceButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- generateSource = genSourceButton.getSelection();
- }
- });
- Dialog.applyDialogFont(getControl());
- }
- };
- mainPage.setTitle("New Makefile Project");
- mainPage.setDescription("Specify properties of new Makefile project.");
- this.addPage(mainPage);
- }
-
- @Override
- protected IGenerator getGenerator() {
- String manifest = generateSource ? "templates/simple/manifest.xml" : null; //$NON-NLS-1$
- MakefileProjectGenerator generator = new MakefileProjectGenerator(manifest);
- generator.setProjectName(mainPage.getProjectName());
- if (!mainPage.useDefaults()) {
- generator.setLocationURI(mainPage.getLocationURI());
- }
- return generator;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.ui.wizards;
+
+import org.eclipse.cdt.make.core.MakefileProjectGenerator;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tools.templates.core.IGenerator;
+import org.eclipse.tools.templates.ui.TemplateWizard;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+
+public class NewMakefileProjectWizard extends TemplateWizard {
+
+ private WizardNewProjectCreationPage mainPage;
+ private boolean generateSource = true;
+
+ @Override
+ public void setContainer(IWizardContainer wizardContainer) {
+ super.setContainer(wizardContainer);
+ setWindowTitle("New Makefile Project");
+ }
+
+ @Override
+ public void addPages() {
+ mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ Composite comp = (Composite) getControl();
+ createWorkingSetGroup(comp, getSelection(),
+ new String[] { "org.eclipse.ui.resourceWorkingSetPage" }); //$NON-NLS-1$
+
+ Composite buttonComp = new Composite(comp, SWT.NONE);
+ buttonComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ buttonComp.setLayout(new GridLayout());
+
+ Button genSourceButton = new Button(buttonComp, SWT.CHECK);
+ genSourceButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ genSourceButton.setText("Generate Source and Makefile");
+ genSourceButton.setSelection(generateSource);
+ genSourceButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ generateSource = genSourceButton.getSelection();
+ }
+ });
+ Dialog.applyDialogFont(getControl());
+ }
+ };
+ mainPage.setTitle("New Makefile Project");
+ mainPage.setDescription("Specify properties of new Makefile project.");
+ this.addPage(mainPage);
+ }
+
+ @Override
+ protected IGenerator getGenerator() {
+ String manifest = generateSource ? "templates/simple/manifest.xml" : null; //$NON-NLS-1$
+ MakefileProjectGenerator generator = new MakefileProjectGenerator(manifest);
+ generator.setProjectName(mainPage.getProjectName());
+ if (!mainPage.useDefaults()) {
+ generator.setLocationURI(mainPage.getLocationURI());
+ }
+ return generator;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyLibsTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyLibsTests.java
index 965ee5a0438..af78d7c8a9a 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyLibsTests.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyLibsTests.java
@@ -1,294 +1,294 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.managedbuilder.core.tests;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.managedbuilder.core.IBuilder;
-import org.eclipse.cdt.managedbuilder.core.IConfiguration;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.IToolChain;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
-import org.eclipse.cdt.managedbuilder.tcmodification.IConfigurationModification;
-import org.eclipse.cdt.managedbuilder.tcmodification.IToolChainModificationManager;
-import org.eclipse.cdt.managedbuilder.testplugin.AbstractBuilderTest;
-import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-public class ManagedBuildDependencyLibsTests extends AbstractBuilderTest {
- private static final String PROJ_PATH = "depLibsProjects";
- private static final String MESSAGE_TAIL = " (see .log file for more details).";
-
- private IProject fTapp, fTlib, fTobjs;
-
- private IToolChain[] allToolChains;
-
- public ManagedBuildDependencyLibsTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- TestSuite suite = new TestSuite(ManagedBuildDependencyLibsTests.class.getName());
-
- suite.addTest(new ManagedBuildDependencyLibsTests("testDepLibs"));
- suite.addTest(new ManagedBuildDependencyLibsTests("testDepUObjs"));
- suite.addTest(new ManagedBuildDependencyLibsTests("testGetArtifactTimeStampEscapeURI_bug377295"));
- return suite;
- }
-
- private void buildProject(IProject curProject) {
-
- try {
- IProject[] referencedProjects = curProject.getReferencedProjects();
- for(int i = 0; i < referencedProjects.length; ++i)
- buildProject(referencedProjects[i]);
-
- // Build the project in order to generate the makefiles
- curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,new NullProgressMonitor());
- }
- catch(CoreException e){
- fail(e.getStatus().getMessage());
- }
- catch(OperationCanceledException e){
- fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + e.getMessage());
- }
-
-
- }
-
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- allToolChains = ManagedBuildManager.
- getRealToolChains();
- IWorkspaceDescription wsDescription = ResourcesPlugin.getWorkspace().getDescription();
- wsDescription.setAutoBuilding(false);
- ResourcesPlugin.getWorkspace().setDescription(wsDescription);
- assertNotNull("Cannot create tapp project",
- fTapp = ManagedBuildTestHelper.loadProject("tapp", PROJ_PATH));
- assertNotNull("Cannot create tlib project",
- fTlib = ManagedBuildTestHelper.loadProject("tlib", PROJ_PATH));
- assertNotNull("Cannot create tobjs project",
- fTobjs = ManagedBuildTestHelper.loadProject("tobjs", PROJ_PATH));
- IProjectDescription projDescription = fTapp.getDescription();
- projDescription.setReferencedProjects(new IProject[]
- {fTlib, fTobjs});
- fTapp.setDescription(projDescription, new NullProgressMonitor());
- IToolChain toolChain = setToolChain(fTapp, null);
- assertNotNull("No compatible tool chain.", toolChain);
- setToolChain(fTlib, toolChain);
- setToolChain(fTobjs, toolChain);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- ManagedBuildTestHelper.removeProject(fTapp.getName());
- ManagedBuildTestHelper.removeProject(fTlib.getName());
- ManagedBuildTestHelper.removeProject(fTobjs.getName());
- }
-
- private void findFiles(IResource dir, String pattern, List files) {
- IResource resource = null;
- try {
- IResource[] members;
- if(dir instanceof IContainer)
- members = ((IContainer)dir).members(IFolder.INCLUDE_PHANTOMS);
- else
- if(dir instanceof IFolder)
- members = ((IFolder)dir).members(IFolder.INCLUDE_PHANTOMS);
- else // Not possible
- return;
- for(int i = 0; i < members.length; ++i) {
- resource = members[i];
- if(resource.getType() == IResource.FOLDER)
- findFiles(resource, pattern, files);
- else {
- if(resource.getName().matches(pattern))
- files.add((IFile)resource);
- }
- }
- } catch (CoreException e) {
- e.printStackTrace();
- fail("Error while collecting files." + MESSAGE_TAIL);
- }
- }
-
- private IToolChain setToolChain(IProject project, IToolChain setTo) {
- try {
- IConfiguration cfg = getProjectConfiguration(project);
- IToolChain currentToolChain = cfg.getToolChain();
-
- IToolChainModificationManager mngr =
- ManagedBuildManager.getToolChainModificationManager();
- IConfigurationModification cfgM =
- (IConfigurationModification)mngr.
- createModification(cfg.getRootFolderInfo());
- FolderInfo folderInfo = (FolderInfo)cfg.getRootFolderInfo();
-
- if(setTo == null) {
- for(int i = 0; i < allToolChains.length; ++i) {
- // If predefined tool chain supported, leave it alone
- if(allToolChains[i].equals(currentToolChain))
- return currentToolChain;
- // In the same loop try to find compatible tool chain
- if(setTo == null) {
- IBuilder builder = allToolChains[i].getBuilder();
- if(cfg.isBuilderCompatible(builder) &&
- folderInfo.isToolChainCompatible(allToolChains[i]))
- setTo = allToolChains[i];
- }
- }
- }
- if(null != setTo) {
- cfgM.setToolChain(setTo);
- assertEquals(setTo, cfgM.getToolChain());
- assertEquals(setTo.getBuilder(), cfgM.getBuilder());
- }
- } catch (CoreException e) {
- e.printStackTrace();
- fail("Error. " + MESSAGE_TAIL);
- }
- return setTo;
- }
-
- private IConfiguration getProjectConfiguration(IProject project) throws CoreException {
- ICProjectDescription cProjDescription = CoreModel.getDefault().
- createProjectDescription(project, true);
- return ManagedBuildManager.
- getConfigurationForDescription(
- cProjDescription.getConfigurations()[0]);
-
- }
-
- private void rebuildArtefact(IProject project) {
-// deleteFiles(getProjectFolder(project),
-// getArtefactFullName(project),
-// new NullProgressMonitor());
- try {
- project.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
- } catch (CoreException e) {
- e.printStackTrace();
- fail("Cannot clean project " + fTapp.getName() + '.' + MESSAGE_TAIL);
- }
- buildProject(project);
- }
-
- private long getArtifactTimeStamp(IProject project) {
- List files = new ArrayList();
- findFiles(project, getArtefactFullName(project), files);
- if(files.size() == 0) // File not exists
- return 0;
- IFile artefact = files.iterator().next();
- return artefact.getModificationStamp();
- }
-
- private String getArtefactFullName(IProject project) {
- IConfiguration cfg = null;
- try {
- cfg = getProjectConfiguration(project);
- } catch (CoreException e) {
- e.printStackTrace();
- fail("Error. " + MESSAGE_TAIL);
- }
- String name = cfg.getArtifactName();
- String ext = cfg.getArtifactExtension();
- if((null != ext) && (ext.length() > 0)) {
- name += '.';
- name += ext;
- }
- return name;
- }
-
-
- public void testDepLibs() {
- buildProject(fTapp);
- long timeStamp = getArtifactTimeStamp(fTapp);
- if(timeStamp == 0) {
- fail("Cannot build project " + fTapp.getName());
- }
- try { // To be sure that in case of build the time should be changed
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // Do nothing
- }
- // Check if no build any more
- buildProject(fTapp);
- if(timeStamp != getArtifactTimeStamp(fTapp)) {
- fail("Error. This time it should be nothing to build");
- }
- rebuildArtefact(fTlib);
- buildProject(fTapp);
- if(timeStamp == getArtifactTimeStamp(fTapp)) {
- fail("Error. This time it should build application.");
- }
- }
-
- public void testDepUObjs() {
- buildProject(fTapp);
- long timeStamp = getArtifactTimeStamp(fTapp);
- if(timeStamp == 0) {
- fail("Cannot build project " + fTapp.getName());
- }
- try { // To be sure that in case of build the time should be changed
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // Do nothing
- }
- // Check if no build any more
- buildProject(fTapp);
- if(timeStamp != getArtifactTimeStamp(fTapp)) {
- fail("Error. This time it should be nothing to build");
- }
-// deleteFiles(getProjectFolder(fTobjs), "*.o", new NullProgressMonitor());
- rebuildArtefact(fTobjs);
- buildProject(fTapp);
- if(timeStamp == getArtifactTimeStamp(fTapp)) {
- fail("Error. This time it should build application.");
- }
- }
-
- // Tests that the URI used to get the time stamp of the artifact is escaped correctly
- // See AdditionalInput.getArtifactTimeStamp(IToolChain toolChain)
- public void testGetArtifactTimeStampEscapeURI_bug377295() throws CoreException {
- setWorkspace("regressions");
- final IProject project = loadProject("helloworldC");
- IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
- IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
- for (IConfiguration configuration : configs) {
- configuration.setArtifactName("test [377295]");
- }
-
- project.build(IncrementalProjectBuilder.FULL_BUILD, null);
- // This will trigger AdditionalInput.getArtifactTimeStamp to get called, no IllegalArgumentException should be thrown
- project.build(IncrementalProjectBuilder.FULL_BUILD, null);
- }
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.core.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
+import org.eclipse.cdt.managedbuilder.tcmodification.IConfigurationModification;
+import org.eclipse.cdt.managedbuilder.tcmodification.IToolChainModificationManager;
+import org.eclipse.cdt.managedbuilder.testplugin.AbstractBuilderTest;
+import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+
+public class ManagedBuildDependencyLibsTests extends AbstractBuilderTest {
+ private static final String PROJ_PATH = "depLibsProjects";
+ private static final String MESSAGE_TAIL = " (see .log file for more details).";
+
+ private IProject fTapp, fTlib, fTobjs;
+
+ private IToolChain[] allToolChains;
+
+ public ManagedBuildDependencyLibsTests(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(ManagedBuildDependencyLibsTests.class.getName());
+
+ suite.addTest(new ManagedBuildDependencyLibsTests("testDepLibs"));
+ suite.addTest(new ManagedBuildDependencyLibsTests("testDepUObjs"));
+ suite.addTest(new ManagedBuildDependencyLibsTests("testGetArtifactTimeStampEscapeURI_bug377295"));
+ return suite;
+ }
+
+ private void buildProject(IProject curProject) {
+
+ try {
+ IProject[] referencedProjects = curProject.getReferencedProjects();
+ for(int i = 0; i < referencedProjects.length; ++i)
+ buildProject(referencedProjects[i]);
+
+ // Build the project in order to generate the makefiles
+ curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,new NullProgressMonitor());
+ }
+ catch(CoreException e){
+ fail(e.getStatus().getMessage());
+ }
+ catch(OperationCanceledException e){
+ fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + e.getMessage());
+ }
+
+
+ }
+
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ allToolChains = ManagedBuildManager.
+ getRealToolChains();
+ IWorkspaceDescription wsDescription = ResourcesPlugin.getWorkspace().getDescription();
+ wsDescription.setAutoBuilding(false);
+ ResourcesPlugin.getWorkspace().setDescription(wsDescription);
+ assertNotNull("Cannot create tapp project",
+ fTapp = ManagedBuildTestHelper.loadProject("tapp", PROJ_PATH));
+ assertNotNull("Cannot create tlib project",
+ fTlib = ManagedBuildTestHelper.loadProject("tlib", PROJ_PATH));
+ assertNotNull("Cannot create tobjs project",
+ fTobjs = ManagedBuildTestHelper.loadProject("tobjs", PROJ_PATH));
+ IProjectDescription projDescription = fTapp.getDescription();
+ projDescription.setReferencedProjects(new IProject[]
+ {fTlib, fTobjs});
+ fTapp.setDescription(projDescription, new NullProgressMonitor());
+ IToolChain toolChain = setToolChain(fTapp, null);
+ assertNotNull("No compatible tool chain.", toolChain);
+ setToolChain(fTlib, toolChain);
+ setToolChain(fTobjs, toolChain);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ ManagedBuildTestHelper.removeProject(fTapp.getName());
+ ManagedBuildTestHelper.removeProject(fTlib.getName());
+ ManagedBuildTestHelper.removeProject(fTobjs.getName());
+ }
+
+ private void findFiles(IResource dir, String pattern, List files) {
+ IResource resource = null;
+ try {
+ IResource[] members;
+ if(dir instanceof IContainer)
+ members = ((IContainer)dir).members(IFolder.INCLUDE_PHANTOMS);
+ else
+ if(dir instanceof IFolder)
+ members = ((IFolder)dir).members(IFolder.INCLUDE_PHANTOMS);
+ else // Not possible
+ return;
+ for(int i = 0; i < members.length; ++i) {
+ resource = members[i];
+ if(resource.getType() == IResource.FOLDER)
+ findFiles(resource, pattern, files);
+ else {
+ if(resource.getName().matches(pattern))
+ files.add((IFile)resource);
+ }
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ fail("Error while collecting files." + MESSAGE_TAIL);
+ }
+ }
+
+ private IToolChain setToolChain(IProject project, IToolChain setTo) {
+ try {
+ IConfiguration cfg = getProjectConfiguration(project);
+ IToolChain currentToolChain = cfg.getToolChain();
+
+ IToolChainModificationManager mngr =
+ ManagedBuildManager.getToolChainModificationManager();
+ IConfigurationModification cfgM =
+ (IConfigurationModification)mngr.
+ createModification(cfg.getRootFolderInfo());
+ FolderInfo folderInfo = (FolderInfo)cfg.getRootFolderInfo();
+
+ if(setTo == null) {
+ for(int i = 0; i < allToolChains.length; ++i) {
+ // If predefined tool chain supported, leave it alone
+ if(allToolChains[i].equals(currentToolChain))
+ return currentToolChain;
+ // In the same loop try to find compatible tool chain
+ if(setTo == null) {
+ IBuilder builder = allToolChains[i].getBuilder();
+ if(cfg.isBuilderCompatible(builder) &&
+ folderInfo.isToolChainCompatible(allToolChains[i]))
+ setTo = allToolChains[i];
+ }
+ }
+ }
+ if(null != setTo) {
+ cfgM.setToolChain(setTo);
+ assertEquals(setTo, cfgM.getToolChain());
+ assertEquals(setTo.getBuilder(), cfgM.getBuilder());
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ fail("Error. " + MESSAGE_TAIL);
+ }
+ return setTo;
+ }
+
+ private IConfiguration getProjectConfiguration(IProject project) throws CoreException {
+ ICProjectDescription cProjDescription = CoreModel.getDefault().
+ createProjectDescription(project, true);
+ return ManagedBuildManager.
+ getConfigurationForDescription(
+ cProjDescription.getConfigurations()[0]);
+
+ }
+
+ private void rebuildArtefact(IProject project) {
+// deleteFiles(getProjectFolder(project),
+// getArtefactFullName(project),
+// new NullProgressMonitor());
+ try {
+ project.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
+ } catch (CoreException e) {
+ e.printStackTrace();
+ fail("Cannot clean project " + fTapp.getName() + '.' + MESSAGE_TAIL);
+ }
+ buildProject(project);
+ }
+
+ private long getArtifactTimeStamp(IProject project) {
+ List files = new ArrayList();
+ findFiles(project, getArtefactFullName(project), files);
+ if(files.size() == 0) // File not exists
+ return 0;
+ IFile artefact = files.iterator().next();
+ return artefact.getModificationStamp();
+ }
+
+ private String getArtefactFullName(IProject project) {
+ IConfiguration cfg = null;
+ try {
+ cfg = getProjectConfiguration(project);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ fail("Error. " + MESSAGE_TAIL);
+ }
+ String name = cfg.getArtifactName();
+ String ext = cfg.getArtifactExtension();
+ if((null != ext) && (ext.length() > 0)) {
+ name += '.';
+ name += ext;
+ }
+ return name;
+ }
+
+
+ public void testDepLibs() {
+ buildProject(fTapp);
+ long timeStamp = getArtifactTimeStamp(fTapp);
+ if(timeStamp == 0) {
+ fail("Cannot build project " + fTapp.getName());
+ }
+ try { // To be sure that in case of build the time should be changed
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // Do nothing
+ }
+ // Check if no build any more
+ buildProject(fTapp);
+ if(timeStamp != getArtifactTimeStamp(fTapp)) {
+ fail("Error. This time it should be nothing to build");
+ }
+ rebuildArtefact(fTlib);
+ buildProject(fTapp);
+ if(timeStamp == getArtifactTimeStamp(fTapp)) {
+ fail("Error. This time it should build application.");
+ }
+ }
+
+ public void testDepUObjs() {
+ buildProject(fTapp);
+ long timeStamp = getArtifactTimeStamp(fTapp);
+ if(timeStamp == 0) {
+ fail("Cannot build project " + fTapp.getName());
+ }
+ try { // To be sure that in case of build the time should be changed
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // Do nothing
+ }
+ // Check if no build any more
+ buildProject(fTapp);
+ if(timeStamp != getArtifactTimeStamp(fTapp)) {
+ fail("Error. This time it should be nothing to build");
+ }
+// deleteFiles(getProjectFolder(fTobjs), "*.o", new NullProgressMonitor());
+ rebuildArtefact(fTobjs);
+ buildProject(fTapp);
+ if(timeStamp == getArtifactTimeStamp(fTapp)) {
+ fail("Error. This time it should build application.");
+ }
+ }
+
+ // Tests that the URI used to get the time stamp of the artifact is escaped correctly
+ // See AdditionalInput.getArtifactTimeStamp(IToolChain toolChain)
+ public void testGetArtifactTimeStampEscapeURI_bug377295() throws CoreException {
+ setWorkspace("regressions");
+ final IProject project = loadProject("helloworldC");
+ IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
+ IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
+ for (IConfiguration configuration : configs) {
+ configuration.setArtifactName("test [377295]");
+ }
+
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ // This will trigger AdditionalInput.getArtifactTimeStamp to get called, no IllegalArgumentException should be thrown
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ }
}
\ No newline at end of file
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/test_commands b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/test_commands
index 067d069e1c9..84788586549 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/test_commands
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/test_commands
@@ -1,3 +1,3 @@
-test.provider.Test_One=cmd1
-test.provider.Test_Two=cmd2
+test.provider.Test_One=cmd1
+test.provider.Test_Two=cmd2
test.provider.Test_Three=cmd
\ No newline at end of file
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/language/settings/providers/ScannerDiscoveryConsole.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/language/settings/providers/ScannerDiscoveryConsole.java
index b12bf1c19c3..f70dd251b40 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/language/settings/providers/ScannerDiscoveryConsole.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/language/settings/providers/ScannerDiscoveryConsole.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2012 Andrew Gvozdev and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andrew Gvozdev - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.managedbuilder.internal.ui.language.settings.providers;
-
-import java.net.URL;
-
-import org.eclipse.cdt.internal.ui.buildconsole.CBuildConsole;
-import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
-import org.eclipse.cdt.ui.language.settings.providers.LanguageSettingsProvidersImages;
-
-/**
- * Console adapter for {@link AbstractBuiltinSpecsDetector}.
- */
-public class ScannerDiscoveryConsole extends CBuildConsole {
- /**
- * {@inheritDoc}
- * @param consoleId - a console ID is expected here which then is used as menu context ID.
- * @param defaultIconUrl - if {@code LanguageSettingsProviderAssociation} extension point
- * defines URL by provider id, {@code defaultIconUrl} will be ignored and the URL from the extension
- * point will be used. If not, supplied {@code defaultIconUrl} will be used.
- */
- @Override
- public void init(String consoleId, String name, URL defaultIconUrl) {
- URL iconUrl = LanguageSettingsProvidersImages.getImageUrl(consoleId);
- if (iconUrl == null) {
- iconUrl = defaultIconUrl;
- }
-
- super.init(consoleId, name, iconUrl);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.ui.language.settings.providers;
+
+import java.net.URL;
+
+import org.eclipse.cdt.internal.ui.buildconsole.CBuildConsole;
+import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
+import org.eclipse.cdt.ui.language.settings.providers.LanguageSettingsProvidersImages;
+
+/**
+ * Console adapter for {@link AbstractBuiltinSpecsDetector}.
+ */
+public class ScannerDiscoveryConsole extends CBuildConsole {
+ /**
+ * {@inheritDoc}
+ * @param consoleId - a console ID is expected here which then is used as menu context ID.
+ * @param defaultIconUrl - if {@code LanguageSettingsProviderAssociation} extension point
+ * defines URL by provider id, {@code defaultIconUrl} will be ignored and the URL from the extension
+ * point will be used. If not, supplied {@code defaultIconUrl} will be used.
+ */
+ @Override
+ public void init(String consoleId, String name, URL defaultIconUrl) {
+ URL iconUrl = LanguageSettingsProvidersImages.getImageUrl(consoleId);
+ if (iconUrl == null) {
+ iconUrl = defaultIconUrl;
+ }
+
+ super.init(consoleId, name, iconUrl);
+ }
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/language/settings/providers/ScannerDiscoveryGlobalConsole.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/language/settings/providers/ScannerDiscoveryGlobalConsole.java
index 0eed304893e..efe4636f16b 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/language/settings/providers/ScannerDiscoveryGlobalConsole.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/language/settings/providers/ScannerDiscoveryGlobalConsole.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 Andrew Gvozdev and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andrew Gvozdev - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.managedbuilder.internal.ui.language.settings.providers;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.eclipse.cdt.core.ConsoleOutputStream;
-import org.eclipse.cdt.internal.core.ICConsole;
-import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
-import org.eclipse.cdt.ui.CDTSharedImages;
-import org.eclipse.cdt.ui.language.settings.providers.LanguageSettingsProvidersImages;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.console.ConsolePlugin;
-import org.eclipse.ui.console.IConsole;
-import org.eclipse.ui.console.IConsoleManager;
-import org.eclipse.ui.console.MessageConsole;
-import org.eclipse.ui.console.MessageConsoleStream;
-
-/**
- * Console adapter for global {@link AbstractBuiltinSpecsDetector}.
- *
- * Note that this console is not colored.
- */
-public class ScannerDiscoveryGlobalConsole implements ICConsole {
- private MessageConsole console;
-
- private class ConsoleOutputStreamAdapter extends ConsoleOutputStream {
- private MessageConsoleStream fConsoleStream;
- public ConsoleOutputStreamAdapter(MessageConsoleStream stream) {
- fConsoleStream = stream;
- }
- @Override
- public void write(int arg0) throws IOException {
- fConsoleStream.write(arg0);
- }
- @Override
- public synchronized void write(byte[] b, int off, int len) throws IOException {
- fConsoleStream.write(b, off, len);
- }
-
- @Override
- public void flush() throws IOException {
- fConsoleStream.flush();
- }
-
- @Override
- public void close() throws IOException {
- fConsoleStream.close();
- }
- }
-
- @Override
- public void start(IProject project) {
- Assert.isTrue(project == null);
- }
-
- @Override
- public ConsoleOutputStream getOutputStream() throws CoreException {
- return new ConsoleOutputStreamAdapter(console.newMessageStream());
- }
-
- @Override
- public ConsoleOutputStream getInfoStream() throws CoreException {
- return new ConsoleOutputStreamAdapter(console.newMessageStream());
- }
-
- @Override
- public ConsoleOutputStream getErrorStream() throws CoreException {
- return new ConsoleOutputStreamAdapter(console.newMessageStream());
- }
-
- @Override
- public void init(String consoleId, String name, URL defaultIconUrl) {
- console = null;
-
- IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
- IConsole[] allConsoles = consoleManager.getConsoles();
- for (IConsole con : allConsoles) {
- if (name.equals(con.getName()) && con instanceof MessageConsole) {
- console = (MessageConsole) con;
- console.clearConsole();
- break;
- }
- }
-
- if (console==null) {
- URL iconUrl = LanguageSettingsProvidersImages.getImageUrl(consoleId);
- if (iconUrl == null) {
- iconUrl = defaultIconUrl;
- }
-
- ImageDescriptor imageDescriptor;
- if (iconUrl != null) {
- imageDescriptor = CDTSharedImages.getImageDescriptor(iconUrl.toString());
- } else {
- imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
- }
-
- console = new MessageConsole(name, imageDescriptor);
- console.activate();
- consoleManager.addConsoles(new IConsole[]{ console });
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.internal.ui.language.settings.providers;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.cdt.core.ConsoleOutputStream;
+import org.eclipse.cdt.internal.core.ICConsole;
+import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
+import org.eclipse.cdt.ui.CDTSharedImages;
+import org.eclipse.cdt.ui.language.settings.providers.LanguageSettingsProvidersImages;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+
+/**
+ * Console adapter for global {@link AbstractBuiltinSpecsDetector}.
+ *
+ * Note that this console is not colored.
+ */
+public class ScannerDiscoveryGlobalConsole implements ICConsole {
+ private MessageConsole console;
+
+ private class ConsoleOutputStreamAdapter extends ConsoleOutputStream {
+ private MessageConsoleStream fConsoleStream;
+ public ConsoleOutputStreamAdapter(MessageConsoleStream stream) {
+ fConsoleStream = stream;
+ }
+ @Override
+ public void write(int arg0) throws IOException {
+ fConsoleStream.write(arg0);
+ }
+ @Override
+ public synchronized void write(byte[] b, int off, int len) throws IOException {
+ fConsoleStream.write(b, off, len);
+ }
+
+ @Override
+ public void flush() throws IOException {
+ fConsoleStream.flush();
+ }
+
+ @Override
+ public void close() throws IOException {
+ fConsoleStream.close();
+ }
+ }
+
+ @Override
+ public void start(IProject project) {
+ Assert.isTrue(project == null);
+ }
+
+ @Override
+ public ConsoleOutputStream getOutputStream() throws CoreException {
+ return new ConsoleOutputStreamAdapter(console.newMessageStream());
+ }
+
+ @Override
+ public ConsoleOutputStream getInfoStream() throws CoreException {
+ return new ConsoleOutputStreamAdapter(console.newMessageStream());
+ }
+
+ @Override
+ public ConsoleOutputStream getErrorStream() throws CoreException {
+ return new ConsoleOutputStreamAdapter(console.newMessageStream());
+ }
+
+ @Override
+ public void init(String consoleId, String name, URL defaultIconUrl) {
+ console = null;
+
+ IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
+ IConsole[] allConsoles = consoleManager.getConsoles();
+ for (IConsole con : allConsoles) {
+ if (name.equals(con.getName()) && con instanceof MessageConsole) {
+ console = (MessageConsole) con;
+ console.clearConsole();
+ break;
+ }
+ }
+
+ if (console==null) {
+ URL iconUrl = LanguageSettingsProvidersImages.getImageUrl(consoleId);
+ if (iconUrl == null) {
+ iconUrl = defaultIconUrl;
+ }
+
+ ImageDescriptor imageDescriptor;
+ if (iconUrl != null) {
+ imageDescriptor = CDTSharedImages.getImageDescriptor(iconUrl.toString());
+ } else {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+
+ console = new MessageConsole(name, imageDescriptor);
+ console.activate();
+ consoleManager.addConsoles(new IConsole[]{ console });
+ }
+ }
+
+}
diff --git a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixBreak.java b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixBreak.java
index d71fcb15713..12aa760b5fe 100644
--- a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixBreak.java
+++ b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixBreak.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2013 Gil Barash
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Gil Barash - Initial implementation
+/*******************************************************************************
+ * Copyright (c) 2011, 2013 Gil Barash
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gil Barash - Initial implementation
*******************************************************************************/
-package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
-
-import org.eclipse.cdt.codan.internal.checkers.ui.CheckersUiActivator;
-import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
-import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
-import org.eclipse.cdt.core.index.IIndex;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-public class CaseBreakQuickFixBreak extends AbstractCaseBreakQuickFix {
- @Override
- public boolean isApplicable(IMarker marker) {
- int line = marker.getAttribute(IMarker.LINE_NUMBER, 0) - 1;
- if (line < 0)
- return false;
- return true;
- }
-
- @Override
- public String getLabel() {
- return QuickFixMessages.CaseBreakQuickFixBreak_Label;
- }
-
- @Override
- public void modifyAST(IIndex index, IMarker marker) {
- try {
- IASTTranslationUnit ast = getTranslationUnitViaEditor(marker).getAST(index, ITranslationUnit.AST_SKIP_INDEXED_HEADERS);
- IASTBreakStatement breakStatement = ast.getASTNodeFactory().newBreakStatement();
- addNewNodeAtMarkedCaseEnd(breakStatement, ast, marker);
- } catch (CoreException e) {
- CheckersUiActivator.log(e);
- }
- }
-}
+package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
+
+import org.eclipse.cdt.codan.internal.checkers.ui.CheckersUiActivator;
+import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.index.IIndex;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+public class CaseBreakQuickFixBreak extends AbstractCaseBreakQuickFix {
+ @Override
+ public boolean isApplicable(IMarker marker) {
+ int line = marker.getAttribute(IMarker.LINE_NUMBER, 0) - 1;
+ if (line < 0)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String getLabel() {
+ return QuickFixMessages.CaseBreakQuickFixBreak_Label;
+ }
+
+ @Override
+ public void modifyAST(IIndex index, IMarker marker) {
+ try {
+ IASTTranslationUnit ast = getTranslationUnitViaEditor(marker).getAST(index, ITranslationUnit.AST_SKIP_INDEXED_HEADERS);
+ IASTBreakStatement breakStatement = ast.getASTNodeFactory().newBreakStatement();
+ addNewNodeAtMarkedCaseEnd(breakStatement, ast, marker);
+ } catch (CoreException e) {
+ CheckersUiActivator.log(e);
+ }
+ }
+}
diff --git a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixComment.java b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixComment.java
index 57af76fa0b3..0ad298b8d46 100644
--- a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixComment.java
+++ b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixComment.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2011 Alena Laskavaia and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alena Laskavaia - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
-
-import org.eclipse.cdt.codan.core.model.IProblem;
-import org.eclipse.cdt.codan.core.param.RootProblemPreference;
-import org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker;
-import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.text.edits.InsertEdit;
-import org.eclipse.text.edits.MalformedTreeException;
-
-public class CaseBreakQuickFixComment extends AbstractCodanCMarkerResolution {
- @Override
- public String getLabel() {
- return QuickFixMessages.CaseBreakQuickFixComment_Label;
- }
-
- @Override
- public void apply(IMarker marker, IDocument document) {
- try {
- int line = marker.getAttribute(IMarker.LINE_NUMBER, -1);
- if (line < 0)
- return;
- int offset = document.getLineOffset(line);
- String indent = getIndentationStr(document, line);
- String comment = getNoBreakComment(marker);
- String editStr = String.format("%s/* %s */\n", indent, comment); //$NON-NLS-1$
- InsertEdit edit = new InsertEdit(offset, editStr);
- edit.apply(document);
- } catch (MalformedTreeException e) {
- return;
- } catch (BadLocationException e) {
- return;
- }
- }
-
- private String getIndentationStr(IDocument document, int line) throws BadLocationException {
- int prevLine = line - 1;
- IRegion lineInformation = document.getLineInformation(prevLine);
- String prevLineStr = document.get(lineInformation.getOffset(), lineInformation.getLength());
- int nonSpace = prevLineStr.indexOf(prevLineStr.trim());
- String indent = prevLineStr.substring(0, nonSpace);
- return indent;
- }
-
- private String getNoBreakComment(IMarker marker) {
- IProblem problem = getProblem(marker);
- RootProblemPreference map = (RootProblemPreference) problem.getPreference();
- String comment = (String) map.getChildValue(CaseBreakChecker.PARAM_NO_BREAK_COMMENT);
- if (comment == null || comment.trim().length() == 0)
- comment = "no break"; //$NON-NLS-1$
- return comment;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Alena Laskavaia and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alena Laskavaia - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
+
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.param.RootProblemPreference;
+import org.eclipse.cdt.codan.internal.checkers.CaseBreakChecker;
+import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.text.edits.InsertEdit;
+import org.eclipse.text.edits.MalformedTreeException;
+
+public class CaseBreakQuickFixComment extends AbstractCodanCMarkerResolution {
+ @Override
+ public String getLabel() {
+ return QuickFixMessages.CaseBreakQuickFixComment_Label;
+ }
+
+ @Override
+ public void apply(IMarker marker, IDocument document) {
+ try {
+ int line = marker.getAttribute(IMarker.LINE_NUMBER, -1);
+ if (line < 0)
+ return;
+ int offset = document.getLineOffset(line);
+ String indent = getIndentationStr(document, line);
+ String comment = getNoBreakComment(marker);
+ String editStr = String.format("%s/* %s */\n", indent, comment); //$NON-NLS-1$
+ InsertEdit edit = new InsertEdit(offset, editStr);
+ edit.apply(document);
+ } catch (MalformedTreeException e) {
+ return;
+ } catch (BadLocationException e) {
+ return;
+ }
+ }
+
+ private String getIndentationStr(IDocument document, int line) throws BadLocationException {
+ int prevLine = line - 1;
+ IRegion lineInformation = document.getLineInformation(prevLine);
+ String prevLineStr = document.get(lineInformation.getOffset(), lineInformation.getLength());
+ int nonSpace = prevLineStr.indexOf(prevLineStr.trim());
+ String indent = prevLineStr.substring(0, nonSpace);
+ return indent;
+ }
+
+ private String getNoBreakComment(IMarker marker) {
+ IProblem problem = getProblem(marker);
+ RootProblemPreference map = (RootProblemPreference) problem.getPreference();
+ String comment = (String) map.getChildValue(CaseBreakChecker.PARAM_NO_BREAK_COMMENT);
+ if (comment == null || comment.trim().length() == 0)
+ comment = "no break"; //$NON-NLS-1$
+ return comment;
+ }
+}
diff --git a/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixBreakTest.java b/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixBreakTest.java
index b14884a6e0a..1a0ddec2345 100644
--- a/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixBreakTest.java
+++ b/codan/org.eclipse.cdt.codan.core.tests/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixBreakTest.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2013 Tomasz Wesolowski and others
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Tomasz Wesolowski - initial API and implementation
+/*******************************************************************************
+ * Copyright (c) 2010, 2013 Tomasz Wesolowski and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tomasz Wesolowski - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
-
-import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
-
-public class CaseBreakQuickFixBreakTest extends QuickFixTestCase {
- @SuppressWarnings("restriction")
- @Override
- protected AbstractCodanCMarkerResolution createQuickFix() {
- return new CaseBreakQuickFixBreak();
- }
-
- //void func() {
- // int a;
- // switch(a) {
- // case 1:
- // hello();
- // case 2:
- // break;
- // }
- //}
- public void testSimpleCase() throws Exception {
- loadcode(getAboveComment());
- String result = runQuickFixOneFile();
- assertContainedIn("break;\tcase 2:", result);
- }
-
- //void func() {
- // int a;
- // switch(a) {
- // case 1: {
- // hello();
- // }
- // default:
- // }
- //}
- public void testCompositeStatementCase() throws Exception {
- loadcode(getAboveComment());
- String result = runQuickFixOneFile();
- assertContainedIn("hello();\t\tbreak;", result);
- }
-
- // int main() {
- // int a;
- // switch(a)
- // {
- // case 0:
- // {
- // }
- // default:
- // break;
- // }
- // return 0;
- // }
- public void testNPE_bug363884() throws Exception {
- loadcode(getAboveComment());
- String result = runQuickFixOneFile();
- assertContainedIn("break;\t}\t\t\tdefault:", result);
- }
-}
+package org.eclipse.cdt.codan.internal.checkers.ui.quickfix;
+
+import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
+
+public class CaseBreakQuickFixBreakTest extends QuickFixTestCase {
+ @SuppressWarnings("restriction")
+ @Override
+ protected AbstractCodanCMarkerResolution createQuickFix() {
+ return new CaseBreakQuickFixBreak();
+ }
+
+ //void func() {
+ // int a;
+ // switch(a) {
+ // case 1:
+ // hello();
+ // case 2:
+ // break;
+ // }
+ //}
+ public void testSimpleCase() throws Exception {
+ loadcode(getAboveComment());
+ String result = runQuickFixOneFile();
+ assertContainedIn("break;\tcase 2:", result);
+ }
+
+ //void func() {
+ // int a;
+ // switch(a) {
+ // case 1: {
+ // hello();
+ // }
+ // default:
+ // }
+ //}
+ public void testCompositeStatementCase() throws Exception {
+ loadcode(getAboveComment());
+ String result = runQuickFixOneFile();
+ assertContainedIn("hello();\t\tbreak;", result);
+ }
+
+ // int main() {
+ // int a;
+ // switch(a)
+ // {
+ // case 0:
+ // {
+ // }
+ // default:
+ // break;
+ // }
+ // return 0;
+ // }
+ public void testNPE_bug363884() throws Exception {
+ loadcode(getAboveComment());
+ String result = runQuickFixOneFile();
+ assertContainedIn("break;\t}\t\t\tdefault:", result);
+ }
+}
diff --git a/codan/org.eclipse.cdt.codan.ui.cxx/.classpath b/codan/org.eclipse.cdt.codan.ui.cxx/.classpath
index b862a296d38..eca7bdba8f0 100644
--- a/codan/org.eclipse.cdt.codan.ui.cxx/.classpath
+++ b/codan/org.eclipse.cdt.codan.ui.cxx/.classpath
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/codan/org.eclipse.cdt.codan.ui.cxx/.settings/org.eclipse.jdt.core.prefs b/codan/org.eclipse.cdt.codan.ui.cxx/.settings/org.eclipse.jdt.core.prefs
index 163ffca2c03..87fa35f3033 100644
--- a/codan/org.eclipse.cdt.codan.ui.cxx/.settings/org.eclipse.jdt.core.prefs
+++ b/codan/org.eclipse.cdt.codan.ui.cxx/.settings/org.eclipse.jdt.core.prefs
@@ -1,346 +1,346 @@
-#Sat Jan 07 18:28:52 PST 2012
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.8
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=0
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=false
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=
-org.eclipse.jdt.core.formatter.enabling_tag=
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=false
-org.eclipse.jdt.core.formatter.join_wrapped_lines=true
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=140
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=0
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+#Sat Jan 07 18:28:52 PST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=0
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=false
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=
+org.eclipse.jdt.core.formatter.enabling_tag=
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=140
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=0
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/ImageConstants.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/ImageConstants.java
index f65ad853333..9eca58919f8 100644
--- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/ImageConstants.java
+++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/ImageConstants.java
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2012 Marc-Andre Laperle
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Marc-Andre Laperle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.codan.internal.ui;
-
-public interface ImageConstants {
- String ICON_WARNING = "icons/yellow_bug.gif"; //$NON-NLS-1$
- String ICON_ERROR = "icons/red_bug.gif"; //$NON-NLS-1$
- String ICON_INFO = "icons/blue_bug.gif"; //$NON-NLS-1$
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Marc-Andre Laperle
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc-Andre Laperle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.internal.ui;
+
+public interface ImageConstants {
+ String ICON_WARNING = "icons/yellow_bug.gif"; //$NON-NLS-1$
+ String ICON_ERROR = "icons/red_bug.gif"; //$NON-NLS-1$
+ String ICON_INFO = "icons/blue_bug.gif"; //$NON-NLS-1$
+}
diff --git a/core/org.eclipse.cdt.core.linux/library/SpawnerInputStream.h b/core/org.eclipse.cdt.core.linux/library/SpawnerInputStream.h
index 3b32d2b2806..ecf8f8c6a78 100644
--- a/core/org.eclipse.cdt.core.linux/library/SpawnerInputStream.h
+++ b/core/org.eclipse.cdt.core.linux/library/SpawnerInputStream.h
@@ -1,32 +1,32 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include
-/* Header for class com_qnx_tools_utils_spawner_SpawnerInputStream */
-
-#ifndef _Included_com_qnx_tools_utils_spawner_SpawnerInputStream
-#define _Included_com_qnx_tools_utils_spawner_SpawnerInputStream
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef com_qnx_tools_utils_spawner_SpawnerInputStream_SKIP_BUFFER_SIZE
-#define com_qnx_tools_utils_spawner_SpawnerInputStream_SKIP_BUFFER_SIZE 2048L
-/* Inaccessible static: skipBuffer */
-/*
- * Class: org_elipse_cdt_utils_spawner_SpawnerInputStream
- * Method: read0
- * Signature: (I[BI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0
- (JNIEnv *, jobject, jint, jbyteArray, jint);
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
- * Method: close0
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0
- (JNIEnv *, jobject, jint);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include
+/* Header for class com_qnx_tools_utils_spawner_SpawnerInputStream */
+
+#ifndef _Included_com_qnx_tools_utils_spawner_SpawnerInputStream
+#define _Included_com_qnx_tools_utils_spawner_SpawnerInputStream
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef com_qnx_tools_utils_spawner_SpawnerInputStream_SKIP_BUFFER_SIZE
+#define com_qnx_tools_utils_spawner_SpawnerInputStream_SKIP_BUFFER_SIZE 2048L
+/* Inaccessible static: skipBuffer */
+/*
+ * Class: org_elipse_cdt_utils_spawner_SpawnerInputStream
+ * Method: read0
+ * Signature: (I[BI)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0
+ (JNIEnv *, jobject, jint, jbyteArray, jint);
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
+ * Method: close0
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0
+ (JNIEnv *, jobject, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/core/org.eclipse.cdt.core.linux/library/SpawnerOutputStream.h b/core/org.eclipse.cdt.core.linux/library/SpawnerOutputStream.h
index f835947e060..444d71c698c 100644
--- a/core/org.eclipse.cdt.core.linux/library/SpawnerOutputStream.h
+++ b/core/org.eclipse.cdt.core.linux/library/SpawnerOutputStream.h
@@ -1,29 +1,29 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include
-/* Header for class com_qnx_tools_utils_spawner_SpawnerOutputStream */
-
-#ifndef _Included_com_qnx_tools_utils_spawner_SpawnerOutputStream
-#define _Included_com_qnx_tools_utils_spawner_SpawnerOutputStream
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
- * Method: write0
- * Signature: (I[BI)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0
- (JNIEnv *, jobject, jint, jbyteArray, jint);
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
- * Method: close0
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0
- (JNIEnv *, jobject, jint);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include
+/* Header for class com_qnx_tools_utils_spawner_SpawnerOutputStream */
+
+#ifndef _Included_com_qnx_tools_utils_spawner_SpawnerOutputStream
+#define _Included_com_qnx_tools_utils_spawner_SpawnerOutputStream
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
+ * Method: write0
+ * Signature: (I[BI)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0
+ (JNIEnv *, jobject, jint, jbyteArray, jint);
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
+ * Method: close0
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0
+ (JNIEnv *, jobject, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/core/org.eclipse.cdt.core.linux/library/exec0.h b/core/org.eclipse.cdt.core.linux/library/exec0.h
index 3033ec1a5ab..bdc56dafa75 100644
--- a/core/org.eclipse.cdt.core.linux/library/exec0.h
+++ b/core/org.eclipse.cdt.core.linux/library/exec0.h
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2010 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- * Wind River Systems, Inc.
- * Mikhail Zabaluev (Nokia) - bug 82744
- *******************************************************************************/
-#include
-#include
-#include
-#include
-#include
-
-extern pid_t exec0(const char *path, char *const argv[],
- char *const envp[], const char *dirpath,
- int channels[3]);
-
-
-extern pid_t exec_pty(const char *path, char *const argv[],
- char *const envp[], const char *dirpath,
- int channels[3], const char *pts_name, int fdm,
- int console);
-
-extern int wait0(pid_t pid);
+/*******************************************************************************
+ * Copyright (c) 2002, 2010 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ * Wind River Systems, Inc.
+ * Mikhail Zabaluev (Nokia) - bug 82744
+ *******************************************************************************/
+#include
+#include
+#include
+#include
+#include
+
+extern pid_t exec0(const char *path, char *const argv[],
+ char *const envp[], const char *dirpath,
+ int channels[3]);
+
+
+extern pid_t exec_pty(const char *path, char *const argv[],
+ char *const envp[], const char *dirpath,
+ int channels[3], const char *pts_name, int fdm,
+ int console);
+
+extern int wait0(pid_t pid);
diff --git a/core/org.eclipse.cdt.core.linux/library/exec_pty.c b/core/org.eclipse.cdt.core.linux/library/exec_pty.c
index dd68615f0e5..752f545a988 100644
--- a/core/org.eclipse.cdt.core.linux/library/exec_pty.c
+++ b/core/org.eclipse.cdt.core.linux/library/exec_pty.c
@@ -1,186 +1,186 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2010 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- * Wind River Systems, Inc.
- * Mikhail Zabaluev (Nokia) - bug 82744
- * Mikhail Sennikovsky - bug 145737
- *******************************************************************************/
-#include "exec0.h"
-#include "openpty.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-/* from pfind.c */
-extern char *pfind(const char *name, char * const envp[]);
-
-pid_t
-exec_pty(const char *path, char *const argv[], char *const envp[],
- const char *dirpath, int channels[3], const char *pts_name, int fdm, int console)
-{
- int pipe2[2];
- pid_t childpid;
- char *full_path;
-
- /*
- * We use pfind() to check that the program exists and is an executable.
- * If not pass the error up. Also execve() wants a full path.
- */
- full_path = pfind(path, envp);
- if (full_path == NULL) {
- fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
- return -1;
- }
-
- /*
- * Make sure we can create our pipes before forking.
- */
- if (channels != NULL && console) {
- if (pipe(pipe2) < 0) {
- fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
- free(full_path);
- return -1;
- }
- }
-
- childpid = fork();
-
- if (childpid < 0) {
- fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
- free(full_path);
- return -1;
- } else if (childpid == 0) { /* child */
-
- chdir(dirpath);
-
- if (channels != NULL) {
- int fds;
-
- if (!console && setsid() < 0) {
- perror("setsid()");
- return -1;
- }
-
- fds = ptys_open(fdm, pts_name);
- if (fds < 0) {
- fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
- return -1;
- }
-
- /* Close the read end of pipe2 */
- if (console && close(pipe2[0]) == -1) {
- perror("close(pipe2[0]))");
- }
-
- /* close the master, no need in the child */
- close(fdm);
-
- if (console) {
- set_noecho(fds);
- if (setpgid(getpid(), getpid()) < 0) {
- perror("setpgid()");
- return -1;
- }
- }
-
- /* redirections */
- dup2(fds, STDIN_FILENO); /* dup stdin */
- dup2(fds, STDOUT_FILENO); /* dup stdout */
- if (console) {
- dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
- } else {
- dup2(fds, STDERR_FILENO); /* dup stderr */
- }
- close(fds); /* done with fds. */
- }
-
- /* Close all the fd's in the child */
- {
- int fdlimit = sysconf(_SC_OPEN_MAX);
- int fd = 3;
-
- while (fd < fdlimit)
- close(fd++);
- }
-
- if (envp[0] == NULL) {
- execv(full_path, argv);
- } else {
- execve(full_path, argv, envp);
- }
-
- _exit(127);
-
- } else if (childpid != 0) { /* parent */
- if (console) {
- set_noecho(fdm);
- }
- if (channels != NULL) {
- channels[0] = fdm; /* Input Stream. */
- channels[1] = fdm; /* Output Stream. */
- if (console) {
- /* close the write end of pipe1 */
- if (close(pipe2[1]) == -1)
- perror("close(pipe2[1])");
- channels[2] = pipe2[0]; /* stderr Stream. */
- } else {
- channels[2] = fdm; /* Error Stream. */
- }
- }
-
- free(full_path);
- return childpid;
- }
-
- free(full_path);
- return -1; /*NOT REACHED */
-}
-#ifdef __STAND_ALONE__
-int main(int argc, char **argv, char **envp) {
- const char *path = "./bufferring_test";
- int channels[3] = { -1, -1, -1};
- int status;
- FILE *app_stdin;
- FILE *app_stdout;
- FILE *app_stderr;
- char pts_name[32];
- int fdm;
- char buffer[32];
-
- fdm = ptym_open(pts_name);
- status = exec_pty(path, argv, envp, ".", channels, pts_name, fdm);
- if (status >= 0) {
- app_stdin = fdopen(channels[0], "w");
- app_stdout = fdopen(channels[1], "r");
- app_stderr = fdopen(channels[2], "r");
- if (app_stdout == NULL || app_stderr == NULL || app_stdin == NULL) {
- fprintf(stderr, "PROBLEMS\n");
- } else {
- fputs("foo\n", app_stdin);
- fputs("bar\n", app_stdin);
- while(fgets(buffer, sizeof buffer, app_stdout) != NULL) {
- fprintf(stdout, "STDOUT: %s\n", buffer);
- }
- while(fgets(buffer, sizeof buffer, app_stderr) != NULL) {
- fprintf(stdout, "STDERR: %s\n", buffer);
- }
- }
- }
- fputs("bye\n", stdout);
- close(channels[0]);
- close(channels[1]);
- close(channels[2]);
- return 0;
-}
-#endif
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ * Wind River Systems, Inc.
+ * Mikhail Zabaluev (Nokia) - bug 82744
+ * Mikhail Sennikovsky - bug 145737
+ *******************************************************************************/
+#include "exec0.h"
+#include "openpty.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* from pfind.c */
+extern char *pfind(const char *name, char * const envp[]);
+
+pid_t
+exec_pty(const char *path, char *const argv[], char *const envp[],
+ const char *dirpath, int channels[3], const char *pts_name, int fdm, int console)
+{
+ int pipe2[2];
+ pid_t childpid;
+ char *full_path;
+
+ /*
+ * We use pfind() to check that the program exists and is an executable.
+ * If not pass the error up. Also execve() wants a full path.
+ */
+ full_path = pfind(path, envp);
+ if (full_path == NULL) {
+ fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
+ return -1;
+ }
+
+ /*
+ * Make sure we can create our pipes before forking.
+ */
+ if (channels != NULL && console) {
+ if (pipe(pipe2) < 0) {
+ fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+ free(full_path);
+ return -1;
+ }
+ }
+
+ childpid = fork();
+
+ if (childpid < 0) {
+ fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+ free(full_path);
+ return -1;
+ } else if (childpid == 0) { /* child */
+
+ chdir(dirpath);
+
+ if (channels != NULL) {
+ int fds;
+
+ if (!console && setsid() < 0) {
+ perror("setsid()");
+ return -1;
+ }
+
+ fds = ptys_open(fdm, pts_name);
+ if (fds < 0) {
+ fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+ return -1;
+ }
+
+ /* Close the read end of pipe2 */
+ if (console && close(pipe2[0]) == -1) {
+ perror("close(pipe2[0]))");
+ }
+
+ /* close the master, no need in the child */
+ close(fdm);
+
+ if (console) {
+ set_noecho(fds);
+ if (setpgid(getpid(), getpid()) < 0) {
+ perror("setpgid()");
+ return -1;
+ }
+ }
+
+ /* redirections */
+ dup2(fds, STDIN_FILENO); /* dup stdin */
+ dup2(fds, STDOUT_FILENO); /* dup stdout */
+ if (console) {
+ dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
+ } else {
+ dup2(fds, STDERR_FILENO); /* dup stderr */
+ }
+ close(fds); /* done with fds. */
+ }
+
+ /* Close all the fd's in the child */
+ {
+ int fdlimit = sysconf(_SC_OPEN_MAX);
+ int fd = 3;
+
+ while (fd < fdlimit)
+ close(fd++);
+ }
+
+ if (envp[0] == NULL) {
+ execv(full_path, argv);
+ } else {
+ execve(full_path, argv, envp);
+ }
+
+ _exit(127);
+
+ } else if (childpid != 0) { /* parent */
+ if (console) {
+ set_noecho(fdm);
+ }
+ if (channels != NULL) {
+ channels[0] = fdm; /* Input Stream. */
+ channels[1] = fdm; /* Output Stream. */
+ if (console) {
+ /* close the write end of pipe1 */
+ if (close(pipe2[1]) == -1)
+ perror("close(pipe2[1])");
+ channels[2] = pipe2[0]; /* stderr Stream. */
+ } else {
+ channels[2] = fdm; /* Error Stream. */
+ }
+ }
+
+ free(full_path);
+ return childpid;
+ }
+
+ free(full_path);
+ return -1; /*NOT REACHED */
+}
+#ifdef __STAND_ALONE__
+int main(int argc, char **argv, char **envp) {
+ const char *path = "./bufferring_test";
+ int channels[3] = { -1, -1, -1};
+ int status;
+ FILE *app_stdin;
+ FILE *app_stdout;
+ FILE *app_stderr;
+ char pts_name[32];
+ int fdm;
+ char buffer[32];
+
+ fdm = ptym_open(pts_name);
+ status = exec_pty(path, argv, envp, ".", channels, pts_name, fdm);
+ if (status >= 0) {
+ app_stdin = fdopen(channels[0], "w");
+ app_stdout = fdopen(channels[1], "r");
+ app_stderr = fdopen(channels[2], "r");
+ if (app_stdout == NULL || app_stderr == NULL || app_stdin == NULL) {
+ fprintf(stderr, "PROBLEMS\n");
+ } else {
+ fputs("foo\n", app_stdin);
+ fputs("bar\n", app_stdin);
+ while(fgets(buffer, sizeof buffer, app_stdout) != NULL) {
+ fprintf(stdout, "STDOUT: %s\n", buffer);
+ }
+ while(fgets(buffer, sizeof buffer, app_stderr) != NULL) {
+ fprintf(stdout, "STDERR: %s\n", buffer);
+ }
+ }
+ }
+ fputs("bye\n", stdout);
+ close(channels[0]);
+ close(channels[1]);
+ close(channels[2]);
+ return 0;
+}
+#endif
diff --git a/core/org.eclipse.cdt.core.linux/library/exec_unix.c b/core/org.eclipse.cdt.core.linux/library/exec_unix.c
index ced7b744daa..0d68dd13c0a 100644
--- a/core/org.eclipse.cdt.core.linux/library/exec_unix.c
+++ b/core/org.eclipse.cdt.core.linux/library/exec_unix.c
@@ -1,158 +1,158 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2010 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- * Wind River Systems, Inc.
- * Mikhail Sennikovsky - bug 145737
- *******************************************************************************/
-#include "exec0.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-/* from pfind.c */
-extern char *pfind(const char *name, char * const envp[]);
-
-pid_t
-exec0(const char *path, char *const argv[], char *const envp[],
- const char *dirpath, int channels[3])
-{
- int pipe0[2], pipe1[2], pipe2[2];
- pid_t childpid;
- char *full_path;
-
- /*
- * We use pfind() to check that the program exists and is an executable.
- * If not pass the error up. Also execve() wants a full path.
- */
- full_path = pfind(path, envp);
- if (full_path == NULL) {
- fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
- return -1;
- }
-
- /*
- * Make sure we can create our pipes before forking.
- */
- if (channels != NULL) {
- if (pipe(pipe0) < 0 || pipe(pipe1) < 0 || pipe(pipe2) < 0) {
- fprintf(stderr, "%s(%d): returning due to error.\n",
- __FUNCTION__, __LINE__);
- free(full_path);
- return -1;
- }
- }
-
- childpid = fork();
-
- if (childpid < 0) {
- fprintf(stderr, "%s(%d): returning due to error: %s\n",
- __FUNCTION__, __LINE__, strerror(errno));
- free(full_path);
- return -1;
- } else if (childpid == 0) { /* child */
- char *ptr;
-
- chdir(dirpath);
-
- if (channels != NULL) {
- /* Close the write end of pipe0 */
- if (close(pipe0[1]) == -1)
- perror("close(pipe0[1])");
-
- /* Close the read end of pipe1 */
- if (close(pipe1[0]) == -1)
- perror("close(pipe1[0])");
-
- /* Close the read end of pipe2 */
- if (close(pipe2[0]) == -1)
- perror("close(pipe2[0]))");
-
- /* redirections */
- dup2(pipe0[0], STDIN_FILENO); /* dup stdin */
- dup2(pipe1[1], STDOUT_FILENO); /* dup stdout */
- dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
- }
-
- /* Close all the fd's in the child */
- {
- int fdlimit = sysconf(_SC_OPEN_MAX);
- int fd = 3;
-
- while (fd < fdlimit)
- close(fd++);
- }
-
- setpgid(getpid(), getpid());
-
- if (envp[0] == NULL) {
- execv(full_path, argv);
- } else {
- execve(full_path, argv, envp);
- }
-
- _exit(127);
-
- } else if (childpid != 0) { /* parent */
-
- char b;
-
- if (channels != NULL) {
- /* close the read end of pipe1 */
- if (close(pipe0[0]) == -1)
- perror("close(pipe0[0])");
-
- /* close the write end of pipe2 */
- if (close(pipe1[1]) == -1)
- perror("close(pipe1[1])");
-
- /* close the write end of pipe2 */
- if (close(pipe2[1]) == -1)
- perror("close(pipe2[1])");
-
- channels[0] = pipe0[1]; /* Output Stream. */
- channels[1] = pipe1[0]; /* Input Stream. */
- channels[2] = pipe2[0]; /* Input Stream. */
- }
-
- free(full_path);
- return childpid;
- }
-
- free(full_path);
- return -1; /*NOT REACHED */
-}
-
-
-int wait0(pid_t pid)
-{
- int status;
- int val = -1;
-
- if (pid < 0)
- return -1;
-
- for (;;) {
- if (waitpid(pid, &status, 0) < 0) {
- if (errno == EINTR) {
- // interrupted system call - retry
- continue;
- }
- }
- break;
- }
- if (WIFEXITED(status)) {
- val = WEXITSTATUS(status);
- }
-
- return val;
-}
+/*******************************************************************************
+ * Copyright (c) 2002, 2010 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ * Wind River Systems, Inc.
+ * Mikhail Sennikovsky - bug 145737
+ *******************************************************************************/
+#include "exec0.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* from pfind.c */
+extern char *pfind(const char *name, char * const envp[]);
+
+pid_t
+exec0(const char *path, char *const argv[], char *const envp[],
+ const char *dirpath, int channels[3])
+{
+ int pipe0[2], pipe1[2], pipe2[2];
+ pid_t childpid;
+ char *full_path;
+
+ /*
+ * We use pfind() to check that the program exists and is an executable.
+ * If not pass the error up. Also execve() wants a full path.
+ */
+ full_path = pfind(path, envp);
+ if (full_path == NULL) {
+ fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
+ return -1;
+ }
+
+ /*
+ * Make sure we can create our pipes before forking.
+ */
+ if (channels != NULL) {
+ if (pipe(pipe0) < 0 || pipe(pipe1) < 0 || pipe(pipe2) < 0) {
+ fprintf(stderr, "%s(%d): returning due to error.\n",
+ __FUNCTION__, __LINE__);
+ free(full_path);
+ return -1;
+ }
+ }
+
+ childpid = fork();
+
+ if (childpid < 0) {
+ fprintf(stderr, "%s(%d): returning due to error: %s\n",
+ __FUNCTION__, __LINE__, strerror(errno));
+ free(full_path);
+ return -1;
+ } else if (childpid == 0) { /* child */
+ char *ptr;
+
+ chdir(dirpath);
+
+ if (channels != NULL) {
+ /* Close the write end of pipe0 */
+ if (close(pipe0[1]) == -1)
+ perror("close(pipe0[1])");
+
+ /* Close the read end of pipe1 */
+ if (close(pipe1[0]) == -1)
+ perror("close(pipe1[0])");
+
+ /* Close the read end of pipe2 */
+ if (close(pipe2[0]) == -1)
+ perror("close(pipe2[0]))");
+
+ /* redirections */
+ dup2(pipe0[0], STDIN_FILENO); /* dup stdin */
+ dup2(pipe1[1], STDOUT_FILENO); /* dup stdout */
+ dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
+ }
+
+ /* Close all the fd's in the child */
+ {
+ int fdlimit = sysconf(_SC_OPEN_MAX);
+ int fd = 3;
+
+ while (fd < fdlimit)
+ close(fd++);
+ }
+
+ setpgid(getpid(), getpid());
+
+ if (envp[0] == NULL) {
+ execv(full_path, argv);
+ } else {
+ execve(full_path, argv, envp);
+ }
+
+ _exit(127);
+
+ } else if (childpid != 0) { /* parent */
+
+ char b;
+
+ if (channels != NULL) {
+ /* close the read end of pipe1 */
+ if (close(pipe0[0]) == -1)
+ perror("close(pipe0[0])");
+
+ /* close the write end of pipe2 */
+ if (close(pipe1[1]) == -1)
+ perror("close(pipe1[1])");
+
+ /* close the write end of pipe2 */
+ if (close(pipe2[1]) == -1)
+ perror("close(pipe2[1])");
+
+ channels[0] = pipe0[1]; /* Output Stream. */
+ channels[1] = pipe1[0]; /* Input Stream. */
+ channels[2] = pipe2[0]; /* Input Stream. */
+ }
+
+ free(full_path);
+ return childpid;
+ }
+
+ free(full_path);
+ return -1; /*NOT REACHED */
+}
+
+
+int wait0(pid_t pid)
+{
+ int status;
+ int val = -1;
+
+ if (pid < 0)
+ return -1;
+
+ for (;;) {
+ if (waitpid(pid, &status, 0) < 0) {
+ if (errno == EINTR) {
+ // interrupted system call - retry
+ continue;
+ }
+ }
+ break;
+ }
+ if (WIFEXITED(status)) {
+ val = WEXITSTATUS(status);
+ }
+
+ return val;
+}
diff --git a/core/org.eclipse.cdt.core.linux/library/io.c b/core/org.eclipse.cdt.core.linux/library/io.c
index 8540b826287..e42d6c23944 100644
--- a/core/org.eclipse.cdt.core.linux/library/io.c
+++ b/core/org.eclipse.cdt.core.linux/library/io.c
@@ -1,114 +1,114 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2006 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- * Wind River Systems, Inc.
- *******************************************************************************/
-#include
-#include
-#include
-#include
-#include
-
-/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerInputStream */
-/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerOutputStream */
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
- * Method: read0
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv * env,
- jobject jobj,
- jint jfd,
- jbyteArray buf,
- jint buf_len)
-{
- int fd;
- int status;
- jbyte *data;
- int data_len;
-
- data = (*env)->GetByteArrayElements(env, buf, 0);
- data_len = buf_len;
- fd = jfd;
-
- status = read( fd, data, data_len );
- (*env)->ReleaseByteArrayElements(env, buf, data, 0);
-
- if (status == 0) {
- /* EOF. */
- status = -1;
- } else if (status == -1) {
- /* Error, toss an exception */
- jclass exception = (*env)->FindClass(env, "java/io/IOException");
- if (exception == NULL) {
- /* Give up. */
- return -1;
- }
- (*env)->ThrowNew(env, exception, "read error");
- }
-
- return status;
-}
-
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
- * Method: close0
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv * env,
- jobject jobj,
- jint fd)
-{
- return close(fd);
-}
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
- * Method: write0
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0(JNIEnv * env,
- jobject jobj,
- jint jfd,
- jbyteArray buf,
- jint buf_len)
-{
- int status;
- int fd;
- jbyte *data;
- int data_len;
-
- data = (*env)->GetByteArrayElements(env, buf, 0);
- data_len = buf_len;
- fd = jfd;
-
- status = write(fd, data, data_len);
- (*env)->ReleaseByteArrayElements(env, buf, data, 0);
-
- return status;
-}
-
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
- * Method: close0
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0(JNIEnv * env,
- jobject jobj,
- jint fd)
-{
- return close(fd);
-}
+/*******************************************************************************
+ * Copyright (c) 2002, 2006 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ * Wind River Systems, Inc.
+ *******************************************************************************/
+#include
+#include
+#include
+#include
+#include
+
+/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerInputStream */
+/* Header for class _org_eclipse_cdt_utils_spawner_SpawnerOutputStream */
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
+ * Method: read0
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_read0(JNIEnv * env,
+ jobject jobj,
+ jint jfd,
+ jbyteArray buf,
+ jint buf_len)
+{
+ int fd;
+ int status;
+ jbyte *data;
+ int data_len;
+
+ data = (*env)->GetByteArrayElements(env, buf, 0);
+ data_len = buf_len;
+ fd = jfd;
+
+ status = read( fd, data, data_len );
+ (*env)->ReleaseByteArrayElements(env, buf, data, 0);
+
+ if (status == 0) {
+ /* EOF. */
+ status = -1;
+ } else if (status == -1) {
+ /* Error, toss an exception */
+ jclass exception = (*env)->FindClass(env, "java/io/IOException");
+ if (exception == NULL) {
+ /* Give up. */
+ return -1;
+ }
+ (*env)->ThrowNew(env, exception, "read error");
+ }
+
+ return status;
+}
+
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_SpawnerInputStream
+ * Method: close0
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_SpawnerInputStream_close0(JNIEnv * env,
+ jobject jobj,
+ jint fd)
+{
+ return close(fd);
+}
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
+ * Method: write0
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_write0(JNIEnv * env,
+ jobject jobj,
+ jint jfd,
+ jbyteArray buf,
+ jint buf_len)
+{
+ int status;
+ int fd;
+ jbyte *data;
+ int data_len;
+
+ data = (*env)->GetByteArrayElements(env, buf, 0);
+ data_len = buf_len;
+ fd = jfd;
+
+ status = write(fd, data, data_len);
+ (*env)->ReleaseByteArrayElements(env, buf, data, 0);
+
+ return status;
+}
+
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_SpawnerOutputStream
+ * Method: close0
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_SpawnerOutputStream_close0(JNIEnv * env,
+ jobject jobj,
+ jint fd)
+{
+ return close(fd);
+}
diff --git a/core/org.eclipse.cdt.core.linux/library/spawner.c b/core/org.eclipse.cdt.core.linux/library/spawner.c
index 67b12b05b80..217349b439d 100644
--- a/core/org.eclipse.cdt.core.linux/library/spawner.c
+++ b/core/org.eclipse.cdt.core.linux/library/spawner.c
@@ -1,302 +1,302 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2010 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- * Wind River Systems, Inc.
- * Mikhail Zabaluev (Nokia) - bug 82744
- *******************************************************************************/
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "exec0.h"
-#include
-
-
-#define DEBUGIT 0
-
-
-/*
- * Header for class org_eclipse_cdt_utils_spawner_Spawner
- */
-
-
-#if DEBUGIT
-static void print_array(char **c_array)
-{
- if (c_array) {
- char **p = c_array;
- for (; *p; p++) {
- if (*p) {
- fprintf(stderr, " %s", *p);
- }
- }
- } else {
- fprintf(stderr, "null");
- }
- fprintf(stderr, "\n");
-}
-#endif
-
-
-static char **alloc_c_array(JNIEnv * env, jobjectArray j_array)
-{
- int i;
- jint c_array_size = (*env)->GetArrayLength(env, j_array);
- char **c_array = calloc(c_array_size + 1, sizeof(*c_array));
-
- if (c_array == NULL)
- return NULL;
-
- for (i = 0; i < c_array_size; i++) {
- jstring j_str =
- (jstring) (*env)->GetObjectArrayElement(env, j_array, i);
- const char *c_str = (*env)->GetStringUTFChars(env, j_str, NULL);
- c_array[i] = (char *) strdup(c_str);
- (*env)->ReleaseStringUTFChars(env, j_str, c_str);
- (*env)->DeleteLocalRef(env, j_str);
- }
-
- return c_array;
-}
-
-
-static void free_c_array(char **c_array)
-{
- if (c_array) {
- char **p = c_array;
- for (; *p; p++) {
- if (*p) {
- free(*p);
- }
- }
- free(c_array);
- }
-}
-
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_Spawner
- * Method: exec2
- * Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILorg/eclipse/cdt/utils/pty/PTY;)I
- */
-JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
- (JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv, jstring jdir, jintArray jchannels,
- jstring jslaveName, jint masterFD, jboolean console)
-{
- jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
- const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
- const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
- char **cmd = NULL;
- char **envp = NULL;
- int fd[3];
- pid_t pid = -1;
-
- if (channels == NULL)
- goto bail_out;
-
- cmd = alloc_c_array(env, jcmd);
- if (cmd == NULL)
- goto bail_out;
-
- envp = alloc_c_array(env, jenv);
- if (envp == NULL)
- goto bail_out;
-
-#if DEBUGIT
- fprintf(stderr, "command:");
- print_array(cmd);
- fprintf(stderr, "Envp:");
- print_array(envp);
- fprintf(stderr, "dirpath: %s\n", dirpath);
- fprintf(stderr, "pts_name: %s\n", pts_name);
-#endif
-
- pid = exec_pty(cmd[0], cmd, envp, dirpath, fd, pts_name, masterFD, console);
- if (pid < 0)
- goto bail_out;
-
- channels[0] = fd[0];
- channels[1] = fd[1];
- channels[2] = fd[2];
-
- bail_out:
- (*env)->ReleaseIntArrayElements(env, jchannels, channels, 0);
- (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
- (*env)->ReleaseStringUTFChars(env, jslaveName, pts_name);
- if (cmd)
- free_c_array(cmd);
- if (envp)
- free_c_array(envp);
- return pid;
-}
-
-
-JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
- jobjectArray jcmd,
- jobjectArray jenv,
- jstring jdir)
-{
- const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
- char **cmd = NULL;
- char **envp = NULL;
- pid_t pid = -1;
-
- cmd = alloc_c_array(env, jcmd);
- if (cmd == NULL)
- goto bail_out;
-
- envp = alloc_c_array(env, jenv);
- if (envp == NULL)
- goto bail_out;
-
-#if DEBUGIT
- fprintf(stderr, "command:");
- print_array(cmd);
- fprintf(stderr, "Envp:");
- print_array(envp);
- fprintf(stderr, "dirpath: %s\n", dirpath);
-#endif
-
- pid = exec0(cmd[0], cmd, envp, dirpath, NULL);
- if (pid < 0)
- goto bail_out;
-
- bail_out:
- (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
- if (cmd)
- free_c_array(cmd);
- if (envp)
- free_c_array(envp);
- return pid;
-}
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_Spawner
- * Method: exec0
- * Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[I)I
- */
-JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
- jobjectArray jcmd,
- jobjectArray jenv,
- jstring jdir,
- jintArray jchannels)
-{
- jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
- const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
- char **cmd = NULL;
- char **envp = NULL;
- int fd[3];
- pid_t pid = -1;
-
- if (channels == NULL)
- goto bail_out;
-
- cmd = alloc_c_array(env, jcmd);
- if (cmd == NULL)
- goto bail_out;
-
- envp = alloc_c_array(env, jenv);
- if (envp == NULL)
- goto bail_out;
-
-#if DEBUGIT
- fprintf(stderr, "command:");
- print_array(cmd);
- fprintf(stderr, "Envp:");
- print_array(envp);
- fprintf(stderr, "dirpath: %s\n", dirpath);
-#endif
-
- pid = exec0(cmd[0], cmd, envp, dirpath, fd);
- if (pid < 0)
- goto bail_out;
-
- channels[0] = fd[0];
- channels[1] = fd[1];
- channels[2] = fd[2];
-
- bail_out:
- (*env)->ReleaseIntArrayElements(env, jchannels, channels, 0);
- (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
- if (cmd)
- free_c_array(cmd);
- if (envp)
- free_c_array(envp);
- return pid;
-}
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_Spawner
- * Method: raise
- * Signature: (II)I
- */
-JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv * env, jobject jobj,
- jint pid, jint sig)
-{
- int status = -1;
-
- switch (sig) {
- case 0: /* NOOP */
- status = killpg(pid, 0);
- if(status == -1) {
- status = kill(pid, 0);
- }
- break;
-
- case 2: /* INTERRUPT */
- status = killpg(pid, SIGINT);
- if(status == -1) {
- status = kill(pid, SIGINT);
- }
- break;
-
- case 9: /* KILL */
- status = killpg(pid, SIGKILL);
- if(status == -1) {
- status = kill(pid, SIGKILL);
- }
- break;
-
- case 15: /* TERM */
- status = killpg(pid, SIGTERM);
- if(status == -1) {
- status = kill(pid, SIGTERM);
- }
- break;
-
- default:
- status = killpg(pid, sig); /* WHAT ?? */
- if(status == -1) {
- status = kill(pid, sig); /* WHAT ?? */
- }
- break;
- }
-
- return status;
-}
-
-
-
-/*
- * Class: org_eclipse_cdt_utils_spawner_Spawner
- * Method: waitFor
- * Signature: (I)I
- */
-JNIEXPORT jint JNICALL
-Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv * env,
- jobject jobj, jint pid)
-{
- return wait0(pid);
-}
+/*******************************************************************************
+ * Copyright (c) 2002, 2010 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ * Wind River Systems, Inc.
+ * Mikhail Zabaluev (Nokia) - bug 82744
+ *******************************************************************************/
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "exec0.h"
+#include
+
+
+#define DEBUGIT 0
+
+
+/*
+ * Header for class org_eclipse_cdt_utils_spawner_Spawner
+ */
+
+
+#if DEBUGIT
+static void print_array(char **c_array)
+{
+ if (c_array) {
+ char **p = c_array;
+ for (; *p; p++) {
+ if (*p) {
+ fprintf(stderr, " %s", *p);
+ }
+ }
+ } else {
+ fprintf(stderr, "null");
+ }
+ fprintf(stderr, "\n");
+}
+#endif
+
+
+static char **alloc_c_array(JNIEnv * env, jobjectArray j_array)
+{
+ int i;
+ jint c_array_size = (*env)->GetArrayLength(env, j_array);
+ char **c_array = calloc(c_array_size + 1, sizeof(*c_array));
+
+ if (c_array == NULL)
+ return NULL;
+
+ for (i = 0; i < c_array_size; i++) {
+ jstring j_str =
+ (jstring) (*env)->GetObjectArrayElement(env, j_array, i);
+ const char *c_str = (*env)->GetStringUTFChars(env, j_str, NULL);
+ c_array[i] = (char *) strdup(c_str);
+ (*env)->ReleaseStringUTFChars(env, j_str, c_str);
+ (*env)->DeleteLocalRef(env, j_str);
+ }
+
+ return c_array;
+}
+
+
+static void free_c_array(char **c_array)
+{
+ if (c_array) {
+ char **p = c_array;
+ for (; *p; p++) {
+ if (*p) {
+ free(*p);
+ }
+ }
+ free(c_array);
+ }
+}
+
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_Spawner
+ * Method: exec2
+ * Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILorg/eclipse/cdt/utils/pty/PTY;)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec2
+ (JNIEnv *env, jobject jobj, jobjectArray jcmd, jobjectArray jenv, jstring jdir, jintArray jchannels,
+ jstring jslaveName, jint masterFD, jboolean console)
+{
+ jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
+ const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
+ const char *pts_name = (*env)->GetStringUTFChars(env, jslaveName, NULL);
+ char **cmd = NULL;
+ char **envp = NULL;
+ int fd[3];
+ pid_t pid = -1;
+
+ if (channels == NULL)
+ goto bail_out;
+
+ cmd = alloc_c_array(env, jcmd);
+ if (cmd == NULL)
+ goto bail_out;
+
+ envp = alloc_c_array(env, jenv);
+ if (envp == NULL)
+ goto bail_out;
+
+#if DEBUGIT
+ fprintf(stderr, "command:");
+ print_array(cmd);
+ fprintf(stderr, "Envp:");
+ print_array(envp);
+ fprintf(stderr, "dirpath: %s\n", dirpath);
+ fprintf(stderr, "pts_name: %s\n", pts_name);
+#endif
+
+ pid = exec_pty(cmd[0], cmd, envp, dirpath, fd, pts_name, masterFD, console);
+ if (pid < 0)
+ goto bail_out;
+
+ channels[0] = fd[0];
+ channels[1] = fd[1];
+ channels[2] = fd[2];
+
+ bail_out:
+ (*env)->ReleaseIntArrayElements(env, jchannels, channels, 0);
+ (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
+ (*env)->ReleaseStringUTFChars(env, jslaveName, pts_name);
+ if (cmd)
+ free_c_array(cmd);
+ if (envp)
+ free_c_array(envp);
+ return pid;
+}
+
+
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_Spawner_exec1(JNIEnv * env, jobject jobj,
+ jobjectArray jcmd,
+ jobjectArray jenv,
+ jstring jdir)
+{
+ const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
+ char **cmd = NULL;
+ char **envp = NULL;
+ pid_t pid = -1;
+
+ cmd = alloc_c_array(env, jcmd);
+ if (cmd == NULL)
+ goto bail_out;
+
+ envp = alloc_c_array(env, jenv);
+ if (envp == NULL)
+ goto bail_out;
+
+#if DEBUGIT
+ fprintf(stderr, "command:");
+ print_array(cmd);
+ fprintf(stderr, "Envp:");
+ print_array(envp);
+ fprintf(stderr, "dirpath: %s\n", dirpath);
+#endif
+
+ pid = exec0(cmd[0], cmd, envp, dirpath, NULL);
+ if (pid < 0)
+ goto bail_out;
+
+ bail_out:
+ (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
+ if (cmd)
+ free_c_array(cmd);
+ if (envp)
+ free_c_array(envp);
+ return pid;
+}
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_Spawner
+ * Method: exec0
+ * Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv * env, jobject jobj,
+ jobjectArray jcmd,
+ jobjectArray jenv,
+ jstring jdir,
+ jintArray jchannels)
+{
+ jint *channels = (*env)->GetIntArrayElements(env, jchannels, 0);
+ const char *dirpath = (*env)->GetStringUTFChars(env, jdir, NULL);
+ char **cmd = NULL;
+ char **envp = NULL;
+ int fd[3];
+ pid_t pid = -1;
+
+ if (channels == NULL)
+ goto bail_out;
+
+ cmd = alloc_c_array(env, jcmd);
+ if (cmd == NULL)
+ goto bail_out;
+
+ envp = alloc_c_array(env, jenv);
+ if (envp == NULL)
+ goto bail_out;
+
+#if DEBUGIT
+ fprintf(stderr, "command:");
+ print_array(cmd);
+ fprintf(stderr, "Envp:");
+ print_array(envp);
+ fprintf(stderr, "dirpath: %s\n", dirpath);
+#endif
+
+ pid = exec0(cmd[0], cmd, envp, dirpath, fd);
+ if (pid < 0)
+ goto bail_out;
+
+ channels[0] = fd[0];
+ channels[1] = fd[1];
+ channels[2] = fd[2];
+
+ bail_out:
+ (*env)->ReleaseIntArrayElements(env, jchannels, channels, 0);
+ (*env)->ReleaseStringUTFChars(env, jdir, dirpath);
+ if (cmd)
+ free_c_array(cmd);
+ if (envp)
+ free_c_array(envp);
+ return pid;
+}
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_Spawner
+ * Method: raise
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_Spawner_raise(JNIEnv * env, jobject jobj,
+ jint pid, jint sig)
+{
+ int status = -1;
+
+ switch (sig) {
+ case 0: /* NOOP */
+ status = killpg(pid, 0);
+ if(status == -1) {
+ status = kill(pid, 0);
+ }
+ break;
+
+ case 2: /* INTERRUPT */
+ status = killpg(pid, SIGINT);
+ if(status == -1) {
+ status = kill(pid, SIGINT);
+ }
+ break;
+
+ case 9: /* KILL */
+ status = killpg(pid, SIGKILL);
+ if(status == -1) {
+ status = kill(pid, SIGKILL);
+ }
+ break;
+
+ case 15: /* TERM */
+ status = killpg(pid, SIGTERM);
+ if(status == -1) {
+ status = kill(pid, SIGTERM);
+ }
+ break;
+
+ default:
+ status = killpg(pid, sig); /* WHAT ?? */
+ if(status == -1) {
+ status = kill(pid, sig); /* WHAT ?? */
+ }
+ break;
+ }
+
+ return status;
+}
+
+
+
+/*
+ * Class: org_eclipse_cdt_utils_spawner_Spawner
+ * Method: waitFor
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL
+Java_org_eclipse_cdt_utils_spawner_Spawner_waitFor(JNIEnv * env,
+ jobject jobj, jint pid)
+{
+ return wait0(pid);
+}
diff --git a/core/org.eclipse.cdt.core.linux/plugin.properties b/core/org.eclipse.cdt.core.linux/plugin.properties
index 6c8e47ac7e1..8895eaa75ee 100644
--- a/core/org.eclipse.cdt.core.linux/plugin.properties
+++ b/core/org.eclipse.cdt.core.linux/plugin.properties
@@ -1,2 +1,2 @@
-fragmentName.linux=C/C++ Development Tools Core for Linux
-providerName=Eclipse CDT
+fragmentName.linux=C/C++ Development Tools Core for Linux
+providerName=Eclipse CDT
diff --git a/core/org.eclipse.cdt.core.macosx/library/exec_pty.c b/core/org.eclipse.cdt.core.macosx/library/exec_pty.c
index dd68615f0e5..752f545a988 100644
--- a/core/org.eclipse.cdt.core.macosx/library/exec_pty.c
+++ b/core/org.eclipse.cdt.core.macosx/library/exec_pty.c
@@ -1,186 +1,186 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2010 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - initial API and implementation
- * Wind River Systems, Inc.
- * Mikhail Zabaluev (Nokia) - bug 82744
- * Mikhail Sennikovsky - bug 145737
- *******************************************************************************/
-#include "exec0.h"
-#include "openpty.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-/* from pfind.c */
-extern char *pfind(const char *name, char * const envp[]);
-
-pid_t
-exec_pty(const char *path, char *const argv[], char *const envp[],
- const char *dirpath, int channels[3], const char *pts_name, int fdm, int console)
-{
- int pipe2[2];
- pid_t childpid;
- char *full_path;
-
- /*
- * We use pfind() to check that the program exists and is an executable.
- * If not pass the error up. Also execve() wants a full path.
- */
- full_path = pfind(path, envp);
- if (full_path == NULL) {
- fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
- return -1;
- }
-
- /*
- * Make sure we can create our pipes before forking.
- */
- if (channels != NULL && console) {
- if (pipe(pipe2) < 0) {
- fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
- free(full_path);
- return -1;
- }
- }
-
- childpid = fork();
-
- if (childpid < 0) {
- fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
- free(full_path);
- return -1;
- } else if (childpid == 0) { /* child */
-
- chdir(dirpath);
-
- if (channels != NULL) {
- int fds;
-
- if (!console && setsid() < 0) {
- perror("setsid()");
- return -1;
- }
-
- fds = ptys_open(fdm, pts_name);
- if (fds < 0) {
- fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
- return -1;
- }
-
- /* Close the read end of pipe2 */
- if (console && close(pipe2[0]) == -1) {
- perror("close(pipe2[0]))");
- }
-
- /* close the master, no need in the child */
- close(fdm);
-
- if (console) {
- set_noecho(fds);
- if (setpgid(getpid(), getpid()) < 0) {
- perror("setpgid()");
- return -1;
- }
- }
-
- /* redirections */
- dup2(fds, STDIN_FILENO); /* dup stdin */
- dup2(fds, STDOUT_FILENO); /* dup stdout */
- if (console) {
- dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
- } else {
- dup2(fds, STDERR_FILENO); /* dup stderr */
- }
- close(fds); /* done with fds. */
- }
-
- /* Close all the fd's in the child */
- {
- int fdlimit = sysconf(_SC_OPEN_MAX);
- int fd = 3;
-
- while (fd < fdlimit)
- close(fd++);
- }
-
- if (envp[0] == NULL) {
- execv(full_path, argv);
- } else {
- execve(full_path, argv, envp);
- }
-
- _exit(127);
-
- } else if (childpid != 0) { /* parent */
- if (console) {
- set_noecho(fdm);
- }
- if (channels != NULL) {
- channels[0] = fdm; /* Input Stream. */
- channels[1] = fdm; /* Output Stream. */
- if (console) {
- /* close the write end of pipe1 */
- if (close(pipe2[1]) == -1)
- perror("close(pipe2[1])");
- channels[2] = pipe2[0]; /* stderr Stream. */
- } else {
- channels[2] = fdm; /* Error Stream. */
- }
- }
-
- free(full_path);
- return childpid;
- }
-
- free(full_path);
- return -1; /*NOT REACHED */
-}
-#ifdef __STAND_ALONE__
-int main(int argc, char **argv, char **envp) {
- const char *path = "./bufferring_test";
- int channels[3] = { -1, -1, -1};
- int status;
- FILE *app_stdin;
- FILE *app_stdout;
- FILE *app_stderr;
- char pts_name[32];
- int fdm;
- char buffer[32];
-
- fdm = ptym_open(pts_name);
- status = exec_pty(path, argv, envp, ".", channels, pts_name, fdm);
- if (status >= 0) {
- app_stdin = fdopen(channels[0], "w");
- app_stdout = fdopen(channels[1], "r");
- app_stderr = fdopen(channels[2], "r");
- if (app_stdout == NULL || app_stderr == NULL || app_stdin == NULL) {
- fprintf(stderr, "PROBLEMS\n");
- } else {
- fputs("foo\n", app_stdin);
- fputs("bar\n", app_stdin);
- while(fgets(buffer, sizeof buffer, app_stdout) != NULL) {
- fprintf(stdout, "STDOUT: %s\n", buffer);
- }
- while(fgets(buffer, sizeof buffer, app_stderr) != NULL) {
- fprintf(stdout, "STDERR: %s\n", buffer);
- }
- }
- }
- fputs("bye\n", stdout);
- close(channels[0]);
- close(channels[1]);
- close(channels[2]);
- return 0;
-}
-#endif
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * QNX Software Systems - initial API and implementation
+ * Wind River Systems, Inc.
+ * Mikhail Zabaluev (Nokia) - bug 82744
+ * Mikhail Sennikovsky - bug 145737
+ *******************************************************************************/
+#include "exec0.h"
+#include "openpty.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* from pfind.c */
+extern char *pfind(const char *name, char * const envp[]);
+
+pid_t
+exec_pty(const char *path, char *const argv[], char *const envp[],
+ const char *dirpath, int channels[3], const char *pts_name, int fdm, int console)
+{
+ int pipe2[2];
+ pid_t childpid;
+ char *full_path;
+
+ /*
+ * We use pfind() to check that the program exists and is an executable.
+ * If not pass the error up. Also execve() wants a full path.
+ */
+ full_path = pfind(path, envp);
+ if (full_path == NULL) {
+ fprintf(stderr, "Unable to find full path for \"%s\"\n", (path) ? path : "");
+ return -1;
+ }
+
+ /*
+ * Make sure we can create our pipes before forking.
+ */
+ if (channels != NULL && console) {
+ if (pipe(pipe2) < 0) {
+ fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+ free(full_path);
+ return -1;
+ }
+ }
+
+ childpid = fork();
+
+ if (childpid < 0) {
+ fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+ free(full_path);
+ return -1;
+ } else if (childpid == 0) { /* child */
+
+ chdir(dirpath);
+
+ if (channels != NULL) {
+ int fds;
+
+ if (!console && setsid() < 0) {
+ perror("setsid()");
+ return -1;
+ }
+
+ fds = ptys_open(fdm, pts_name);
+ if (fds < 0) {
+ fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
+ return -1;
+ }
+
+ /* Close the read end of pipe2 */
+ if (console && close(pipe2[0]) == -1) {
+ perror("close(pipe2[0]))");
+ }
+
+ /* close the master, no need in the child */
+ close(fdm);
+
+ if (console) {
+ set_noecho(fds);
+ if (setpgid(getpid(), getpid()) < 0) {
+ perror("setpgid()");
+ return -1;
+ }
+ }
+
+ /* redirections */
+ dup2(fds, STDIN_FILENO); /* dup stdin */
+ dup2(fds, STDOUT_FILENO); /* dup stdout */
+ if (console) {
+ dup2(pipe2[1], STDERR_FILENO); /* dup stderr */
+ } else {
+ dup2(fds, STDERR_FILENO); /* dup stderr */
+ }
+ close(fds); /* done with fds. */
+ }
+
+ /* Close all the fd's in the child */
+ {
+ int fdlimit = sysconf(_SC_OPEN_MAX);
+ int fd = 3;
+
+ while (fd < fdlimit)
+ close(fd++);
+ }
+
+ if (envp[0] == NULL) {
+ execv(full_path, argv);
+ } else {
+ execve(full_path, argv, envp);
+ }
+
+ _exit(127);
+
+ } else if (childpid != 0) { /* parent */
+ if (console) {
+ set_noecho(fdm);
+ }
+ if (channels != NULL) {
+ channels[0] = fdm; /* Input Stream. */
+ channels[1] = fdm; /* Output Stream. */
+ if (console) {
+ /* close the write end of pipe1 */
+ if (close(pipe2[1]) == -1)
+ perror("close(pipe2[1])");
+ channels[2] = pipe2[0]; /* stderr Stream. */
+ } else {
+ channels[2] = fdm; /* Error Stream. */
+ }
+ }
+
+ free(full_path);
+ return childpid;
+ }
+
+ free(full_path);
+ return -1; /*NOT REACHED */
+}
+#ifdef __STAND_ALONE__
+int main(int argc, char **argv, char **envp) {
+ const char *path = "./bufferring_test";
+ int channels[3] = { -1, -1, -1};
+ int status;
+ FILE *app_stdin;
+ FILE *app_stdout;
+ FILE *app_stderr;
+ char pts_name[32];
+ int fdm;
+ char buffer[32];
+
+ fdm = ptym_open(pts_name);
+ status = exec_pty(path, argv, envp, ".", channels, pts_name, fdm);
+ if (status >= 0) {
+ app_stdin = fdopen(channels[0], "w");
+ app_stdout = fdopen(channels[1], "r");
+ app_stderr = fdopen(channels[2], "r");
+ if (app_stdout == NULL || app_stderr == NULL || app_stdin == NULL) {
+ fprintf(stderr, "PROBLEMS\n");
+ } else {
+ fputs("foo\n", app_stdin);
+ fputs("bar\n", app_stdin);
+ while(fgets(buffer, sizeof buffer, app_stdout) != NULL) {
+ fprintf(stdout, "STDOUT: %s\n", buffer);
+ }
+ while(fgets(buffer, sizeof buffer, app_stderr) != NULL) {
+ fprintf(stdout, "STDERR: %s\n", buffer);
+ }
+ }
+ }
+ fputs("bye\n", stdout);
+ close(channels[0]);
+ close(channels[1]);
+ close(channels[2]);
+ return 0;
+}
+#endif
diff --git a/core/org.eclipse.cdt.core.macosx/plugin.properties b/core/org.eclipse.cdt.core.macosx/plugin.properties
index dda4771c596..3ea2577f208 100644
--- a/core/org.eclipse.cdt.core.macosx/plugin.properties
+++ b/core/org.eclipse.cdt.core.macosx/plugin.properties
@@ -1,2 +1,2 @@
-fragmentName.linux=C/C++ Development Tools Core for Mac OS X
-providerName=Eclipse CDT
+fragmentName.linux=C/C++ Development Tools Core for Mac OS X
+providerName=Eclipse CDT
diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/tests/filesystem/ram/MemoryEFSExtensionProvider.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/tests/filesystem/ram/MemoryEFSExtensionProvider.java
index 17039f287f6..0fde6d42f70 100644
--- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/tests/filesystem/ram/MemoryEFSExtensionProvider.java
+++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/tests/filesystem/ram/MemoryEFSExtensionProvider.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2012 Andrew Gvozdev and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andrew Gvozdev - initial API and implementation
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.core.internal.tests.filesystem.ram;
-
-import java.net.URI;
-
-import org.eclipse.cdt.core.EFSExtensionProvider;
-
-/**
- * Test stub to test EFSExtensionProvider mappings.
- *
- */
-public class MemoryEFSExtensionProvider extends EFSExtensionProvider {
-
- public String getMappedPath(URI locationURI) {
-
- String path = locationURI.getPath();
- if (path.contains("/BeingMappedFrom/Folder")) {
- return path.replaceFirst("/BeingMappedFrom/Folder", "/LocallyMappedTo/Folder");
- }
-
- return super.getMappedPath(locationURI);
- }
-
-}
+package org.eclipse.cdt.core.internal.tests.filesystem.ram;
+
+import java.net.URI;
+
+import org.eclipse.cdt.core.EFSExtensionProvider;
+
+/**
+ * Test stub to test EFSExtensionProvider mappings.
+ *
+ */
+public class MemoryEFSExtensionProvider extends EFSExtensionProvider {
+
+ public String getMappedPath(URI locationURI) {
+
+ String path = locationURI.getPath();
+ if (path.contains("/BeingMappedFrom/Folder")) {
+ return path.replaceFirst("/BeingMappedFrom/Folder", "/LocallyMappedTo/Folder");
+ }
+
+ return super.getMappedPath(locationURI);
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsProviderReferencedProjectsTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsProviderReferencedProjectsTests.java
index 7613f726fdb..a7c5811518d 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsProviderReferencedProjectsTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsProviderReferencedProjectsTests.java
@@ -1,302 +1,302 @@
-/*******************************************************************************
- * Copyright (c) 2013 Andrew Gvozdev and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andrew Gvozdev - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.language.settings.providers;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
-import org.eclipse.cdt.core.settings.model.ICSettingEntry;
-import org.eclipse.cdt.core.settings.model.util.CDataUtil;
-import org.eclipse.cdt.core.testplugin.ResourceHelper;
-import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
-import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Test cases testing ReferencedProjectsLanguageSettingsProvider functionality
- */
-public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCase {
- /**
- * Constructor.
- * @param name - name of the test.
- */
- public LanguageSettingsProviderReferencedProjectsTests(String name) {
- super(name);
-
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown(); // includes ResourceHelper cleanup
- }
-
- /**
- * @return - new TestSuite.
- */
- public static TestSuite suite() {
- return new TestSuite(LanguageSettingsProviderReferencedProjectsTests.class);
- }
-
- /**
- * main function of the class.
- *
- * @param args - arguments
- */
- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
- }
-
- /**
- * Helper method to fetch configuration descriptions.
- */
- private ICConfigurationDescription[] getConfigurationDescriptions(IProject project) {
- CoreModel coreModel = CoreModel.getDefault();
- ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
- // project description
- ICProjectDescription projectDescription = mngr.getProjectDescription(project, false);
- assertNotNull(projectDescription);
- assertEquals(1, projectDescription.getConfigurations().length);
- // configuration description
- ICConfigurationDescription[] cfgDescriptions = projectDescription.getConfigurations();
- return cfgDescriptions;
- }
-
- /**
- * Helper method to set reference project.
- */
- private void setReference(IProject project, final IProject projectReferenced) throws CoreException {
- {
- CoreModel coreModel = CoreModel.getDefault();
- ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
- // project description
- ICProjectDescription projectDescription = mngr.getProjectDescription(project);
- assertNotNull(projectDescription);
- assertEquals(1, projectDescription.getConfigurations().length);
- // configuration description
- ICConfigurationDescription[] cfgDescriptions = projectDescription.getConfigurations();
- ICConfigurationDescription cfgDescription = cfgDescriptions[0];
-
- final ICConfigurationDescription cfgDescriptionReferenced = getConfigurationDescriptions(projectReferenced)[0];
- cfgDescription.setReferenceInfo(new HashMap() {{ put(projectReferenced.getName(), cfgDescriptionReferenced.getId()); }});
- coreModel.setProjectDescription(project, projectDescription);
- }
-
- {
- // doublecheck that it's set as expected
- ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
- ICConfigurationDescription cfgDescription = cfgDescriptions[0];
- Map refs = cfgDescription.getReferenceInfo();
- assertEquals(1, refs.size());
- Set referencedProjectsNames = new LinkedHashSet(refs.keySet());
- assertEquals(projectReferenced.getName(), referencedProjectsNames.toArray()[0]);
- }
-
- }
-
- /**
- * Test that null arguments don't crash the provider.
- */
- public void testNulls() throws Exception {
- ILanguageSettingsProvider provider = LanguageSettingsManager.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
- assertNotNull(provider);
- List entries = provider.getSettingEntries(null, null, null);
- assertEquals(null, entries);
- }
-
- /**
- * Test main functionality of ReferencedProjectsLanguageSettingsProvider.
- */
- public void testReferencedProjectProvider() throws Exception {
- // Create model project and accompanied descriptions
- String projectName = getName();
- IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
- IProject nonReferencedProject = ResourceHelper.createCDTProjectWithConfig(projectName+"-non-referenced");
- IProject referencedProject = ResourceHelper.createCDTProjectWithConfig(projectName+"-referenced");
- setReference(project, referencedProject);
-
- // get cfgDescription
- ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
- ICConfigurationDescription cfgDescription = cfgDescriptions[0];
-
- {
- // double-check that provider for referenced projects is set in the configuration
- ILanguageSettingsProvider refProjectsProvider = LanguageSettingsManager.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
- assertNotNull(refProjectsProvider);
- List providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
- assertTrue(providers.contains(refProjectsProvider));
- }
-
- // Check that no setting entries are set initially
- {
- List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescription, project, null, ICSettingEntry.ALL);
- assertEquals(0, entries.size());
- }
-
- // Add an entry into a non-referenced project
- CIncludePathEntry nonRefEntry = CDataUtil.createCIncludePathEntry("non-referenced-exported", ICSettingEntry.EXPORTED);
- {
- ICConfigurationDescription[] nonRefCfgDescriptions = getConfigurationDescriptions(nonReferencedProject);
- ICConfigurationDescription nonRefCfgDescription = nonRefCfgDescriptions[0];
- List providersNonRef = ((ILanguageSettingsProvidersKeeper) nonRefCfgDescription).getLanguageSettingProviders();
- // get user provider which is the first one
- ILanguageSettingsProvider userProviderNonRef = providersNonRef.get(0);
- assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderNonRef.getId());
- assertTrue(userProviderNonRef instanceof LanguageSettingsGenericProvider);
- // add sample entries
- ArrayList entries = new ArrayList();
- entries.add(nonRefEntry);
- ((LanguageSettingsGenericProvider) userProviderNonRef).setSettingEntries(null, null, null, entries);
- }
- // Confirm that that does not add entries to the main project
- {
- List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescription, project, null, ICSettingEntry.ALL);
- assertEquals(0, entries.size());
- }
-
- CIncludePathEntry refEntry = CDataUtil.createCIncludePathEntry("referenced-exported", ICSettingEntry.EXPORTED);
- // Add entries into a referenced project
- {
- ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(referencedProject);
- ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
- List providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription).getLanguageSettingProviders();
- // get user provider which is the first one
- ILanguageSettingsProvider userProviderRef = providersRef.get(0);
- assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
- assertTrue(userProviderRef instanceof LanguageSettingsGenericProvider);
- // add sample entries
- ArrayList entries = new ArrayList();
- CIncludePathEntry refEntryNotExported = CDataUtil.createCIncludePathEntry("referenced-not-exported", 0);
- entries.add(refEntry);
- entries.add(refEntryNotExported);
- ((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries(null, null, null, entries);
- List entriesActual = LanguageSettingsManager.getSettingEntriesByKind(refCfgDescription, project, null, ICSettingEntry.ALL);
- assertEquals(entries, entriesActual);
- }
- // Check that the new entries from referenced project made it to the main project
- {
- List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescription, project, null, ICSettingEntry.ALL);
- assertEquals(CDataUtil.createCIncludePathEntry(refEntry.getName(), 0), entries.get(0));
- assertEquals(1, entries.size());
- }
- }
-
- /**
- * Test case when projects reference each other recursively.
- */
- public void testRecursiveReferences() throws Exception {
- // Create model projects that reference each other
- String projectName = getName();
- IProject projectA = ResourceHelper.createCDTProjectWithConfig(projectName + "-A");
- IProject projectB = ResourceHelper.createCDTProjectWithConfig(projectName + "-B");
- setReference(projectA, projectB);
- setReference(projectB, projectA);
-
- {
- // get cfgDescriptions to work with
- ICConfigurationDescription[] cfgDescriptionsA = getConfigurationDescriptions(projectA);
- ICConfigurationDescription cfgDescriptionA = cfgDescriptionsA[0];
- ICConfigurationDescription[] cfgDescriptionsB = getConfigurationDescriptions(projectB);
- ICConfigurationDescription cfgDescriptionB = cfgDescriptionsB[0];
- // double-check that provider for referenced projects is set in the configurations
- ILanguageSettingsProvider refProjectsProvider = LanguageSettingsManager.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
- assertNotNull(refProjectsProvider);
- List providersA = ((ILanguageSettingsProvidersKeeper) cfgDescriptionA).getLanguageSettingProviders();
- assertTrue(providersA.contains(refProjectsProvider));
- List providersB = ((ILanguageSettingsProvidersKeeper) cfgDescriptionB).getLanguageSettingProviders();
- assertTrue(providersB.contains(refProjectsProvider));
-
- // Check that no setting entries are set initially
- List entriesA = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionA, projectA, null, ICSettingEntry.ALL);
- assertEquals(0, entriesA.size());
- List entriesB = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionA, projectB, null, ICSettingEntry.ALL);
- assertEquals(0, entriesB.size());
- }
-
- CIncludePathEntry entryExportedA = CDataUtil.createCIncludePathEntry("referenced-exported-A", ICSettingEntry.EXPORTED);
- CIncludePathEntry entryNotExportedA = CDataUtil.createCIncludePathEntry("referenced-not-exported-A", 0);
- // Add entries into a project A
- {
- ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(projectA);
- ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
- List providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription).getLanguageSettingProviders();
- // get user provider which is the first one
- ILanguageSettingsProvider userProviderRef = providersRef.get(0);
- assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
- assertTrue(userProviderRef instanceof LanguageSettingsGenericProvider);
- // add sample entries
- ArrayList entries = new ArrayList();
- entries.add(entryExportedA);
- entries.add(entryNotExportedA);
- ((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries(null, null, null, entries);
- }
-
- CIncludePathEntry entryExportedB = CDataUtil.createCIncludePathEntry("referenced-exported-B", ICSettingEntry.EXPORTED);
- CIncludePathEntry entryNotExportedB = CDataUtil.createCIncludePathEntry("referenced-not-exported-B", 0);
- // Add entries into a project B
- {
- ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(projectB);
- ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
- List providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription).getLanguageSettingProviders();
- // get user provider which is the first one
- ILanguageSettingsProvider userProviderRef = providersRef.get(0);
- assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
- assertTrue(userProviderRef instanceof LanguageSettingsGenericProvider);
- // add sample entries
- ArrayList entries = new ArrayList();
- entries.add(entryExportedB);
- entries.add(entryNotExportedB);
- ((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries(null, null, null, entries);
- }
-
- // Check that the new entries from projectB made it to projectA
- {
- ICConfigurationDescription[] cfgDescriptionsA = getConfigurationDescriptions(projectA);
- ICConfigurationDescription cfgDescriptionA = cfgDescriptionsA[0];
- List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionA, projectA, null, ICSettingEntry.ALL);
- assertEquals(entryExportedA, entries.get(0));
- assertEquals(entryNotExportedA, entries.get(1));
- assertEquals(CDataUtil.createCIncludePathEntry(entryExportedB.getName(), 0), entries.get(2));
- assertEquals(3, entries.size());
- }
- // Check that the new entries from projectA made it to projectB
- {
- ICConfigurationDescription[] cfgDescriptionsB = getConfigurationDescriptions(projectB);
- ICConfigurationDescription cfgDescriptionB = cfgDescriptionsB[0];
- List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionB, projectB, null, ICSettingEntry.ALL);
- assertEquals(entryExportedB, entries.get(0));
- assertEquals(entryNotExportedB, entries.get(1));
- assertEquals(CDataUtil.createCIncludePathEntry(entryExportedA.getName(), 0), entries.get(2));
- assertEquals(3, entries.size());
- }
-
- // Hopefully it gets here without stack overflow
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2013 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.core.language.settings.providers;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
+import org.eclipse.cdt.core.settings.model.ICSettingEntry;
+import org.eclipse.cdt.core.settings.model.util.CDataUtil;
+import org.eclipse.cdt.core.testplugin.ResourceHelper;
+import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
+import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Test cases testing ReferencedProjectsLanguageSettingsProvider functionality
+ */
+public class LanguageSettingsProviderReferencedProjectsTests extends BaseTestCase {
+ /**
+ * Constructor.
+ * @param name - name of the test.
+ */
+ public LanguageSettingsProviderReferencedProjectsTests(String name) {
+ super(name);
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown(); // includes ResourceHelper cleanup
+ }
+
+ /**
+ * @return - new TestSuite.
+ */
+ public static TestSuite suite() {
+ return new TestSuite(LanguageSettingsProviderReferencedProjectsTests.class);
+ }
+
+ /**
+ * main function of the class.
+ *
+ * @param args - arguments
+ */
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+
+ /**
+ * Helper method to fetch configuration descriptions.
+ */
+ private ICConfigurationDescription[] getConfigurationDescriptions(IProject project) {
+ CoreModel coreModel = CoreModel.getDefault();
+ ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
+ // project description
+ ICProjectDescription projectDescription = mngr.getProjectDescription(project, false);
+ assertNotNull(projectDescription);
+ assertEquals(1, projectDescription.getConfigurations().length);
+ // configuration description
+ ICConfigurationDescription[] cfgDescriptions = projectDescription.getConfigurations();
+ return cfgDescriptions;
+ }
+
+ /**
+ * Helper method to set reference project.
+ */
+ private void setReference(IProject project, final IProject projectReferenced) throws CoreException {
+ {
+ CoreModel coreModel = CoreModel.getDefault();
+ ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
+ // project description
+ ICProjectDescription projectDescription = mngr.getProjectDescription(project);
+ assertNotNull(projectDescription);
+ assertEquals(1, projectDescription.getConfigurations().length);
+ // configuration description
+ ICConfigurationDescription[] cfgDescriptions = projectDescription.getConfigurations();
+ ICConfigurationDescription cfgDescription = cfgDescriptions[0];
+
+ final ICConfigurationDescription cfgDescriptionReferenced = getConfigurationDescriptions(projectReferenced)[0];
+ cfgDescription.setReferenceInfo(new HashMap() {{ put(projectReferenced.getName(), cfgDescriptionReferenced.getId()); }});
+ coreModel.setProjectDescription(project, projectDescription);
+ }
+
+ {
+ // doublecheck that it's set as expected
+ ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
+ ICConfigurationDescription cfgDescription = cfgDescriptions[0];
+ Map refs = cfgDescription.getReferenceInfo();
+ assertEquals(1, refs.size());
+ Set referencedProjectsNames = new LinkedHashSet(refs.keySet());
+ assertEquals(projectReferenced.getName(), referencedProjectsNames.toArray()[0]);
+ }
+
+ }
+
+ /**
+ * Test that null arguments don't crash the provider.
+ */
+ public void testNulls() throws Exception {
+ ILanguageSettingsProvider provider = LanguageSettingsManager.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
+ assertNotNull(provider);
+ List entries = provider.getSettingEntries(null, null, null);
+ assertEquals(null, entries);
+ }
+
+ /**
+ * Test main functionality of ReferencedProjectsLanguageSettingsProvider.
+ */
+ public void testReferencedProjectProvider() throws Exception {
+ // Create model project and accompanied descriptions
+ String projectName = getName();
+ IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
+ IProject nonReferencedProject = ResourceHelper.createCDTProjectWithConfig(projectName+"-non-referenced");
+ IProject referencedProject = ResourceHelper.createCDTProjectWithConfig(projectName+"-referenced");
+ setReference(project, referencedProject);
+
+ // get cfgDescription
+ ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
+ ICConfigurationDescription cfgDescription = cfgDescriptions[0];
+
+ {
+ // double-check that provider for referenced projects is set in the configuration
+ ILanguageSettingsProvider refProjectsProvider = LanguageSettingsManager.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
+ assertNotNull(refProjectsProvider);
+ List providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
+ assertTrue(providers.contains(refProjectsProvider));
+ }
+
+ // Check that no setting entries are set initially
+ {
+ List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescription, project, null, ICSettingEntry.ALL);
+ assertEquals(0, entries.size());
+ }
+
+ // Add an entry into a non-referenced project
+ CIncludePathEntry nonRefEntry = CDataUtil.createCIncludePathEntry("non-referenced-exported", ICSettingEntry.EXPORTED);
+ {
+ ICConfigurationDescription[] nonRefCfgDescriptions = getConfigurationDescriptions(nonReferencedProject);
+ ICConfigurationDescription nonRefCfgDescription = nonRefCfgDescriptions[0];
+ List providersNonRef = ((ILanguageSettingsProvidersKeeper) nonRefCfgDescription).getLanguageSettingProviders();
+ // get user provider which is the first one
+ ILanguageSettingsProvider userProviderNonRef = providersNonRef.get(0);
+ assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderNonRef.getId());
+ assertTrue(userProviderNonRef instanceof LanguageSettingsGenericProvider);
+ // add sample entries
+ ArrayList entries = new ArrayList();
+ entries.add(nonRefEntry);
+ ((LanguageSettingsGenericProvider) userProviderNonRef).setSettingEntries(null, null, null, entries);
+ }
+ // Confirm that that does not add entries to the main project
+ {
+ List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescription, project, null, ICSettingEntry.ALL);
+ assertEquals(0, entries.size());
+ }
+
+ CIncludePathEntry refEntry = CDataUtil.createCIncludePathEntry("referenced-exported", ICSettingEntry.EXPORTED);
+ // Add entries into a referenced project
+ {
+ ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(referencedProject);
+ ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
+ List providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription).getLanguageSettingProviders();
+ // get user provider which is the first one
+ ILanguageSettingsProvider userProviderRef = providersRef.get(0);
+ assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
+ assertTrue(userProviderRef instanceof LanguageSettingsGenericProvider);
+ // add sample entries
+ ArrayList entries = new ArrayList();
+ CIncludePathEntry refEntryNotExported = CDataUtil.createCIncludePathEntry("referenced-not-exported", 0);
+ entries.add(refEntry);
+ entries.add(refEntryNotExported);
+ ((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries(null, null, null, entries);
+ List entriesActual = LanguageSettingsManager.getSettingEntriesByKind(refCfgDescription, project, null, ICSettingEntry.ALL);
+ assertEquals(entries, entriesActual);
+ }
+ // Check that the new entries from referenced project made it to the main project
+ {
+ List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescription, project, null, ICSettingEntry.ALL);
+ assertEquals(CDataUtil.createCIncludePathEntry(refEntry.getName(), 0), entries.get(0));
+ assertEquals(1, entries.size());
+ }
+ }
+
+ /**
+ * Test case when projects reference each other recursively.
+ */
+ public void testRecursiveReferences() throws Exception {
+ // Create model projects that reference each other
+ String projectName = getName();
+ IProject projectA = ResourceHelper.createCDTProjectWithConfig(projectName + "-A");
+ IProject projectB = ResourceHelper.createCDTProjectWithConfig(projectName + "-B");
+ setReference(projectA, projectB);
+ setReference(projectB, projectA);
+
+ {
+ // get cfgDescriptions to work with
+ ICConfigurationDescription[] cfgDescriptionsA = getConfigurationDescriptions(projectA);
+ ICConfigurationDescription cfgDescriptionA = cfgDescriptionsA[0];
+ ICConfigurationDescription[] cfgDescriptionsB = getConfigurationDescriptions(projectB);
+ ICConfigurationDescription cfgDescriptionB = cfgDescriptionsB[0];
+ // double-check that provider for referenced projects is set in the configurations
+ ILanguageSettingsProvider refProjectsProvider = LanguageSettingsManager.getWorkspaceProvider(ReferencedProjectsLanguageSettingsProvider.ID);
+ assertNotNull(refProjectsProvider);
+ List providersA = ((ILanguageSettingsProvidersKeeper) cfgDescriptionA).getLanguageSettingProviders();
+ assertTrue(providersA.contains(refProjectsProvider));
+ List providersB = ((ILanguageSettingsProvidersKeeper) cfgDescriptionB).getLanguageSettingProviders();
+ assertTrue(providersB.contains(refProjectsProvider));
+
+ // Check that no setting entries are set initially
+ List entriesA = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionA, projectA, null, ICSettingEntry.ALL);
+ assertEquals(0, entriesA.size());
+ List entriesB = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionA, projectB, null, ICSettingEntry.ALL);
+ assertEquals(0, entriesB.size());
+ }
+
+ CIncludePathEntry entryExportedA = CDataUtil.createCIncludePathEntry("referenced-exported-A", ICSettingEntry.EXPORTED);
+ CIncludePathEntry entryNotExportedA = CDataUtil.createCIncludePathEntry("referenced-not-exported-A", 0);
+ // Add entries into a project A
+ {
+ ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(projectA);
+ ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
+ List providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription).getLanguageSettingProviders();
+ // get user provider which is the first one
+ ILanguageSettingsProvider userProviderRef = providersRef.get(0);
+ assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
+ assertTrue(userProviderRef instanceof LanguageSettingsGenericProvider);
+ // add sample entries
+ ArrayList entries = new ArrayList();
+ entries.add(entryExportedA);
+ entries.add(entryNotExportedA);
+ ((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries(null, null, null, entries);
+ }
+
+ CIncludePathEntry entryExportedB = CDataUtil.createCIncludePathEntry("referenced-exported-B", ICSettingEntry.EXPORTED);
+ CIncludePathEntry entryNotExportedB = CDataUtil.createCIncludePathEntry("referenced-not-exported-B", 0);
+ // Add entries into a project B
+ {
+ ICConfigurationDescription[] refCfgDescriptions = getConfigurationDescriptions(projectB);
+ ICConfigurationDescription refCfgDescription = refCfgDescriptions[0];
+ List providersRef = ((ILanguageSettingsProvidersKeeper) refCfgDescription).getLanguageSettingProviders();
+ // get user provider which is the first one
+ ILanguageSettingsProvider userProviderRef = providersRef.get(0);
+ assertEquals(ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID, userProviderRef.getId());
+ assertTrue(userProviderRef instanceof LanguageSettingsGenericProvider);
+ // add sample entries
+ ArrayList entries = new ArrayList();
+ entries.add(entryExportedB);
+ entries.add(entryNotExportedB);
+ ((LanguageSettingsGenericProvider) userProviderRef).setSettingEntries(null, null, null, entries);
+ }
+
+ // Check that the new entries from projectB made it to projectA
+ {
+ ICConfigurationDescription[] cfgDescriptionsA = getConfigurationDescriptions(projectA);
+ ICConfigurationDescription cfgDescriptionA = cfgDescriptionsA[0];
+ List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionA, projectA, null, ICSettingEntry.ALL);
+ assertEquals(entryExportedA, entries.get(0));
+ assertEquals(entryNotExportedA, entries.get(1));
+ assertEquals(CDataUtil.createCIncludePathEntry(entryExportedB.getName(), 0), entries.get(2));
+ assertEquals(3, entries.size());
+ }
+ // Check that the new entries from projectA made it to projectB
+ {
+ ICConfigurationDescription[] cfgDescriptionsB = getConfigurationDescriptions(projectB);
+ ICConfigurationDescription cfgDescriptionB = cfgDescriptionsB[0];
+ List entries = LanguageSettingsManager.getSettingEntriesByKind(cfgDescriptionB, projectB, null, ICSettingEntry.ALL);
+ assertEquals(entryExportedB, entries.get(0));
+ assertEquals(entryNotExportedB, entries.get(1));
+ assertEquals(CDataUtil.createCIncludePathEntry(entryExportedA.getName(), 0), entries.get(2));
+ assertEquals(3, entries.size());
+ }
+
+ // Hopefully it gets here without stack overflow
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java
index 72ee4c50cfe..9d9bce06f51 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsScannerInfoProviderTests.java
@@ -1,958 +1,958 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2012 Andrew Gvozdev and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Andrew Gvozdev - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.core.language.settings.providers;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.core.model.ILanguage;
-import org.eclipse.cdt.core.model.LanguageManager;
-import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
-import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
-import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
-import org.eclipse.cdt.core.settings.model.CMacroEntry;
-import org.eclipse.cdt.core.settings.model.CMacroFileEntry;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICFolderDescription;
-import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
-import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.core.settings.model.ICSettingEntry;
-import org.eclipse.cdt.core.testplugin.ResourceHelper;
-import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
-import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsScannerInfoProvider;
-import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-/**
- * Test cases testing LanguageSettingsProvider functionality
- */
-public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
- private static final IFile FAKE_FILE = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/project/path0"));
- private static final String PROVIDER_ID = "test.provider.id";
- private static final String PROVIDER_ID_2 = "test.provider.id.2";
- private static final String PROVIDER_NAME = "test.provider.name";
-
- // constants for getProjectDescription()
- private static final boolean READ_ONLY = false;
- private static final boolean WRITEABLE = true;
-
- private class MockProvider extends LanguageSettingsBaseProvider implements ILanguageSettingsProvider {
- private final List entries;
-
- public MockProvider(String id, String name, List entries) {
- super(id, name);
- this.entries = entries;
- }
-
- @Override
- public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
- return entries;
- }
- }
-
- /**
- * Constructor.
- * @param name - name of the test.
- */
- public LanguageSettingsScannerInfoProviderTests(String name) {
- super(name);
-
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown(); // includes ResourceHelper cleanup
- }
-
- /**
- * @return - new TestSuite.
- */
- public static TestSuite suite() {
- return new TestSuite(LanguageSettingsScannerInfoProviderTests.class);
- }
-
- /**
- * main function of the class.
- *
- * @param args - arguments
- */
- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
- }
-
- /**
- * Sets build working directory for DefaultSettingConfiguration being tested.
- */
- private void setBuilderCWD(IProject project, IPath buildCWD) throws CoreException {
- CProjectDescriptionManager manager = CProjectDescriptionManager.getInstance();
- {
- ICProjectDescription prjDescription = manager.getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
-
- cfgDescription.getBuildSetting().setBuilderCWD(buildCWD);
- manager.setProjectDescription(project, prjDescription);
- // doublecheck builderCWD
- IPath actualBuildCWD = cfgDescription.getBuildSetting().getBuilderCWD();
- assertEquals(buildCWD, actualBuildCWD);
- }
- {
- // triplecheck builderCWD for different project/configuration descriptions
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
-
- }
- }
-
- /**
- * Test cases when some objects are null.
- */
- public void testNulls() throws Exception {
- {
- // Handle project==null
- IResource root = ResourcesPlugin.getWorkspace().getRoot();
- assertNull(root.getProject());
-
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(root);
- assertEquals(0, info.getIncludePaths().length);
- assertEquals(0, info.getDefinedSymbols().size());
- assertEquals(0, info.getIncludeFiles().length);
- assertEquals(0, info.getMacroFiles().length);
- assertEquals(0, info.getLocalIncludePath().length);
- }
-
- {
- // Handle prjDescription==null
- IProject project = FAKE_FILE.getProject();
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
- assertNull(prjDescription);
-
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(FAKE_FILE);
- assertEquals(0, info.getIncludePaths().length);
- assertEquals(0, info.getDefinedSymbols().size());
- assertEquals(0, info.getIncludeFiles().length);
- assertEquals(0, info.getMacroFiles().length);
- assertEquals(0, info.getLocalIncludePath().length);
- }
-
- {
- // Handle language==null
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- IFile file = ResourceHelper.createFile(project, "file");
-
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- ILanguage language = LanguageManager.getInstance().getLanguageForFile(file, cfgDescription);
- assertNull(language);
-
- // AG FIXME - temporarily ignore the entry in the log
- setExpectedNumberOfLoggedNonOKStatusObjects(1);
-
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- assertEquals(0, info.getIncludePaths().length);
- assertEquals(0, info.getDefinedSymbols().size());
- assertEquals(0, info.getIncludeFiles().length);
- assertEquals(0, info.getMacroFiles().length);
- assertEquals(0, info.getLocalIncludePath().length);
- }
- }
-
- /**
- * Test empty scanner info.
- */
- public void testEmpty() throws Exception {
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // confirm that language==null
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- ILanguage language = LanguageManager.getInstance().getLanguageForFile(file, cfgDescription);
- assertNotNull(language);
-
- // test that the info is empty
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- assertEquals(0, info.getIncludePaths().length);
- assertEquals(0, info.getDefinedSymbols().size());
- assertEquals(0, info.getIncludeFiles().length);
- assertEquals(0, info.getMacroFiles().length);
- assertEquals(0, info.getLocalIncludePath().length);
- }
-
- /**
- * Test regular cases.
- */
- public void testRegular() throws Exception {
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // sanity test of language
- ILanguage language = LanguageManager.getInstance().getLanguageForFile(file, cfgDescription);
- assertNotNull(language);
-
- // contribute the entries
- IFolder includeFolder = ResourceHelper.createFolder(project, "/include-path");
- IFolder includeLocalFolder = ResourceHelper.createFolder(project, "/local-include-path");
- IFile macroFile = ResourceHelper.createFile(project, "macro-file");
- IFile includeFile = ResourceHelper.createFile(project, "include-file");
-
- CIncludePathEntry includePathEntry = new CIncludePathEntry(includeFolder, 0);
- CIncludePathEntry includeLocalPathEntry = new CIncludePathEntry(includeLocalFolder, ICSettingEntry.LOCAL); // #include "..."
- CMacroEntry macroEntry = new CMacroEntry("MACRO", "value",0);
- CIncludeFileEntry includeFileEntry = new CIncludeFileEntry(includeFile, 0);
- CMacroFileEntry macroFileEntry = new CMacroFileEntry(macroFile, 0);
-
- List entries = new ArrayList();
- entries.add(includePathEntry);
- entries.add(includeLocalPathEntry);
- entries.add(macroEntry);
- entries.add(includeFileEntry);
- entries.add(macroFileEntry);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test that the scannerInfoProvider gets the entries
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
- Map actualDefinedSymbols = info.getDefinedSymbols();
- String[] actualIncludeFiles = info.getIncludeFiles();
- String[] actualMacroFiles = info.getMacroFiles();
- String[] actualLocalIncludePath = info.getLocalIncludePath();
- // include paths
- assertEquals(includeFolder.getLocation(), new Path(actualIncludePaths[0]));
- assertEquals(1, actualIncludePaths.length);
- // macros
- assertEquals(macroEntry.getValue(), actualDefinedSymbols.get(macroEntry.getName()));
- assertEquals(1, actualDefinedSymbols.size());
- // include file
- assertEquals(includeFile.getLocation(), new Path(actualIncludeFiles[0]));
- assertEquals(1, actualIncludeFiles.length);
- // macro file
- assertEquals(macroFile.getLocation(), new Path(actualMacroFiles[0]));
- assertEquals(1, actualMacroFiles.length);
- // local include files
- assertEquals(includeLocalFolder.getLocation(), new Path(actualLocalIncludePath[0]));
- assertEquals(1, actualLocalIncludePath.length);
- }
-
- /**
- * Test "local" flag (#include "...").
- */
- public void testLocal() throws Exception {
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // contribute the entries
- IFolder incFolder = ResourceHelper.createFolder(project, "include");
- IFolder incFolder2 = ResourceHelper.createFolder(project, "include2");
- CIncludePathEntry includePathEntry = new CIncludePathEntry(incFolder, 0);
- CIncludePathEntry includeLocalPathEntry = new CIncludePathEntry(incFolder, ICSettingEntry.LOCAL); // #include "..."
- CIncludePathEntry includeLocalPathEntry2 = new CIncludePathEntry(incFolder2, ICSettingEntry.LOCAL); // #include "..."
- CIncludePathEntry includePathEntry2 = new CIncludePathEntry(incFolder2, 0);
-
- List entries = new ArrayList();
- entries.add(includePathEntry);
- entries.add(includeLocalPathEntry);
- // reverse order for incPath2
- entries.add(includeLocalPathEntry2);
- entries.add(includePathEntry2);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test that the scannerInfoProvider gets the entries
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
- String[] actualLocalIncludePath = info.getLocalIncludePath();
- // include paths
- assertEquals(incFolder.getLocation(), new Path(actualIncludePaths[0]));
- assertEquals(incFolder2.getLocation(), new Path(actualIncludePaths[1]));
- assertEquals(2, actualIncludePaths.length);
- // local include files
- assertEquals(incFolder.getLocation(), new Path(actualLocalIncludePath[0]));
- assertEquals(incFolder2.getLocation(), new Path(actualLocalIncludePath[1]));
- assertEquals(2, actualLocalIncludePath.length);
- }
-
- /**
- * Test Mac frameworks.
- */
- public void testFramework() throws Exception {
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // contribute the entries
- IFolder frameworkFolder = ResourceHelper.createFolder(project, "Fmwk");
- CIncludePathEntry frameworkPathEntry = new CIncludePathEntry(frameworkFolder, ICSettingEntry.FRAMEWORKS_MAC);
-
- List entries = new ArrayList();
- entries.add(frameworkPathEntry);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test that the scannerInfoProvider gets the entries
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
- // include paths
- assertEquals(frameworkFolder.getLocation().append("/__framework__.framework/Headers/__header__"),
- new Path(actualIncludePaths[0]));
- assertEquals(frameworkFolder.getLocation().append("/__framework__.framework/PrivateHeaders/__header__"),
- new Path(actualIncludePaths[1]));
- assertEquals(2, actualIncludePaths.length);
- }
-
- /**
- * Test duplicate entries.
- */
- public void testDuplicate() throws Exception {
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // contribute the entries
- IFolder incFolder = ResourceHelper.createFolder(project, "include");
- CIncludePathEntry includePathEntry = new CIncludePathEntry(incFolder, 0);
- CIncludePathEntry includeLocalPathEntry = new CIncludePathEntry(incFolder, ICSettingEntry.LOCAL); // #include "..."
- CIncludePathEntry includePathEntry2 = new CIncludePathEntry(incFolder, 0);
- CIncludePathEntry includeLocalPathEntry2 = new CIncludePathEntry(incFolder, ICSettingEntry.LOCAL); // #include "..."
-
- List entries = new ArrayList();
- entries.add(includePathEntry);
- entries.add(includeLocalPathEntry);
- entries.add(includePathEntry2);
- entries.add(includeLocalPathEntry2);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test that the scannerInfoProvider gets the entries
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
- String[] actualLocalIncludePath = info.getLocalIncludePath();
- // include paths
- assertEquals(incFolder.getLocation(), new Path(actualIncludePaths[0]));
- assertEquals(1, actualIncludePaths.length);
- // local include files
- assertEquals(incFolder.getLocation(), new Path(actualLocalIncludePath[0]));
- assertEquals(1, actualLocalIncludePath.length);
- }
-
- /**
- * Test include path managed by eclipse as a workspace path.
- */
- public void testWorkspacePath() throws Exception {
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // create sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
- // eclipse-managed folder in workspace
- IFolder incWorkspace_1 = ResourceHelper.createFolder(project, "include_1");
- IPath incWorkspaceLocation_1 = incWorkspace_1.getLocation();
- IFolder incWorkspace_2 = ResourceHelper.createFolder(project, "include_2");
- IPath incWorkspacePath_2 = incWorkspace_2.getFullPath();
- IPath incWorkspaceLocation_2 = incWorkspace_2.getLocation();
- IFolder incWorkspace_3 = ResourceHelper.createFolder(project, "include_3");
- // "relative" should make no difference for VALUE_WORKSPACE_PATH
- IPath incWorkspaceRelativePath_3 = incWorkspace_3.getFullPath().makeRelative();
- IPath incWorkspaceLocation_3 = incWorkspace_3.getLocation();
- // not having "RESOLVED" should make no difference for well formed path
- IFolder incWorkspace_4 = ResourceHelper.createFolder(project, "include_4");
- IPath incWorkspacePathNoResolved_4 = incWorkspace_4.getFullPath();
- IPath incWorkspaceLocation_4 = incWorkspace_4.getLocation();
- // folder defined by absolute path on the filesystem
- IPath incFilesystem = ResourceHelper.createWorkspaceFolder("includeFilesystem");
-
- // contribute the entries
- CIncludePathEntry incWorkspaceEntry_1 = new CIncludePathEntry(incWorkspace_1, 0);
- CIncludePathEntry incWorkspaceEntry_2 = new CIncludePathEntry(incWorkspacePath_2, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
- CIncludePathEntry incWorkspaceEntry_3 = new CIncludePathEntry(incWorkspaceRelativePath_3, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
- CIncludePathEntry incWorkspaceEntry_4 = new CIncludePathEntry(incWorkspacePathNoResolved_4, ICSettingEntry.VALUE_WORKSPACE_PATH);
- CIncludePathEntry incFilesystemEntry = new CIncludePathEntry(incFilesystem, 0);
-
- List entries = new ArrayList();
- entries.add(incWorkspaceEntry_1);
- entries.add(incWorkspaceEntry_2);
- entries.add(incWorkspaceEntry_3);
- entries.add(incWorkspaceEntry_4);
- entries.add(incFilesystemEntry);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test the entries received from the scannerInfoProvider
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
-
- assertEquals(incWorkspaceLocation_1, new Path(actualIncludePaths[0]));
- assertEquals(incWorkspaceLocation_2, new Path(actualIncludePaths[1]));
- assertEquals(incWorkspaceLocation_3, new Path(actualIncludePaths[2]));
- assertEquals(incWorkspaceLocation_4, new Path(actualIncludePaths[3]));
- assertEquals(incFilesystem, new Path(actualIncludePaths[4]));
- assertEquals(5, actualIncludePaths.length);
-
- }
-
- /**
- * Confirm that device letter is prepended on filesystems that support that.
- */
- public void testFilesystemPathNoDriveLetter() throws Exception {
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- // change drive on build working directory
- String buildCwdDevice = project.getLocation().getDevice();
-
-// // Test manually with a device which is different from project location device (path should exist)
-// IPath buildCWD = new Path("D:/build/path");
-// String buildCwdDevice = buildCWD.getDevice();
-
- // get project/configuration descriptions
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // create sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // contribute the entries
- // no-drive-letter folder defined by absolute path on the filesystem
- IPath incFilesystem = ResourceHelper.createWorkspaceFolder("includeFilesystem").setDevice(null);
- CIncludePathEntry incFilesystemEntry = new CIncludePathEntry(incFilesystem, 0);
- List entries = new ArrayList();
- entries.add(incFilesystemEntry);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test the entries received from the scannerInfoProvider
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
-
- IPath expectedInclude = incFilesystem.setDevice(buildCwdDevice);
- assertEquals(expectedInclude, new Path(actualIncludePaths[0]));
- assertEquals(1, actualIncludePaths.length);
- }
-
- /**
- * Test relative paths.
- */
- public void testRelativePath() throws Exception {
- // create a project
- String prjName = getName();
- IProject project = ResourceHelper.createCDTProjectWithConfig(prjName);
- String relativePath = "include";
- IFolder buildFolder = ResourceHelper.createFolder(project, "buildDir");
- IFolder relativeFolder = ResourceHelper.createFolder(project, "buildDir/"+relativePath);
- IFolder relativeFolderProjName = ResourceHelper.createFolder(project, "buildDir/"+prjName);
- String markedResolved = "-MarkedResolved";
- IFolder relativeFolderProjNameResolved = ResourceHelper.createFolder(project, "buildDir/" + prjName+markedResolved);
- IPath buildCWD=buildFolder.getLocation();
- setBuilderCWD(project, buildCWD);
-
- // get project/configuration descriptions
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // create sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // contribute the entries
- CIncludePathEntry incRelativeEntry = new CIncludePathEntry(new Path(relativePath), 0);
- CIncludePathEntry incProjNameEntry = new CIncludePathEntry(new Path("${ProjName}"), 0);
- CIncludePathEntry incProjNameMarkedResolvedEntry = new CIncludePathEntry(new Path("${ProjName}"+markedResolved), ICSettingEntry.RESOLVED);
- List entries = new ArrayList();
- entries.add(incRelativeEntry);
- entries.add(incProjNameEntry);
- entries.add(incProjNameMarkedResolvedEntry);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test the entries received from the scannerInfoProvider
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
-
- // pair of entries, one from build dir another relative path
- assertEquals(relativeFolder.getLocation(), new Path(actualIncludePaths[0]));
- assertEquals(new Path(relativePath), new Path(actualIncludePaths[1]));
-
- // pair of entries, one resolved from build dir another expanded relative path
- assertEquals(relativeFolderProjName.getLocation(), new Path(actualIncludePaths[2]));
- assertEquals(new Path(prjName), new Path(actualIncludePaths[3]));
-
- // if marked RESOLVED only that path stays
- assertEquals(new Path("${ProjName}"+markedResolved), new Path(actualIncludePaths[4]));
-
- assertEquals(5, actualIncludePaths.length);
- }
-
- /**
- * Test relative paths - some combinations of dot paths.
- */
- public void testRelativePathWithDots() throws Exception {
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- // set build CWD
- IFolder buildFolder = ResourceHelper.createFolder(project, "buildDir");
- IPath buildCWD=buildFolder.getLocation();
- setBuilderCWD(project, buildCWD);
-
- // define a few variations of paths
- String relativePath_dot = ".";
- String relativePath_dot_slash = "./";
- String relativePath_dot_slash_path = "./include";
- IFolder relativeFolder_dot_slash_path = ResourceHelper.createFolder(project, "buildDir/include");
- String relativePath_dotdot = "..";
- String relativePath_dotdot_slash = "../";
- String relativePath_dotdot_slash_path = "../include";
- IFolder relativeFolder_dotdot_slash_path = ResourceHelper.createFolder(project, "include");
- String locationPath_dotdot_path = buildCWD.toString()+"/../include2";
- IFolder incFolder_dotdot_slash_path = ResourceHelper.createFolder(project, "include2"); // "/ProjPath/buildDir/../include2"
-
- // get project/configuration descriptions
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // create sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // contribute the entries
- CIncludePathEntry incRelativeEntry_dot = new CIncludePathEntry(new Path(relativePath_dot), 0);
- CIncludePathEntry incRelativeEntry_dot_slash_path = new CIncludePathEntry(new Path(relativePath_dot_slash_path), 0);
- CIncludePathEntry incRelativeEntry_dotdot = new CIncludePathEntry(new Path(relativePath_dotdot), 0);
- CIncludePathEntry incRelativeEntry_dotdot_slash_path = new CIncludePathEntry(new Path(relativePath_dotdot_slash_path), 0);
- CIncludePathEntry incEntry_dotdot_path = new CIncludePathEntry(locationPath_dotdot_path, 0);
- // use LOCAL flag not to clash with plain dot entries
- CIncludePathEntry incRelativeEntry_dotdot_slash = new CIncludePathEntry(new Path(relativePath_dotdot_slash), ICSettingEntry.LOCAL);
- CIncludePathEntry incRelativeEntry_dot_slash = new CIncludePathEntry(new Path(relativePath_dot_slash), ICSettingEntry.LOCAL);
-
- List entries = new ArrayList();
- entries.add(incRelativeEntry_dot);
- entries.add(incRelativeEntry_dot_slash);
- entries.add(incRelativeEntry_dot_slash_path);
- entries.add(incRelativeEntry_dotdot);
- entries.add(incRelativeEntry_dotdot_slash);
- entries.add(incRelativeEntry_dotdot_slash_path);
- entries.add(incEntry_dotdot_path);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test the entries received from the scannerInfoProvider
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
- String[] actualLocalIncludePaths = info.getLocalIncludePath();
-
- IPath expectedLocation_dot = buildFolder.getLocation();
- IPath expectedLocation_dot_slash = buildFolder.getLocation();
- IPath expectedLocation_dot_slash_path = relativeFolder_dot_slash_path.getLocation();
- IPath expectedLocation_dotdot = project.getLocation();
- IPath expectedLocation_dotdot_slash = project.getLocation();
- IPath expectedLocation_dotdot_slash_path = relativeFolder_dotdot_slash_path.getLocation();
-
- assertEquals(expectedLocation_dot, new Path(actualIncludePaths[0]));
- assertEquals(".", actualIncludePaths[1]);
- assertEquals(expectedLocation_dot_slash_path, new Path(actualIncludePaths[2]));
- assertEquals(new Path(relativePath_dot_slash_path), new Path(actualIncludePaths[3]));
-
- assertEquals(expectedLocation_dotdot, new Path(actualIncludePaths[4]));
- assertEquals("..", actualIncludePaths[5]);
- assertEquals(expectedLocation_dotdot_slash_path, new Path(actualIncludePaths[6]));
- assertEquals(new Path(relativePath_dotdot_slash_path), new Path(actualIncludePaths[7]));
- assertTrue(actualIncludePaths[7].startsWith(".."));
- assertEquals(new Path(locationPath_dotdot_path), new Path(actualIncludePaths[8]));
- assertTrue(actualIncludePaths[8].contains(".."));
- assertEquals(9, actualIncludePaths.length);
-
- assertEquals(expectedLocation_dot_slash, new Path(actualLocalIncludePaths[0]));
- assertEquals(new Path(relativePath_dot_slash), new Path(actualLocalIncludePaths[1]));
- assertTrue(actualLocalIncludePaths[1].startsWith("."));
- assertEquals(expectedLocation_dotdot_slash, new Path(actualLocalIncludePaths[2]));
- assertEquals(new Path(relativePath_dotdot_slash), new Path(actualLocalIncludePaths[3]));
- assertTrue(actualLocalIncludePaths[3].startsWith(".."));
- assertEquals(4, actualLocalIncludePaths.length);
- }
-
- /**
- * Test if build/environment variables are expanded
- */
- public void testEnvironmentVars() throws Exception {
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- IFolder folder = ResourceHelper.createFolder(project, "Folder");
- String envPathStr = "${ProjDirPath}/Folder";
-
- // get project/configuration descriptions
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // create sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // contribute the entries
- CIncludePathEntry incRelativeEntry = new CIncludePathEntry(envPathStr, 0);
- List entries = new ArrayList();
- entries.add(incRelativeEntry);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test the entries received from the scannerInfoProvider
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
-
- IPath expectedLocation = folder.getLocation();
- assertEquals(expectedLocation, new Path(actualIncludePaths[0]));
- assertEquals(1, actualIncludePaths.length);
- }
-
- /**
- * Test from parent folder's entries.
- */
- public void testParentFolder() throws Exception {
- class MockProviderForResource extends LanguageSettingsBaseProvider implements ILanguageSettingsProvider {
- private IResource rc;
- private final List entries;
-
- public MockProviderForResource(IResource rc, List entries) {
- this.rc = rc;
- this.entries = entries;
- }
-
- @Override
- public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
- if (this.rc.equals(rc))
- return entries;
- return null;
- }
- }
-
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // sample file
- IFolder parentFolder = ResourceHelper.createFolder(project, "ParentFolder");
- IFile file = ResourceHelper.createFile(project, "ParentFolder/file.c");
-
- // contribute the entries
- IFolder incFolder = ResourceHelper.createFolder(project, "include");
- CIncludePathEntry includePathEntry = new CIncludePathEntry(incFolder, 0);
-
- List entries = new ArrayList();
- entries.add(includePathEntry);
-
- // add provider for parent folder
- ILanguageSettingsProvider provider = new MockProviderForResource(parentFolder, entries);
- assertNull(provider.getSettingEntries(cfgDescription, file, null));
- assertEquals(includePathEntry, provider.getSettingEntries(cfgDescription, parentFolder, null).get(0));
-
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test that the scannerInfoProvider gets the entries for
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
- // include paths
- assertEquals(incFolder.getLocation(), new Path(actualIncludePaths[0]));
- assertEquals(1, actualIncludePaths.length);
- }
-
- /**
- * Test resolved paths.
- */
- public void testResolvedPath() throws Exception {
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- IFolder folder = ResourceHelper.createFolder(project, "Folder");
- String envPathStr = "${ProjDirPath}/Folder";
-
- // get project/configuration descriptions
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // create sample file
- IFile file = ResourceHelper.createFile(project, "file.c");
-
- // contribute the entries
- CIncludePathEntry incRelativeEntry = new CIncludePathEntry(envPathStr, ICSettingEntry.RESOLVED);
- List entries = new ArrayList();
- entries.add(incRelativeEntry);
-
- // add provider to the configuration
- ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
- List providers = new ArrayList();
- providers.add(provider);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test the entries received from the scannerInfoProvider
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
- String[] actualIncludePaths = info.getIncludePaths();
-
- // test that RESOLVED entries are not modified
- IPath expectedLocation = new Path(envPathStr);
- assertEquals(expectedLocation, new Path(actualIncludePaths[0]));
- assertEquals(1, actualIncludePaths.length);
- }
-
- /**
- * Get languages for the folder.
- */
- private List getLanguages(IFolder folder, ICConfigurationDescription cfgDescription) {
- IPath rcPath = folder.getProjectRelativePath();
- ICFolderDescription rcDes = (ICFolderDescription) cfgDescription.getResourceDescription(rcPath, false);
- ICLanguageSetting[] langSettings = rcDes.getLanguageSettings();
- assertNotNull(langSettings);
-
- List languageIds = new ArrayList();
- for (ICLanguageSetting ls : langSettings) {
- String langId = ls.getLanguageId();
- if (langId!=null && !languageIds.contains(langId)) {
- languageIds.add(langId);
- }
- }
- return languageIds;
- }
-
- /**
- * Test composition of 2 languages.
- */
- public void testResourceLanguages() throws Exception {
- class MockProviderLang extends LanguageSettingsBaseProvider implements ILanguageSettingsProvider {
- private final String langId;
- private final List entries;
-
- public MockProviderLang(String id, String name, String langId, List entries) {
- super(id, name);
- this.langId = langId;
- this.entries = entries;
- }
-
- @Override
- public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
- if (langId==null || langId.equals(languageId))
- return entries;
- return new ArrayList();
- }
- }
-
- // create a project
- IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
- IFolder folder = ResourceHelper.createFolder(project, "Folder");
-
- IFolder incFolderA = ResourceHelper.createFolder(project, "includeA");
- IFolder incFolderB = ResourceHelper.createFolder(project, "includeB");
- IFolder incFolderC = ResourceHelper.createFolder(project, "includeC");
-
- // get project/configuration descriptions
- ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
- assertNotNull(prjDescription);
- ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
- assertNotNull(cfgDescription);
- assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
-
- // find 2 languages applicable to the folder
- List languageIds = getLanguages(folder, cfgDescription);
- assertTrue(languageIds.size() >= 2);
- String langId1 = languageIds.get(0);
- String langId2 = languageIds.get(1);
-
- // define overlapping entries
- CIncludePathEntry incEntryA = new CIncludePathEntry(incFolderA, 0);
- CIncludePathEntry incEntryB = new CIncludePathEntry(incFolderB, 0);
- CIncludePathEntry incEntryC = new CIncludePathEntry(incFolderC, 0);
- List entries1 = new ArrayList();
- entries1.add(incEntryA);
- entries1.add(incEntryB);
- List entries2 = new ArrayList();
- entries2.add(incEntryC);
- entries2.add(incEntryB);
-
- // add providers to the configuration
- ILanguageSettingsProvider provider1 = new MockProviderLang(PROVIDER_ID, PROVIDER_NAME, langId1, entries1);
- ILanguageSettingsProvider provider2 = new MockProviderLang(PROVIDER_ID_2, PROVIDER_NAME, langId2, entries2);
- List providers = new ArrayList();
- providers.add(provider1);
- providers.add(provider2);
- ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
-
- // set project description
- CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
-
- // test the entries received from the scannerInfoProvider
- LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
- ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(folder);
- String[] actualIncludePaths = info.getIncludePaths();
-
- // Test that the result is the union of entries
- assertEquals(incFolderA.getLocation(), new Path(actualIncludePaths[0]));
- assertEquals(incFolderB.getLocation(), new Path(actualIncludePaths[1]));
- assertEquals(incFolderC.getLocation(), new Path(actualIncludePaths[2]));
- assertEquals(3, actualIncludePaths.length);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2012 Andrew Gvozdev and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Gvozdev - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.core.language.settings.providers;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.core.model.ILanguage;
+import org.eclipse.cdt.core.model.LanguageManager;
+import org.eclipse.cdt.core.parser.ExtendedScannerInfo;
+import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
+import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
+import org.eclipse.cdt.core.settings.model.CMacroEntry;
+import org.eclipse.cdt.core.settings.model.CMacroFileEntry;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICFolderDescription;
+import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
+import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.core.settings.model.ICSettingEntry;
+import org.eclipse.cdt.core.testplugin.ResourceHelper;
+import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
+import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsScannerInfoProvider;
+import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Test cases testing LanguageSettingsProvider functionality
+ */
+public class LanguageSettingsScannerInfoProviderTests extends BaseTestCase {
+ private static final IFile FAKE_FILE = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/project/path0"));
+ private static final String PROVIDER_ID = "test.provider.id";
+ private static final String PROVIDER_ID_2 = "test.provider.id.2";
+ private static final String PROVIDER_NAME = "test.provider.name";
+
+ // constants for getProjectDescription()
+ private static final boolean READ_ONLY = false;
+ private static final boolean WRITEABLE = true;
+
+ private class MockProvider extends LanguageSettingsBaseProvider implements ILanguageSettingsProvider {
+ private final List entries;
+
+ public MockProvider(String id, String name, List entries) {
+ super(id, name);
+ this.entries = entries;
+ }
+
+ @Override
+ public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
+ return entries;
+ }
+ }
+
+ /**
+ * Constructor.
+ * @param name - name of the test.
+ */
+ public LanguageSettingsScannerInfoProviderTests(String name) {
+ super(name);
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown(); // includes ResourceHelper cleanup
+ }
+
+ /**
+ * @return - new TestSuite.
+ */
+ public static TestSuite suite() {
+ return new TestSuite(LanguageSettingsScannerInfoProviderTests.class);
+ }
+
+ /**
+ * main function of the class.
+ *
+ * @param args - arguments
+ */
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+
+ /**
+ * Sets build working directory for DefaultSettingConfiguration being tested.
+ */
+ private void setBuilderCWD(IProject project, IPath buildCWD) throws CoreException {
+ CProjectDescriptionManager manager = CProjectDescriptionManager.getInstance();
+ {
+ ICProjectDescription prjDescription = manager.getProjectDescription(project, WRITEABLE);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+
+ cfgDescription.getBuildSetting().setBuilderCWD(buildCWD);
+ manager.setProjectDescription(project, prjDescription);
+ // doublecheck builderCWD
+ IPath actualBuildCWD = cfgDescription.getBuildSetting().getBuilderCWD();
+ assertEquals(buildCWD, actualBuildCWD);
+ }
+ {
+ // triplecheck builderCWD for different project/configuration descriptions
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+
+ }
+ }
+
+ /**
+ * Test cases when some objects are null.
+ */
+ public void testNulls() throws Exception {
+ {
+ // Handle project==null
+ IResource root = ResourcesPlugin.getWorkspace().getRoot();
+ assertNull(root.getProject());
+
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(root);
+ assertEquals(0, info.getIncludePaths().length);
+ assertEquals(0, info.getDefinedSymbols().size());
+ assertEquals(0, info.getIncludeFiles().length);
+ assertEquals(0, info.getMacroFiles().length);
+ assertEquals(0, info.getLocalIncludePath().length);
+ }
+
+ {
+ // Handle prjDescription==null
+ IProject project = FAKE_FILE.getProject();
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
+ assertNull(prjDescription);
+
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(FAKE_FILE);
+ assertEquals(0, info.getIncludePaths().length);
+ assertEquals(0, info.getDefinedSymbols().size());
+ assertEquals(0, info.getIncludeFiles().length);
+ assertEquals(0, info.getMacroFiles().length);
+ assertEquals(0, info.getLocalIncludePath().length);
+ }
+
+ {
+ // Handle language==null
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
+ IFile file = ResourceHelper.createFile(project, "file");
+
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+ ILanguage language = LanguageManager.getInstance().getLanguageForFile(file, cfgDescription);
+ assertNull(language);
+
+ // AG FIXME - temporarily ignore the entry in the log
+ setExpectedNumberOfLoggedNonOKStatusObjects(1);
+
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
+ assertEquals(0, info.getIncludePaths().length);
+ assertEquals(0, info.getDefinedSymbols().size());
+ assertEquals(0, info.getIncludeFiles().length);
+ assertEquals(0, info.getMacroFiles().length);
+ assertEquals(0, info.getLocalIncludePath().length);
+ }
+ }
+
+ /**
+ * Test empty scanner info.
+ */
+ public void testEmpty() throws Exception {
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
+ IFile file = ResourceHelper.createFile(project, "file.c");
+
+ // confirm that language==null
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, READ_ONLY);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+ ILanguage language = LanguageManager.getInstance().getLanguageForFile(file, cfgDescription);
+ assertNotNull(language);
+
+ // test that the info is empty
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
+ assertEquals(0, info.getIncludePaths().length);
+ assertEquals(0, info.getDefinedSymbols().size());
+ assertEquals(0, info.getIncludeFiles().length);
+ assertEquals(0, info.getMacroFiles().length);
+ assertEquals(0, info.getLocalIncludePath().length);
+ }
+
+ /**
+ * Test regular cases.
+ */
+ public void testRegular() throws Exception {
+ // create a project
+ IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+ assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
+
+ // sample file
+ IFile file = ResourceHelper.createFile(project, "file.c");
+
+ // sanity test of language
+ ILanguage language = LanguageManager.getInstance().getLanguageForFile(file, cfgDescription);
+ assertNotNull(language);
+
+ // contribute the entries
+ IFolder includeFolder = ResourceHelper.createFolder(project, "/include-path");
+ IFolder includeLocalFolder = ResourceHelper.createFolder(project, "/local-include-path");
+ IFile macroFile = ResourceHelper.createFile(project, "macro-file");
+ IFile includeFile = ResourceHelper.createFile(project, "include-file");
+
+ CIncludePathEntry includePathEntry = new CIncludePathEntry(includeFolder, 0);
+ CIncludePathEntry includeLocalPathEntry = new CIncludePathEntry(includeLocalFolder, ICSettingEntry.LOCAL); // #include "..."
+ CMacroEntry macroEntry = new CMacroEntry("MACRO", "value",0);
+ CIncludeFileEntry includeFileEntry = new CIncludeFileEntry(includeFile, 0);
+ CMacroFileEntry macroFileEntry = new CMacroFileEntry(macroFile, 0);
+
+ List entries = new ArrayList();
+ entries.add(includePathEntry);
+ entries.add(includeLocalPathEntry);
+ entries.add(macroEntry);
+ entries.add(includeFileEntry);
+ entries.add(macroFileEntry);
+
+ // add provider to the configuration
+ ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
+ List providers = new ArrayList();
+ providers.add(provider);
+ ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
+
+ // set project description
+ CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
+
+ // test that the scannerInfoProvider gets the entries
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
+ String[] actualIncludePaths = info.getIncludePaths();
+ Map actualDefinedSymbols = info.getDefinedSymbols();
+ String[] actualIncludeFiles = info.getIncludeFiles();
+ String[] actualMacroFiles = info.getMacroFiles();
+ String[] actualLocalIncludePath = info.getLocalIncludePath();
+ // include paths
+ assertEquals(includeFolder.getLocation(), new Path(actualIncludePaths[0]));
+ assertEquals(1, actualIncludePaths.length);
+ // macros
+ assertEquals(macroEntry.getValue(), actualDefinedSymbols.get(macroEntry.getName()));
+ assertEquals(1, actualDefinedSymbols.size());
+ // include file
+ assertEquals(includeFile.getLocation(), new Path(actualIncludeFiles[0]));
+ assertEquals(1, actualIncludeFiles.length);
+ // macro file
+ assertEquals(macroFile.getLocation(), new Path(actualMacroFiles[0]));
+ assertEquals(1, actualMacroFiles.length);
+ // local include files
+ assertEquals(includeLocalFolder.getLocation(), new Path(actualLocalIncludePath[0]));
+ assertEquals(1, actualLocalIncludePath.length);
+ }
+
+ /**
+ * Test "local" flag (#include "...").
+ */
+ public void testLocal() throws Exception {
+ // create a project
+ IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+ assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
+
+ // sample file
+ IFile file = ResourceHelper.createFile(project, "file.c");
+
+ // contribute the entries
+ IFolder incFolder = ResourceHelper.createFolder(project, "include");
+ IFolder incFolder2 = ResourceHelper.createFolder(project, "include2");
+ CIncludePathEntry includePathEntry = new CIncludePathEntry(incFolder, 0);
+ CIncludePathEntry includeLocalPathEntry = new CIncludePathEntry(incFolder, ICSettingEntry.LOCAL); // #include "..."
+ CIncludePathEntry includeLocalPathEntry2 = new CIncludePathEntry(incFolder2, ICSettingEntry.LOCAL); // #include "..."
+ CIncludePathEntry includePathEntry2 = new CIncludePathEntry(incFolder2, 0);
+
+ List entries = new ArrayList();
+ entries.add(includePathEntry);
+ entries.add(includeLocalPathEntry);
+ // reverse order for incPath2
+ entries.add(includeLocalPathEntry2);
+ entries.add(includePathEntry2);
+
+ // add provider to the configuration
+ ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
+ List providers = new ArrayList();
+ providers.add(provider);
+ ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
+
+ // set project description
+ CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
+
+ // test that the scannerInfoProvider gets the entries
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
+ String[] actualIncludePaths = info.getIncludePaths();
+ String[] actualLocalIncludePath = info.getLocalIncludePath();
+ // include paths
+ assertEquals(incFolder.getLocation(), new Path(actualIncludePaths[0]));
+ assertEquals(incFolder2.getLocation(), new Path(actualIncludePaths[1]));
+ assertEquals(2, actualIncludePaths.length);
+ // local include files
+ assertEquals(incFolder.getLocation(), new Path(actualLocalIncludePath[0]));
+ assertEquals(incFolder2.getLocation(), new Path(actualLocalIncludePath[1]));
+ assertEquals(2, actualLocalIncludePath.length);
+ }
+
+ /**
+ * Test Mac frameworks.
+ */
+ public void testFramework() throws Exception {
+ // create a project
+ IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+ assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
+
+ // sample file
+ IFile file = ResourceHelper.createFile(project, "file.c");
+
+ // contribute the entries
+ IFolder frameworkFolder = ResourceHelper.createFolder(project, "Fmwk");
+ CIncludePathEntry frameworkPathEntry = new CIncludePathEntry(frameworkFolder, ICSettingEntry.FRAMEWORKS_MAC);
+
+ List entries = new ArrayList();
+ entries.add(frameworkPathEntry);
+
+ // add provider to the configuration
+ ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
+ List providers = new ArrayList();
+ providers.add(provider);
+ ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
+
+ // set project description
+ CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
+
+ // test that the scannerInfoProvider gets the entries
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
+ String[] actualIncludePaths = info.getIncludePaths();
+ // include paths
+ assertEquals(frameworkFolder.getLocation().append("/__framework__.framework/Headers/__header__"),
+ new Path(actualIncludePaths[0]));
+ assertEquals(frameworkFolder.getLocation().append("/__framework__.framework/PrivateHeaders/__header__"),
+ new Path(actualIncludePaths[1]));
+ assertEquals(2, actualIncludePaths.length);
+ }
+
+ /**
+ * Test duplicate entries.
+ */
+ public void testDuplicate() throws Exception {
+ // create a project
+ IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+ assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
+
+ // sample file
+ IFile file = ResourceHelper.createFile(project, "file.c");
+
+ // contribute the entries
+ IFolder incFolder = ResourceHelper.createFolder(project, "include");
+ CIncludePathEntry includePathEntry = new CIncludePathEntry(incFolder, 0);
+ CIncludePathEntry includeLocalPathEntry = new CIncludePathEntry(incFolder, ICSettingEntry.LOCAL); // #include "..."
+ CIncludePathEntry includePathEntry2 = new CIncludePathEntry(incFolder, 0);
+ CIncludePathEntry includeLocalPathEntry2 = new CIncludePathEntry(incFolder, ICSettingEntry.LOCAL); // #include "..."
+
+ List entries = new ArrayList();
+ entries.add(includePathEntry);
+ entries.add(includeLocalPathEntry);
+ entries.add(includePathEntry2);
+ entries.add(includeLocalPathEntry2);
+
+ // add provider to the configuration
+ ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
+ List providers = new ArrayList();
+ providers.add(provider);
+ ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
+
+ // set project description
+ CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
+
+ // test that the scannerInfoProvider gets the entries
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
+ String[] actualIncludePaths = info.getIncludePaths();
+ String[] actualLocalIncludePath = info.getLocalIncludePath();
+ // include paths
+ assertEquals(incFolder.getLocation(), new Path(actualIncludePaths[0]));
+ assertEquals(1, actualIncludePaths.length);
+ // local include files
+ assertEquals(incFolder.getLocation(), new Path(actualLocalIncludePath[0]));
+ assertEquals(1, actualLocalIncludePath.length);
+ }
+
+ /**
+ * Test include path managed by eclipse as a workspace path.
+ */
+ public void testWorkspacePath() throws Exception {
+ // create a project
+ IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+ assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
+
+ // create sample file
+ IFile file = ResourceHelper.createFile(project, "file.c");
+ // eclipse-managed folder in workspace
+ IFolder incWorkspace_1 = ResourceHelper.createFolder(project, "include_1");
+ IPath incWorkspaceLocation_1 = incWorkspace_1.getLocation();
+ IFolder incWorkspace_2 = ResourceHelper.createFolder(project, "include_2");
+ IPath incWorkspacePath_2 = incWorkspace_2.getFullPath();
+ IPath incWorkspaceLocation_2 = incWorkspace_2.getLocation();
+ IFolder incWorkspace_3 = ResourceHelper.createFolder(project, "include_3");
+ // "relative" should make no difference for VALUE_WORKSPACE_PATH
+ IPath incWorkspaceRelativePath_3 = incWorkspace_3.getFullPath().makeRelative();
+ IPath incWorkspaceLocation_3 = incWorkspace_3.getLocation();
+ // not having "RESOLVED" should make no difference for well formed path
+ IFolder incWorkspace_4 = ResourceHelper.createFolder(project, "include_4");
+ IPath incWorkspacePathNoResolved_4 = incWorkspace_4.getFullPath();
+ IPath incWorkspaceLocation_4 = incWorkspace_4.getLocation();
+ // folder defined by absolute path on the filesystem
+ IPath incFilesystem = ResourceHelper.createWorkspaceFolder("includeFilesystem");
+
+ // contribute the entries
+ CIncludePathEntry incWorkspaceEntry_1 = new CIncludePathEntry(incWorkspace_1, 0);
+ CIncludePathEntry incWorkspaceEntry_2 = new CIncludePathEntry(incWorkspacePath_2, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
+ CIncludePathEntry incWorkspaceEntry_3 = new CIncludePathEntry(incWorkspaceRelativePath_3, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
+ CIncludePathEntry incWorkspaceEntry_4 = new CIncludePathEntry(incWorkspacePathNoResolved_4, ICSettingEntry.VALUE_WORKSPACE_PATH);
+ CIncludePathEntry incFilesystemEntry = new CIncludePathEntry(incFilesystem, 0);
+
+ List entries = new ArrayList();
+ entries.add(incWorkspaceEntry_1);
+ entries.add(incWorkspaceEntry_2);
+ entries.add(incWorkspaceEntry_3);
+ entries.add(incWorkspaceEntry_4);
+ entries.add(incFilesystemEntry);
+
+ // add provider to the configuration
+ ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
+ List providers = new ArrayList();
+ providers.add(provider);
+ ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
+
+ // set project description
+ CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
+
+ // test the entries received from the scannerInfoProvider
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
+ String[] actualIncludePaths = info.getIncludePaths();
+
+ assertEquals(incWorkspaceLocation_1, new Path(actualIncludePaths[0]));
+ assertEquals(incWorkspaceLocation_2, new Path(actualIncludePaths[1]));
+ assertEquals(incWorkspaceLocation_3, new Path(actualIncludePaths[2]));
+ assertEquals(incWorkspaceLocation_4, new Path(actualIncludePaths[3]));
+ assertEquals(incFilesystem, new Path(actualIncludePaths[4]));
+ assertEquals(5, actualIncludePaths.length);
+
+ }
+
+ /**
+ * Confirm that device letter is prepended on filesystems that support that.
+ */
+ public void testFilesystemPathNoDriveLetter() throws Exception {
+ // create a project
+ IProject project = ResourceHelper.createCDTProjectWithConfig(getName());
+ // change drive on build working directory
+ String buildCwdDevice = project.getLocation().getDevice();
+
+// // Test manually with a device which is different from project location device (path should exist)
+// IPath buildCWD = new Path("D:/build/path");
+// String buildCwdDevice = buildCWD.getDevice();
+
+ // get project/configuration descriptions
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+ assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
+
+ // create sample file
+ IFile file = ResourceHelper.createFile(project, "file.c");
+
+ // contribute the entries
+ // no-drive-letter folder defined by absolute path on the filesystem
+ IPath incFilesystem = ResourceHelper.createWorkspaceFolder("includeFilesystem").setDevice(null);
+ CIncludePathEntry incFilesystemEntry = new CIncludePathEntry(incFilesystem, 0);
+ List entries = new ArrayList();
+ entries.add(incFilesystemEntry);
+
+ // add provider to the configuration
+ ILanguageSettingsProvider provider = new MockProvider(PROVIDER_ID, PROVIDER_NAME, entries);
+ List providers = new ArrayList();
+ providers.add(provider);
+ ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
+
+ // set project description
+ CProjectDescriptionManager.getInstance().setProjectDescription(project, prjDescription);
+
+ // test the entries received from the scannerInfoProvider
+ LanguageSettingsScannerInfoProvider scannerInfoProvider = new LanguageSettingsScannerInfoProvider();
+ ExtendedScannerInfo info = scannerInfoProvider.getScannerInformation(file);
+ String[] actualIncludePaths = info.getIncludePaths();
+
+ IPath expectedInclude = incFilesystem.setDevice(buildCwdDevice);
+ assertEquals(expectedInclude, new Path(actualIncludePaths[0]));
+ assertEquals(1, actualIncludePaths.length);
+ }
+
+ /**
+ * Test relative paths.
+ */
+ public void testRelativePath() throws Exception {
+ // create a project
+ String prjName = getName();
+ IProject project = ResourceHelper.createCDTProjectWithConfig(prjName);
+ String relativePath = "include";
+ IFolder buildFolder = ResourceHelper.createFolder(project, "buildDir");
+ IFolder relativeFolder = ResourceHelper.createFolder(project, "buildDir/"+relativePath);
+ IFolder relativeFolderProjName = ResourceHelper.createFolder(project, "buildDir/"+prjName);
+ String markedResolved = "-MarkedResolved";
+ IFolder relativeFolderProjNameResolved = ResourceHelper.createFolder(project, "buildDir/" + prjName+markedResolved);
+ IPath buildCWD=buildFolder.getLocation();
+ setBuilderCWD(project, buildCWD);
+
+ // get project/configuration descriptions
+ ICProjectDescription prjDescription = CProjectDescriptionManager.getInstance().getProjectDescription(project, WRITEABLE);
+ assertNotNull(prjDescription);
+ ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
+ assertNotNull(cfgDescription);
+ assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
+
+ // create sample file
+ IFile file = ResourceHelper.createFile(project, "file.c");
+
+ // contribute the entries
+ CIncludePathEntry incRelativeEntry = new CIncludePathEntry(new Path(relativePath), 0);
+ CIncludePathEntry incProjNameEntry = new CIncludePathEntry(new Path("${ProjName}"), 0);
+ CIncludePathEntry incProjNameMarkedResolvedEntry = new CIncludePathEntry(new Path("${ProjName}"+markedResolved), ICSettingEntry.RESOLVED);
+ List entries = new ArrayList